Skip to content

Commit

Permalink
fix(move): pass the original event to zoomToPoint calls
Browse files Browse the repository at this point in the history
- also ensure animate is disabled during a move event
  • Loading branch information
timmywil committed Jan 28, 2022
1 parent a67bf1a commit ea78bd1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/panzoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ea78bd1

Please sign in to comment.