mapbox / mapbox/mapbox-gl-draw
Hide control group if no controls are displayed
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 612
- Avg merge
- 8d 9h
- Merged PRs (30d)
- 5
Description
**mapbox-gl-js version**: 0.40.1
**mapbox-gl-draw version**: 1.0.3
### Steps to Trigger Behavior
1. create a new draw instance with these settings:
```js
new MapboxDraw({
displayControlsDefault: false
});
```
2. A small square for the empty control group gets added. This square pushes down all other controls after it.
### Expected Behavior
If no controls are selected, then no control group for them should be added.
### Actual Behavior
Control group gets added.
### Why I'm posting this
I'm using custom buttons to trigger the events. So I want to hide the default controls. However there's no way to get rid of the empty control group element that takes up space in the top right section.
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 at the MapboxDraw initialization path that handles displayControlsDefault and inspect how the control group is created when all default controls are disabled. Confirm the empty group is not added while selected controls and the placement of other controls remain unchanged; verify the behavior with the configuration shown in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100