From 96b40649869566db331d7d7e8e2fa199a0c2b900 Mon Sep 17 00:00:00 2001 From: Anders Gustafsson <34234789+anders-photowall@users.noreply.github.com> Date: Thu, 24 Mar 2022 12:19:19 +0100 Subject: [PATCH] 2301 - Add rounding (#11) --- dist/image-editor.js | 3 +++ src/DragHandle.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/dist/image-editor.js b/dist/image-editor.js index a5f460d..9f1dfd2 100644 --- a/dist/image-editor.js +++ b/dist/image-editor.js @@ -723,6 +723,9 @@ var DragHandle = function (handler) { heightToDisplay -= unit == 'inch' ? doubleRealFrameWidth / 2.54 : doubleRealFrameWidth; } + widthToDisplay = Math.round((widthToDisplay + Number.EPSILON) * 10) / 10; + heightToDisplay = Math.round((heightToDisplay + Number.EPSILON) * 10) / 10; + this.__handles = { x: getRect(widthToDisplay + ' ' + unit, handleWidth), y: getRect(heightToDisplay + ' ' + unit, handleHeight) diff --git a/src/DragHandle.js b/src/DragHandle.js index 2b70243..f4e6e5c 100644 --- a/src/DragHandle.js +++ b/src/DragHandle.js @@ -123,6 +123,9 @@ var DragHandle = function (handler) { heightToDisplay -= unit == 'inch' ? doubleRealFrameWidth / 2.54 : doubleRealFrameWidth; } + widthToDisplay = Math.round((widthToDisplay + Number.EPSILON) * 10) / 10; + heightToDisplay = Math.round((heightToDisplay + Number.EPSILON) * 10) / 10; + this.__handles = { x: getRect(widthToDisplay + ' ' + unit, handleWidth), y: getRect(heightToDisplay + ' ' + unit, handleHeight)