From 2dd8df85cf2743749ac6d28cbbe70c331853bebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=B5=E5=A4=A7=E5=BF=AB=E6=95=91=E6=88=91?= Date: Tue, 25 Jan 2022 20:10:58 +0800 Subject: [PATCH 1/2] fix(RotateTool.js): evaluation of initialRotation fix: RotateTool rotate too quick when viewport.initialRotation is 0 --- src/tools/RotateTool.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/tools/RotateTool.js b/src/tools/RotateTool.js index e837b2f6f..07ec74d28 100644 --- a/src/tools/RotateTool.js +++ b/src/tools/RotateTool.js @@ -57,9 +57,7 @@ function defaultStrategy(evt) { const { roundAngles, rotateScale } = this.configuration; const { element, viewport, startPoints, currentPoints } = evt.detail; - const initialRotation = viewport.initialRotation - ? viewport.initialRotation - : viewport.rotation; + const initialRotation = viewport.initialRotation; // Calculate the center of the image const rect = element.getBoundingClientRect(element); From 75ea4211fb2d3ef4cecd1c5a919bc7024832b0aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=B5=E5=A4=A7=E5=BF=AB=E6=95=91=E6=88=91?= Date: Tue, 8 Feb 2022 10:23:11 +0800 Subject: [PATCH 2/2] :bug: initialRotation should be rotation only if it is undefined --- src/tools/RotateTool.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tools/RotateTool.js b/src/tools/RotateTool.js index 07ec74d28..fd64b8ec8 100644 --- a/src/tools/RotateTool.js +++ b/src/tools/RotateTool.js @@ -57,7 +57,10 @@ function defaultStrategy(evt) { const { roundAngles, rotateScale } = this.configuration; const { element, viewport, startPoints, currentPoints } = evt.detail; - const initialRotation = viewport.initialRotation; + const initialRotation = + viewport.initialRotation === undefined + ? viewport.rotation + : viewport.initialRotation; // Calculate the center of the image const rect = element.getBoundingClientRect(element);