From 84d2dcf11ddbca900a940523c5a69a882cf6df7e Mon Sep 17 00:00:00 2001 From: Rainer Simon Date: Sat, 25 Mar 2023 18:38:41 +0100 Subject: [PATCH] Applied touch rotate fix suggested in #2319 --- src/viewer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/viewer.js b/src/viewer.js index af5bcf05..78c1c35d 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -3422,7 +3422,8 @@ function onCanvasPinch( event ) { 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))); + centerPt = this.viewport.pointFromPixel( event.center, true ); + this.viewport.rotateTo(this.viewport.getRotation(true) + ((angle1 - angle2) * (180 / Math.PI)), centerPt, true); } } }