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

Make sure pinch zoom always zooms the map, not the UI #5492

Closed
bhousel opened this issue Nov 16, 2018 · 2 comments
Closed

Make sure pinch zoom always zooms the map, not the UI #5492

bhousel opened this issue Nov 16, 2018 · 2 comments
Labels
usability An issue with ease-of-use or design

Comments

@bhousel
Copy link
Member

bhousel commented Nov 16, 2018

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):
zoom-map

But sometimes it will zoom the whole UI.. (I recorded this with Safari):
zoom-gesture

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.

@bhousel bhousel added the usability An issue with ease-of-use or design label Nov 16, 2018
bhousel added a commit that referenced this issue Nov 17, 2018
(still needs some more testing)
@bhousel bhousel added the wip Work in progress label Nov 17, 2018
@bhousel
Copy link
Member Author

bhousel commented Nov 17, 2018

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.

bhousel added a commit that referenced this issue Nov 20, 2018
@bhousel
Copy link
Member Author

bhousel commented Nov 20, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
usability An issue with ease-of-use or design
Projects
None yet
Development

No branches or pull requests

1 participant