From ea78bd1b884605689659424e865d02fb9166f284 Mon Sep 17 00:00:00 2001 From: Timmy Willison <4timmywil@gmail.com> Date: Fri, 28 Jan 2022 11:07:13 -0500 Subject: [PATCH] fix(move): pass the original event to zoomToPoint calls - also ensure animate is disabled during a move event --- src/panzoom.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/panzoom.ts b/src/panzoom.ts index 4eee503c..0c76c300 100644 --- a/src/panzoom.ts +++ b/src/panzoom.ts @@ -402,7 +402,7 @@ function Panzoom( y: (clientY / effectiveArea.height) * (effectiveArea.height * toScale) } - return zoom(toScale, { animate: false, ...zoomOptions, focal }, originalEvent) + return zoom(toScale, { ...zoomOptions, animate: false, focal }, originalEvent) } function zoomWithWheel(event: WheelEvent, zoomOptions?: ZoomOptions) { @@ -417,7 +417,7 @@ function Panzoom( const wheel = delta < 0 ? 1 : -1 const toScale = constrainScale(scale * Math.exp((wheel * opts.step) / 3), opts).scale - return zoomToPoint(toScale, event, opts) + return zoomToPoint(toScale, event, opts, event) } function reset(resetOptions?: PanzoomOptions) { @@ -482,7 +482,7 @@ function Panzoom( // to determine the current scale const diff = getDistance(pointers) - startDistance const toScale = constrainScale((diff * options.step) / 80 + startScale).scale - zoomToPoint(toScale, current) + zoomToPoint(toScale, current, { animate: false }, event) } else { // Panning during pinch zoom can cause issues // because the zoom has not always rendered in time