Added maxRotation parameter.
This commit is contained in:
+12
-3
@@ -268,7 +268,8 @@ export class AbstractScatter extends Throwable {
|
||||
onThrowFinished = null,
|
||||
scaleAutoClose = false,
|
||||
scaleCloseThreshold = 0.10,
|
||||
scaleCloseBuffer = 0.05
|
||||
scaleCloseBuffer = 0.05,
|
||||
maxRotation = 5
|
||||
} = {}) {
|
||||
if (rotationDegrees != null && rotation != null) {
|
||||
throw new Error('Use rotationDegrees or rotation but not both')
|
||||
@@ -300,6 +301,7 @@ export class AbstractScatter extends Throwable {
|
||||
this.startScale = startScale // Needed to reset object
|
||||
this.minScale = minScale
|
||||
this.maxScale = maxScale
|
||||
this.maxRotation = maxRotation
|
||||
this.overdoScaling = overdoScaling
|
||||
this.translatable = translatable
|
||||
if (!translatable) {
|
||||
@@ -311,6 +313,7 @@ export class AbstractScatter extends Throwable {
|
||||
this.resizable = resizable
|
||||
this.mouseZoomFactor = mouseZoomFactor
|
||||
this.autoBringToFront = autoBringToFront
|
||||
|
||||
this.dragging = false
|
||||
this.onTransform = onTransform != null ? [onTransform] : null
|
||||
this.onClose = onClose != null ? [onClose] : null
|
||||
@@ -345,10 +348,16 @@ export class AbstractScatter extends Throwable {
|
||||
|
||||
gesture(interaction) {
|
||||
let delta = interaction.delta()
|
||||
//console.log("gesture", delta)
|
||||
console.log("gesture", delta.rotate)
|
||||
if (delta != null) {
|
||||
this.addVelocity(delta)
|
||||
this.transform(delta, delta.zoom, delta.rotate, delta.about)
|
||||
let alpha = delta.rotate
|
||||
if (this.maxRotationPerStep != null) {
|
||||
if (Math.abs(alpha) > this.maxRotationPerStep) {
|
||||
alpha = 0
|
||||
}
|
||||
}
|
||||
this.transform(delta, delta.zoom, alpha, delta.about)
|
||||
if (delta.zoom != 1) this.interactionAnchor = delta.about
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user