Generalized the min rotation to min interaction distance.

This commit is contained in:
Uwe Oestermeier 2019-07-19 15:21:47 +02:00
parent bb0dcf2d9d
commit dcd5acb4d1
3 changed files with 21 additions and 18 deletions

13
dist/iwmlib.js vendored
View File

@ -3374,7 +3374,7 @@
scaleCloseThreshold = 0.1,
scaleCloseBuffer = 0.05,
maxRotation = Angle.degree2radian(5),
minRotationDistance = 0,
minInteractionDistance = 0,
useLowPassFilter = false
} = {}) {
if (rotationDegrees != null && rotation != null) {
@ -3420,7 +3420,7 @@
this.mouseZoomFactor = mouseZoomFactor;
this.autoBringToFront = autoBringToFront;
this.useLowPassFilter = useLowPassFilter;
this.minRotationDistance = minRotationDistance;
this.minInteractionDistance = minInteractionDistance;
if (useLowPassFilter) {
this.rotateLPF = new LowPassFilter();
this.zoomLPF = new LowPassFilter();
@ -3478,9 +3478,10 @@
rotate = this.rotateLPF.next(rotate);
zoom = this.zoomLPF.next(zoom);
}
if (delta.distance < this.minRotationDistance) {
let ratio = delta.distance / this.minRotationDistance;
if (delta.distance < this.minInteractionDistance) {
let ratio = delta.distance / this.minInteractionDistance;
rotate *= ratio;
zoom *= ratio;
}
this.transform(delta, zoom, rotate, delta.about);
@ -4202,7 +4203,7 @@
scaleCloseBuffer = 0.05,
useLowPassFilter = false,
maxRotation = Angle.degree2radian(15),
minRotationDistance = 200
minInteractionDistance = 200
} = {}
) {
super({
@ -4229,7 +4230,7 @@
onClose,
useLowPassFilter,
maxRotation,
minRotationDistance
minInteractionDistance
});
if (container == null || width == null || height == null) {
throw new Error('Invalid value: null')

13
dist/iwmlib.pixi.js vendored
View File

@ -6786,7 +6786,7 @@
scaleCloseThreshold = 0.1,
scaleCloseBuffer = 0.05,
maxRotation = Angle.degree2radian(5),
minRotationDistance = 0,
minInteractionDistance = 0,
useLowPassFilter = false
} = {}) {
if (rotationDegrees != null && rotation != null) {
@ -6832,7 +6832,7 @@
this.mouseZoomFactor = mouseZoomFactor;
this.autoBringToFront = autoBringToFront;
this.useLowPassFilter = useLowPassFilter;
this.minRotationDistance = minRotationDistance;
this.minInteractionDistance = minInteractionDistance;
if (useLowPassFilter) {
this.rotateLPF = new LowPassFilter();
this.zoomLPF = new LowPassFilter();
@ -6890,9 +6890,10 @@
rotate = this.rotateLPF.next(rotate);
zoom = this.zoomLPF.next(zoom);
}
if (delta.distance < this.minRotationDistance) {
let ratio = delta.distance / this.minRotationDistance;
if (delta.distance < this.minInteractionDistance) {
let ratio = delta.distance / this.minInteractionDistance;
rotate *= ratio;
zoom *= ratio;
}
this.transform(delta, zoom, rotate, delta.about);
@ -7438,7 +7439,7 @@
scaleCloseBuffer = 0.05,
useLowPassFilter = false,
maxRotation = Angle.degree2radian(15),
minRotationDistance = 200
minInteractionDistance = 200
} = {}
) {
super({
@ -7465,7 +7466,7 @@
onClose,
useLowPassFilter,
maxRotation,
minRotationDistance
minInteractionDistance
});
if (container == null || width == null || height == null) {
throw new Error('Invalid value: null')

View File

@ -286,7 +286,7 @@ export class AbstractScatter extends Throwable {
scaleCloseThreshold = 0.1,
scaleCloseBuffer = 0.05,
maxRotation = Angle.degree2radian(5),
minRotationDistance = 0,
minInteractionDistance = 0,
useLowPassFilter = false
} = {}) {
if (rotationDegrees != null && rotation != null) {
@ -332,7 +332,7 @@ export class AbstractScatter extends Throwable {
this.mouseZoomFactor = mouseZoomFactor
this.autoBringToFront = autoBringToFront
this.useLowPassFilter = useLowPassFilter
this.minRotationDistance = minRotationDistance
this.minInteractionDistance = minInteractionDistance
if (useLowPassFilter) {
this.rotateLPF = new LowPassFilter()
this.zoomLPF = new LowPassFilter()
@ -390,9 +390,10 @@ export class AbstractScatter extends Throwable {
rotate = this.rotateLPF.next(rotate)
zoom = this.zoomLPF.next(zoom)
}
if (delta.distance < this.minRotationDistance) {
let ratio = delta.distance / this.minRotationDistance
if (delta.distance < this.minInteractionDistance) {
let ratio = delta.distance / this.minInteractionDistance
rotate *= ratio
zoom *= ratio
}
this.transform(delta, zoom, rotate, delta.about)
@ -1114,7 +1115,7 @@ export class DOMScatter extends AbstractScatter {
scaleCloseBuffer = 0.05,
useLowPassFilter = false,
maxRotation = Angle.degree2radian(15),
minRotationDistance = 200
minInteractionDistance = 200
} = {}
) {
super({
@ -1141,7 +1142,7 @@ export class DOMScatter extends AbstractScatter {
onClose,
useLowPassFilter,
maxRotation,
minRotationDistance
minInteractionDistance
})
if (container == null || width == null || height == null) {
throw new Error('Invalid value: null')