mapbox / mapbox/mapbox-gl-js

contextmenu event should dissociate right click event from rotate/tilt event

Open
#8,824 9 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug :lady_beetle: environment-specific :desktop_computer: needs investigation :mag:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

I'm trying to implement a right click (long tap on mobile device) event that add a marker unfortunatly, when we rotate / tilt map with the right click button the marker is added too.

```
map.on('contextmenu', function(e) {
console.log(e);
/* adding marker is not a good idea here */
});
```

Expected behavior :
right click / long tap : add the marker
right click move (tilt / rotate) : don't add the marker

I think states could be added to the "map mouse event" to indicate if tilt or rotate occures when contextmenu fired or maybe some other events ? (long tap, right click for exemple)

Tests are done on chrome desktop for now.

I'm also open to any workaround. Thanks,

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 from the map.on('contextmenu') event behavior and reproduce the right-click and long-tap cases described in the issue, including rotation and tilt gestures. Trace how those interactions reach the contextmenu handler; done means a stationary right click or long tap can add a marker without firing the marker action after a rotate or tilt 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.