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

Conversation

bon10
Copy link
Contributor

@bon10 bon10 commented Aug 30, 2024

This PR is for pinch-out pinch-in operation with the Mac trackpad.
It relates to the following issues.

It also affects shadcn/ui, which uses radix-ui internally.

@@ -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 👍

@theKashey theKashey merged commit db83df5 into theKashey:master Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants