Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(zoom): prevent wheel interfering with pinch #1639

Merged
merged 2 commits into from
Mar 22, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions packages/visx-zoom/src/Zoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,16 @@ function Zoom<ElementType extends Element>({
},
onDragEnd: dragEnd,
onPinch: handlePinch,
onWheel: ({ event, active }) => {
// currently onWheelEnd emits one final wheel event which causes 2x scale
// updates for the last tick. ensuring that the gesture is active avoids this
if (!active) return;
onWheel: ({ event, active, pinching }) => {
if (
// Outside of Safari, the wheel event is fired together with the pinch event.
williaster marked this conversation as resolved.
Show resolved Hide resolved
pinching ||
// currently onWheelEnd emits one final wheel event which causes 2x scale
// updates for the last tick. ensuring that the gesture is active avoids this
!active
) {
return;
}
handleWheel(event);
},
},
Expand Down