mapbox / mapbox-gl-js

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
https://docs.mapbox.com/mapbox-gl-js/
Other
11.19k stars 2.22k forks source link

Pinch-to-zoom gesture should pan the map when both fingers move #8345

Open mourner opened 5 years ago

mourner commented 5 years ago

mapbox-gl-js version: v1.0.0 browser: iOS Safari / Android Chrome / Edge on Mobile

Capturing https://github.com/mapbox/mapbox-gl-js/pull/8100#issuecomment-499933976 by @1ec5:

does GL JS currently address the case of a two-finger pinch-to-zoom gesture where the averaged point between the fingers moves (a “wandering zoom”)? On a touchscreen, it’s quite difficult to keep that centerpoint stationary as you pinch your fingers or spread them apart. To maintain a responsive feel, it’s necessary to pan at the same time as zooming (though perhaps some use cases may call for a more precise gesture handler that locks the center while zooming).

Steps to Trigger Behavior

  1. Start zooming the map on a touch device
  2. Still touching the map with two fingers, try panning the map

Expected Behavior

The map moves so that the location between fingers persist through the whole gesture. For comparison, Leaflet and various other maps APIs do this.

Actual Behavior

The map doesn't move.

Link to Demonstration

https://docs.mapbox.com/mapbox-gl-js/example/simple-map/

Ali-Shah-Vis commented 4 years ago

Hi Vlad :)

Do you know how I can get the map to move with a single finger?

Thanks, Alistrandarious

rreusser commented 3 years ago

I see a slight variation of this issue, noted here: https://github.com/mapbox/mapbox-gl-js/issues/10657

In particular, I observe that it does pan, but that it pans at a speed which does not reflect zoom that has occurred during the gesture.