mapbox / mapbox/mapbox-gl-draw
`draw_polygon`` .trash() mode doesnt properly work on mobile devices
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 612
- Avg merge
- 8d 9h
- Merged PRs (30d)
- 5
Description
Hey, thanks for the work on the package! Really nice to have this feature!
However, I noticed this issue on mobile devices:
When calling .trash() it only works for selected vertices, but not when a simple feature is selected. I think on desktop it calls simple_select inside the onTrash which is why it works there.
E.g. this fixed it for me on mobile:
```
const selected = drawRef.current.getSelected();
if (selected.features.length > 0) {
const featureIds = selected.features.map(f => f.id as string);
drawRef.current.changeMode('simple_select', { featureIds });
}
```
But then of course I can't delete vertices anymore.
Would be great if so. could have a look at it:)
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 by tracing the mobile .trash() behavior and the onTrash/simple_select mode handling described in the issue. Reproduce the case with a selected vertex and with a selected simple feature on a mobile device; done means both can be deleted without losing vertex deletion behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100