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 broken when first touch is on a marker on touch devices #9675

Closed
levelsio opened this issue May 10, 2020 · 2 comments · Fixed by #9683
Closed

Pinch-to-zoom broken when first touch is on a marker on touch devices #9675

levelsio opened this issue May 10, 2020 · 2 comments · Fixed by #9683

Comments

@levelsio
Copy link

Since upgrading to v1.10.0, when a user uses a touch device (iPhone) and pinches to zoom on a map but there is a marker on their first touch (e.g. a marker is in the way), zoom will not happen at all. Only if user pinches to zoom outside the marker, the map will zoom.

This is new behavior and not expected I believe. Especially on a map with lots of markers (like my site: nomadlist.com/map), pinch zooming becomes very difficult as the user has to position both fingers outside any marker. It's also not how any other map API or app does it (e.g. Gmaps).

Example from Mapbox itself, open on a touch device like iPhone, zoom out, and try pinch zooming while first touch is on a marker:
https://docs.mapbox.com/mapbox-gl-js/example/custom-marker-icons/

@karimnaaji
Copy link
Contributor

Thanks for the details @levelsio , I looked at your map at nomadlist.com/map, and this would definitely be more of a problem there considering the marker density. I tested the behavior on iOS and confirm this is a regression from our custom-marker-icons page. @ansis would there any event canceling the gestures when we touch a marker?

@karimnaaji karimnaaji added this to the 1.10.1 milestone May 11, 2020
@ansis ansis self-assigned this May 12, 2020
ansis added a commit that referenced this issue May 13, 2020
Previously we were using e.targetTouches as the list of touches relevant
to the map. It contains only the touches that first touched the same
target. Touches that hit a marker have a different target.

This fixes uses e.touches and filters out touches who's target is not a
child of the map.

fix #9675
@karimnaaji
Copy link
Contributor

@levelsio we have a fix for this issue that will be available as part of v1.10.1, thanks for the report!

karimnaaji pushed a commit that referenced this issue May 14, 2020
* fix multi-finger gestures touching markers

Previously we were using e.targetTouches as the list of touches relevant
to the map. It contains only the touches that first touched the same
target. Touches that hit a marker have a different target.

This fixes uses e.touches and filters out touches who's target is not a
child of the map.

fix #9675

* update tests and add regression test
karimnaaji pushed a commit that referenced this issue May 14, 2020
* fix multi-finger gestures touching markers

Previously we were using e.targetTouches as the list of touches relevant
to the map. It contains only the touches that first touched the same
target. Touches that hit a marker have a different target.

This fixes uses e.touches and filters out touches who's target is not a
child of the map.

fix #9675

* update tests and add regression test
karimnaaji pushed a commit that referenced this issue May 14, 2020
* fix multi-finger gestures touching markers

Previously we were using e.targetTouches as the list of touches relevant
to the map. It contains only the touches that first touched the same
target. Touches that hit a marker have a different target.

This fixes uses e.touches and filters out touches who's target is not a
child of the map.

fix #9675

* update tests and add regression test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants