mapbox / mapbox/mapbox-gl-js

map.dragPan still allows dragging the pan on mobile

Open
#9,359 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api :memo: 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: 1.6.1

browser: any mobile browser (tested: edge, chrome, firefox, dolphin)

Steps to Trigger Behavior
  1. Two fingers on a touch screen
  2. And drag the camera
Link to Demonstration
this.map = new mapboxgl.Map({
    container: 'game_map',
    style: 'mapbox://styles/mapbox/light-v10',
    center: [location.coords.longitude, location.coords.latitude],
    zoom: 20,
    touchZoomRotate: {around: 'center'},
    scrollZoom: {around: 'center'},
    pitch: 60,
    bearing: -60,
    antialias: true,
    attributionControl: false,
    dragPan: false,
    maxZoom: 22,
    minZoom: 17
});
Expected Behavior

When the user tries to drag the pan with two fingers the pan should not move, the user is only allowed to rotate the camera (not move it).

Actual Behavior

When the user tries to drag the pan with two fingers the pan moves with the touch input from the user.

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

Start by reproducing the demonstrated Map configuration on a mobile browser with dragPan disabled, using a two-finger drag. Then trace the touch gesture handling for map panning and rotation. Done means two fingers can rotate the camera without moving its pan position when dragPan is false.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.