mapbox / mapbox/mapbox-gl-js

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

Open
#8,345 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature :green_apple:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**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/

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior on a touch device using the linked simple-map demonstration and the two-finger steps in the issue. Compare the observed gesture with the expected behavior: the map should pan while zooming so the location between the fingers remains consistent throughout the gesture.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.