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

Pinch to zoom not working on mac due to ignoring all non-button events when ctrl is active #204

Closed
tsiki opened this issue May 9, 2020 · 5 comments
Assignees

Comments

@tsiki
Copy link

tsiki commented May 9, 2020

Hello,

It seems 295cb42 changed the zooming behavior to filter out any events where control is pressed, but at least in Chrome mac pinch behavior translates to an event where ctrl is true, meaning this change disables mac pinch to zoom by default.

Related SO question: https://stackoverflow.com/questions/59972769/d3-pinch-to-zoom-doesnt-work-in-v5-but-works-in-v4

@Fil
Copy link
Member

Fil commented May 13, 2020

Confirmed. I have restored pinch-to-zoom in this notebook but… it's very very slow, painful to interact with. Zooming with a scroll gesture is much faster.

@cschweikert
Copy link

I had the same issue. This seemes to be introduces with a fix for preventing dragging with ctrl key. See also d3/d3-drag/issues/62
Since this zooming works as a ctrl+wheel event setting a custom filter like this might help:

d3.zoom().filter(function() {
  return (!d3.event.ctrlKey || d3.event.type === 'wheel') && !d3.event.button;
})

This will reanable the old zoom behavior and should not interfere with fix d3/d3-drag/issues/62.

@Fil
Copy link
Member

Fil commented May 16, 2020

@Fil

This comment has been minimized.

@Fil
Copy link
Member

Fil commented May 29, 2020

I've updated the test notebook with a modified wheelDelta: when the wheel event is received with ctrlKey, we multiply the value by 5. Now it's more on par with the scroll gesture.

@Fil Fil self-assigned this Jun 24, 2020
@Fil Fil mentioned this issue Jul 13, 2020
@Fil Fil closed this as completed in 4d2a5f1 Aug 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants