-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Make sure pinch zoom always zooms the map, not the UI #5492
Comments
Just an update on this - b7e218a contains a kind of hacky fix for the issue at least in Safari, but I'm leaving the issue open to test in other browsers. I say "hacky" because the code just turns the scale value we get from the Safari gesture event into a scroll wheel event that d3-zoom can handle. But it works ok enough. |
Ok! I spent a few more days on this and it's a lot less hacky now. I'm really happy with how pinch-zooming and 2-finger panning is working in Chrome, Safari, and Firefox. I've also been able to disable the unwanted browser zooming in Edge and IE, however these browsers aren't supporting the 2-finger gestures yet. The way forward is to switch them all over to the more standard PointerEvents, however that will require some more work. I'll open a followup issue for it. |
This is something I noticed a lot of new users struggling with at a mapathon yesterday.
Sometimes pinch zooming will zoom the map.. (I recorded this with Chrome):
But sometimes it will zoom the whole UI.. (I recorded this with Safari):
We want for it to zoom just the map not the whole UI - this is the user expectation.
The actual behavior seems to depend on which browser, which OS, and probably on other settings. I noticed a lot of users are on touch screens like Microsoft Surface or Chromebook now, and they prefer to interact directly on the screen. Many users don't use mice anymore!
iD mostly relies on d3.zoom handle the events for zooming and panning. My guess is that some browsers support Gesture Events and some don't. We can probably detect whatever event is causing the UI to zoom and preventDefault it.
The text was updated successfully, but these errors were encountered: