From 2a39b215782db5fdee69d1fc8cc21dbd02bd68c9 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Fri, 29 Nov 2024 03:54:09 +1100 Subject: [PATCH] Fix Zoom Centre (#135) --- src/DragAndScale.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/DragAndScale.ts b/src/DragAndScale.ts index a088a2a..4c46bf0 100644 --- a/src/DragAndScale.ts +++ b/src/DragAndScale.ts @@ -222,6 +222,8 @@ export class DragAndScale { if (!rect) return zooming_center = zooming_center || [rect.width * 0.5, rect.height * 0.5] + zooming_center[0] -= rect.x + zooming_center[1] -= rect.y const center = this.convertCanvasToOffset(zooming_center) this.scale = value if (Math.abs(this.scale - 1) < 0.01) this.scale = 1