self-intersect area can not callback click event
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
**mapbox-gl-js version**: 2.12.0
### Question
I created a self-intersect vector polygon layer, and added click listener to it.When I click the no self-intersect area, I can got the callback.But when I click the self-intersect area, I can not got the callback.I want know if mapbox-gl support add click listener to self-intersect polygon?

I think `map.queryRenderedFeatures()` return [], when I click self-intersect area.
```javascript
const delegate = (e) => {
const filteredLayers = layers.filter(layerId => this.getLayer(layerId));
const features = filteredLayers.length ? this.queryRenderedFeatures(e.point, {layers: filteredLayers}) : [];
if (features.length) {
// Here we need to mutate the original event, so that preventDefault works as expected.
e.features = features;
listener.call(this, e);
delete e.features;
}
};
```
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 the click-listener delegate and queryRenderedFeatures call shown in the issue, then reproduce the behavior with a self-intersecting polygon in Mapbox GL JS 2.12.0. Trace why the self-intersecting area returns no features; done means clicks there produce the expected callback without breaking ordinary polygon clicks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100