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

Handle pinch-in/pinch-out on a Mac trackpad #113

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/SideEffect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function RemoveScrollSideCar(props: IRemoveScrollEffectProps) {
}, [props.inert, props.lockRef.current, props.shards]);

const shouldCancelEvent = React.useCallback((event: WheelEvent | TouchEvent, parent: HTMLElement) => {
if ('touches' in event && event.touches.length === 2) {
if (('touches' in event && event.touches.length === 2) || (event.type === 'wheel' && event.ctrlKey)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what wheel + ctrlKey means?
I am trying this combination and it does nothing.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...as they enabled pinch-to-zoom gestures from multi-touch trackpad’s to be surfaced as mousewheelevent with the ctrlmodifier set to true...

This is how pinch to zoom works in desktop browsers 👍

return !lastProps.current.allowPinchZoom;
}

Expand Down