From 4547e582ffd9ab6a251ccbd43029b2b3961b8fbf Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 23 Mar 2025 17:11:06 +0100 Subject: [PATCH] Use the `MathClamp` helper function even more (PR 19617 follow-up) There's a few more spots that I accidentally missed in PR 19617. --- src/display/editor/editor.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/display/editor/editor.js b/src/display/editor/editor.js index 91ad4500d..49f1428e1 100644 --- a/src/display/editor/editor.js +++ b/src/display/editor/editor.js @@ -1006,15 +1006,14 @@ class AnnotationEditor { ); } else if (isHorizontal) { ratioX = - Math.max( - minWidth, - Math.min(1, Math.abs(oppositePoint[0] - point[0] - deltaX)) - ) / savedWidth; + MathClamp(Math.abs(oppositePoint[0] - point[0] - deltaX), minWidth, 1) / + savedWidth; } else { ratioY = - Math.max( + MathClamp( + Math.abs(oppositePoint[1] - point[1] - deltaY), minHeight, - Math.min(1, Math.abs(oppositePoint[1] - point[1] - deltaY)) + 1 ) / savedHeight; }