mapbox / mapbox/mapbox-gl-js

Disable compass interactivity for `interactive: false` maps

Open
#8,618 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**mapbox-gl-js version**: v1.2.1

**browser**: Chrome/Firefox, likely any

### Steps to Trigger Behavior

https://docs.mapbox.com/mapbox-gl-js/example/animate-camera-around-point/ with
`interactive: false` and
```
map.addControl(new mapboxgl.NavigationControl({
visualizePitch: true,
showZoom: false
}));
```

### Link to Demonstration

https://jsbin.com/yatuvegeti/1/edit?html,output

### Expected Behavior

It's not possible for the user to interrupt/alter the animation. Also the compass tooltip _Reset bearing to north_ should not be displayed.

### Actual Behavior

It's possible to rotate / tilt the map dragging the compass icon and the tooltip is displayed.

---

One could argue that this is not a bug, because the compass is a navigation control. In this case it would be appreciated if this issue would be considered as feature request. It would be useful to be able to use the compass for indicating bearing/pitch while animating the camera and the user is not able to interrupt/alter the animation.

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 with the animate-camera-around-point example and its NavigationControl configuration, then trace how interactive: false affects compass dragging and the Reset bearing to north tooltip. Done means the compass can still indicate bearing and pitch without letting users alter the camera or showing the tooltip when interactivity is disabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.