Implements pinch rotate.

This commit is contained in:
Dominik Picheta 2014-08-20 09:58:40 +01:00
parent e93578fa54
commit 097714cf39

View File

@ -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.
*