Improved handling of min rotation distance.
This commit is contained in:
parent
dfe7c0a011
commit
bb0dcf2d9d
20
dist/iwmlib.js
vendored
20
dist/iwmlib.js
vendored
@ -3374,8 +3374,8 @@
|
|||||||
scaleCloseThreshold = 0.1,
|
scaleCloseThreshold = 0.1,
|
||||||
scaleCloseBuffer = 0.05,
|
scaleCloseBuffer = 0.05,
|
||||||
maxRotation = Angle.degree2radian(5),
|
maxRotation = Angle.degree2radian(5),
|
||||||
minRotationDistance = 200,
|
minRotationDistance = 0,
|
||||||
useLowPassFilter = true
|
useLowPassFilter = false
|
||||||
} = {}) {
|
} = {}) {
|
||||||
if (rotationDegrees != null && rotation != null) {
|
if (rotationDegrees != null && rotation != null) {
|
||||||
throw new Error('Use rotationDegrees or rotation but not both')
|
throw new Error('Use rotationDegrees or rotation but not both')
|
||||||
@ -3477,10 +3477,12 @@
|
|||||||
if (this.useLowPassFilter) {
|
if (this.useLowPassFilter) {
|
||||||
rotate = this.rotateLPF.next(rotate);
|
rotate = this.rotateLPF.next(rotate);
|
||||||
zoom = this.zoomLPF.next(zoom);
|
zoom = this.zoomLPF.next(zoom);
|
||||||
if (delta.distance < this.minRotationDistance) {
|
|
||||||
rotate = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (delta.distance < this.minRotationDistance) {
|
||||||
|
let ratio = delta.distance / this.minRotationDistance;
|
||||||
|
rotate *= ratio;
|
||||||
|
}
|
||||||
|
|
||||||
this.transform(delta, zoom, rotate, delta.about);
|
this.transform(delta, zoom, rotate, delta.about);
|
||||||
if (zoom != 1) this.interactionAnchor = delta.about;
|
if (zoom != 1) this.interactionAnchor = delta.about;
|
||||||
}
|
}
|
||||||
@ -4198,8 +4200,9 @@
|
|||||||
onClose = null,
|
onClose = null,
|
||||||
scaleCloseThreshold = 0.1,
|
scaleCloseThreshold = 0.1,
|
||||||
scaleCloseBuffer = 0.05,
|
scaleCloseBuffer = 0.05,
|
||||||
useLowPassFilter = true,
|
useLowPassFilter = false,
|
||||||
maxRotation = Angle.degree2radian(15)
|
maxRotation = Angle.degree2radian(15),
|
||||||
|
minRotationDistance = 200
|
||||||
} = {}
|
} = {}
|
||||||
) {
|
) {
|
||||||
super({
|
super({
|
||||||
@ -4225,7 +4228,8 @@
|
|||||||
scaleCloseBuffer,
|
scaleCloseBuffer,
|
||||||
onClose,
|
onClose,
|
||||||
useLowPassFilter,
|
useLowPassFilter,
|
||||||
maxRotation
|
maxRotation,
|
||||||
|
minRotationDistance
|
||||||
});
|
});
|
||||||
if (container == null || width == null || height == null) {
|
if (container == null || width == null || height == null) {
|
||||||
throw new Error('Invalid value: null')
|
throw new Error('Invalid value: null')
|
||||||
|
20
dist/iwmlib.pixi.js
vendored
20
dist/iwmlib.pixi.js
vendored
@ -6786,8 +6786,8 @@
|
|||||||
scaleCloseThreshold = 0.1,
|
scaleCloseThreshold = 0.1,
|
||||||
scaleCloseBuffer = 0.05,
|
scaleCloseBuffer = 0.05,
|
||||||
maxRotation = Angle.degree2radian(5),
|
maxRotation = Angle.degree2radian(5),
|
||||||
minRotationDistance = 200,
|
minRotationDistance = 0,
|
||||||
useLowPassFilter = true
|
useLowPassFilter = false
|
||||||
} = {}) {
|
} = {}) {
|
||||||
if (rotationDegrees != null && rotation != null) {
|
if (rotationDegrees != null && rotation != null) {
|
||||||
throw new Error('Use rotationDegrees or rotation but not both')
|
throw new Error('Use rotationDegrees or rotation but not both')
|
||||||
@ -6889,10 +6889,12 @@
|
|||||||
if (this.useLowPassFilter) {
|
if (this.useLowPassFilter) {
|
||||||
rotate = this.rotateLPF.next(rotate);
|
rotate = this.rotateLPF.next(rotate);
|
||||||
zoom = this.zoomLPF.next(zoom);
|
zoom = this.zoomLPF.next(zoom);
|
||||||
if (delta.distance < this.minRotationDistance) {
|
|
||||||
rotate = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (delta.distance < this.minRotationDistance) {
|
||||||
|
let ratio = delta.distance / this.minRotationDistance;
|
||||||
|
rotate *= ratio;
|
||||||
|
}
|
||||||
|
|
||||||
this.transform(delta, zoom, rotate, delta.about);
|
this.transform(delta, zoom, rotate, delta.about);
|
||||||
if (zoom != 1) this.interactionAnchor = delta.about;
|
if (zoom != 1) this.interactionAnchor = delta.about;
|
||||||
}
|
}
|
||||||
@ -7434,8 +7436,9 @@
|
|||||||
onClose = null,
|
onClose = null,
|
||||||
scaleCloseThreshold = 0.1,
|
scaleCloseThreshold = 0.1,
|
||||||
scaleCloseBuffer = 0.05,
|
scaleCloseBuffer = 0.05,
|
||||||
useLowPassFilter = true,
|
useLowPassFilter = false,
|
||||||
maxRotation = Angle.degree2radian(15)
|
maxRotation = Angle.degree2radian(15),
|
||||||
|
minRotationDistance = 200
|
||||||
} = {}
|
} = {}
|
||||||
) {
|
) {
|
||||||
super({
|
super({
|
||||||
@ -7461,7 +7464,8 @@
|
|||||||
scaleCloseBuffer,
|
scaleCloseBuffer,
|
||||||
onClose,
|
onClose,
|
||||||
useLowPassFilter,
|
useLowPassFilter,
|
||||||
maxRotation
|
maxRotation,
|
||||||
|
minRotationDistance
|
||||||
});
|
});
|
||||||
if (container == null || width == null || height == null) {
|
if (container == null || width == null || height == null) {
|
||||||
throw new Error('Invalid value: null')
|
throw new Error('Invalid value: null')
|
||||||
|
@ -286,8 +286,8 @@ export class AbstractScatter extends Throwable {
|
|||||||
scaleCloseThreshold = 0.1,
|
scaleCloseThreshold = 0.1,
|
||||||
scaleCloseBuffer = 0.05,
|
scaleCloseBuffer = 0.05,
|
||||||
maxRotation = Angle.degree2radian(5),
|
maxRotation = Angle.degree2radian(5),
|
||||||
minRotationDistance = 200,
|
minRotationDistance = 0,
|
||||||
useLowPassFilter = true
|
useLowPassFilter = false
|
||||||
} = {}) {
|
} = {}) {
|
||||||
if (rotationDegrees != null && rotation != null) {
|
if (rotationDegrees != null && rotation != null) {
|
||||||
throw new Error('Use rotationDegrees or rotation but not both')
|
throw new Error('Use rotationDegrees or rotation but not both')
|
||||||
@ -389,10 +389,12 @@ export class AbstractScatter extends Throwable {
|
|||||||
if (this.useLowPassFilter) {
|
if (this.useLowPassFilter) {
|
||||||
rotate = this.rotateLPF.next(rotate)
|
rotate = this.rotateLPF.next(rotate)
|
||||||
zoom = this.zoomLPF.next(zoom)
|
zoom = this.zoomLPF.next(zoom)
|
||||||
if (delta.distance < this.minRotationDistance) {
|
|
||||||
rotate = 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (delta.distance < this.minRotationDistance) {
|
||||||
|
let ratio = delta.distance / this.minRotationDistance
|
||||||
|
rotate *= ratio
|
||||||
|
}
|
||||||
|
|
||||||
this.transform(delta, zoom, rotate, delta.about)
|
this.transform(delta, zoom, rotate, delta.about)
|
||||||
if (zoom != 1) this.interactionAnchor = delta.about
|
if (zoom != 1) this.interactionAnchor = delta.about
|
||||||
}
|
}
|
||||||
@ -1110,8 +1112,9 @@ export class DOMScatter extends AbstractScatter {
|
|||||||
onClose = null,
|
onClose = null,
|
||||||
scaleCloseThreshold = 0.1,
|
scaleCloseThreshold = 0.1,
|
||||||
scaleCloseBuffer = 0.05,
|
scaleCloseBuffer = 0.05,
|
||||||
useLowPassFilter = true,
|
useLowPassFilter = false,
|
||||||
maxRotation = Angle.degree2radian(15)
|
maxRotation = Angle.degree2radian(15),
|
||||||
|
minRotationDistance = 200
|
||||||
} = {}
|
} = {}
|
||||||
) {
|
) {
|
||||||
super({
|
super({
|
||||||
@ -1137,7 +1140,8 @@ export class DOMScatter extends AbstractScatter {
|
|||||||
scaleCloseBuffer,
|
scaleCloseBuffer,
|
||||||
onClose,
|
onClose,
|
||||||
useLowPassFilter,
|
useLowPassFilter,
|
||||||
maxRotation
|
maxRotation,
|
||||||
|
minRotationDistance
|
||||||
})
|
})
|
||||||
if (container == null || width == null || height == null) {
|
if (container == null || width == null || height == null) {
|
||||||
throw new Error('Invalid value: null')
|
throw new Error('Invalid value: null')
|
||||||
|
Loading…
Reference in New Issue
Block a user