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

When plugin enable there is a significant delay when initiating zoom with 2 finger pinch on mobile devices #962

Open
dontwork opened this issue Feb 11, 2020 · 1 comment · May be fixed by #972
Labels

Comments

@dontwork
Copy link

mapbox-gl-js version: latest
mapbox-gl-draw version: latest

Steps to Trigger Behavior

  1. open a mobile browser and go here: https://docs.mapbox.com/mapbox-gl-js/example/mapbox-gl-draw/
  2. zoom using 2 fingers pinching outwards
  3. notice a delay on the initial action of zooming

if you hold your 2 fingers there for a short period it works when you move them but if you touch the screen with 2 fingers and immediately attempt to zoom using this method there is a delay. This delay does not seem to exist on desktop computers when doing the same gesture on a trackpad

Expected Behavior

Smooth delay-free zoom

Actual Behavior

Zoom delayed at initial 2 finger touch with immediate zoom

@karimnaaji karimnaaji added the bug label Feb 11, 2020
@trygveaa
Copy link

This is caused by this line:

event.originalEvent.stopPropagation();

I can't say I understand why that is there? Why should propagation of the touchmove event be stopped if it's not a drag? Does anyone know?

Another thing to consider if is drag should be called at all when multiple fingers are touching the map. I don't think it should, as drag is an operation you do with one finger. If any modes require handling touch with multiple fingers, they should use onTouchMove instead.

trygveaa added a commit to trygveaa/mapbox-gl-draw that referenced this issue Mar 20, 2020
Calling onDrag when multiple fingers are touching the map causes a delay
when you start pinch zooming. This is because the pinch is interpreted
as a tap in the beginning, which causes stopPropagation to be called.

I think dragging is an action you only do with one finger, so therefore
I think not calling onDrag is the correct solution to this.

Fixes mapbox#962
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants