[Bug] Using MapboxOverlay, can't handle right click on a feature
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 14.6k
- Forks
- 2.3k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 42
Description
Description
From what I understand, it's not possible to handle a rightclick on a deckgl feature when using MapboxOverlay : https://github.com/visgl/deck.gl/blob/83b5149eacfda0815cde6e5eddd61c42037885cf/modules/mapbox/src/mapbox-overlay.ts#L79 registers these events, but with mapbox a right click is sent as a contextmenu event.
Flavors
- Script tag
- React
- Python/Jupyter notebook
- MapboxOverlay
- GoogleMapsOverlay
- CartoLayer
- ArcGIS
Expected Behavior
It should be possible to right click deckgl features.
onClick on MapboxOverlay should work as much as possible like onClick on DeckGL (left click and right click), but if a separate API allows it it's ok I guess
Steps to Reproduce
https://codesandbox.io/p/sandbox/lucid-glade-c8fjmx
function DeckGLOverlay(props) {
const overlay = useControl(() => new MapboxOverlay(props));
overlay.setProps(props);
return null;
}
<Map
dragRotate={false}
boxZoom={false}
>
<DeckGLOverlay
layers={...}
onClick={(info, event) => {
// when using onClick on root DeckGL, event.leftButton or event.rightButton allows to handle leftclick
// when using MapboxOverlay, rightclick doesn't dispatch here at all anyway
// alternative: use event.srcEvent.originalEvent.shiftKey instead of right click to implement menus, etc...?
}}/>
</Map>
Note: The onClick and onContextMenu (when interactiveLayerIds is specified) do work with the layers of react-map-gl (an extra "features" field is provided)
Environment
- Framework version:
- Browser:
- OS:
Logs
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with modules/mapbox/src/mapbox-overlay.ts around line 79 and reproduce the behavior in the linked CodeSandbox using MapboxOverlay with React. Compare the overlay event handling with DeckGL's onClick behavior; done means a right-click on a deck.gl feature reaches the documented callback or a clearly defined separate API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- data-visualization, frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100