-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
Differentiate between scroll and pinch-to-zoom #133
Comments
Probably it would make sense to make this customisable. For some use cases scrolling to zoom is kind of what you want (i.e. maps), others not so much. Alternatively we could do the Google Maps sort of thing where a little message pops up when you scroll over the interactive area telling the user to hold ctrl to zoom. |
Thanks for responding! Yes, I agree that scrolling to zoom can still be the best choice in some use cases. Also, it turns out I oversimplified the scrolling solution. Because with a regular scroll window, it's possible to drag your canvas out of view and not be able to scroll back to it. So you need a function that actually handles 'panning on scroll'. It would be great if the onWheel event could be customized to allow for this! I wouldn't know the best way to implement this, but here is a (still non-customizable) solution that I found works for my case:
where
|
Hi, thank you for all the great work! I use this package for zooming and panning in a user interface, and it works wonderfully.
The only issue I have is that the
onWheel
event handles both the scrolling and the pinch-to-zoom gestures, whereas it would be preferable if scrolling were still possible, as it is for example in the zoom-and-pan interfaces of Sketch and Metro.io.According to this article, the solution could be to add
(D.field "ctrlKey" D.bool)
to the decoder in theonWheel
function:If
ctrlKey
isFalse
, the message could be aNoOp
and thepreventDefault
in the event listener could be removed to allow scrolling.The text was updated successfully, but these errors were encountered: