diff --git a/src/viewer.js b/src/viewer.js index 5435b3a0..0df3e77a 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -2465,6 +2465,12 @@ function onCanvasPinch( event ) { this.viewport.applyConstraints(); } } + // Pinch rotate + var angle1 = Math.atan2(event.gesturePoints[0].currentPos.y - event.gesturePoints[1].currentPos.y, + event.gesturePoints[0].currentPos.x - event.gesturePoints[1].currentPos.x); + var angle2 = Math.atan2(event.gesturePoints[0].lastPos.y - event.gesturePoints[1].lastPos.y, + event.gesturePoints[0].lastPos.x - event.gesturePoints[1].lastPos.x); + this.viewport.setRotation(this.viewport.getRotation() + ((angle1 - angle2) * (180 / Math.PI))); /** * Raised when a pinch event occurs on the {@link OpenSeadragon.Viewer#canvas} element. *