Not possible to click on overlapping shapes
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- frontend
Research direction
Start with the sortFeatures function and inspect the area calculation described in the issue, especially how GeoJSON Feature wrappers and raw geometry objects are passed. Reproduce the overlapping-polygon steps, then verify that clicking the smaller polygon selects it; PR 1539 contains the proposed fix for comparison.
Written by the indexing model from the issue text.
Description
When multiple polygons overlap, clicking on a smaller polygon could select the larger polygon instead. The sortFeatures function was intended to sort polygons by area (smallest first), but area.geometry() is being called with a GeoJSON Feature wrapper instead of the raw geometry object. The area result ends us being always undefined and the sorting logic to fail.
Fix proposal
https://github.com/mapbox/mapbox-gl-draw/pull/1539
Steps to reproduce:
- Draw a large polygon
- Draw o smaller polygon in the middle of the larger polygon
- Select the larger polygon
- Deselect the larger polygon
- Click on the smaller polygon
Expected result
- Smaller polygon is selected
Actual result
- Larger polygon is selected
Video
https://github.com/user-attachments/assets/24541dc7-70eb-409e-9cbd-59c3158351d1
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 611
- Avg merge
- 10h 34m
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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.
More from mapbox/mapbox-gl-draw
-
auto-triaged bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
mapbox/mapbox-gl-draw#1080 ·
Maintainers usually reply within 1 day
-
auto-triaged feature
Difficulty 3/5 1-2 days Newbie friendliness 52/100
mapbox/mapbox-gl-draw#1636 · 1 comment ·
Maintainers usually reply within 1 day
-
auto-triaged bug
Difficulty 4/5 3-5 days Newbie friendliness 25/100
mapbox/mapbox-gl-draw#1615 ·
Maintainers usually reply within 1 day
-
auto-triaged bug
Difficulty 3/5 1-2 days Newbie friendliness 64/100
mapbox/mapbox-gl-draw#1601 · 1 reaction ·
Maintainers usually reply within 1 day
-
auto-triaged bug
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
mapbox/mapbox-gl-draw#1553 · 1 comment ·
Maintainers usually reply within 1 day
All issues in mapbox/mapbox-gl-draw
Similar issues
-
stringify escapes leading digits in pseudo-class arguments (:nth-child(1) becomes :nth-child(\31 ))Open
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
digitalbazaar/forge#1170 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
getgrav/grav-plugin-form#664 ·
-
bug web-ui
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
jenkinsci/jenkins#27705 · 3 comments ·
Maintainers usually reply within 1 day