mapbox / mapbox/mapbox-gl-draw
activateUIButton("myMode") and deactivate functionality
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 612
- Avg merge
- 8d 9h
- Merged PRs (30d)
- 5
Description
## User Story
I create my own custom mode as per documentation:
``` typescript
const mapboxDraw = new MapboxDraw({
//...
modes: {
...MapboxDraw.modes,
myMode: MyMode,
},
// PS. Object.assign gives me type error so I spread the existing modes.
```
Then in MyMode.ts
```typescript
MyMode.onSetup = function (opt) {
this.activateUIButton("myMode");
// doesn't work
}
MyMode.onStop = function (state) {
this.activateUIButton();
// deactivates stock Mode buttons (i.e Polygon)
// but when stock Mode is active, does not deactivate myMode.
}
```
- I was able to work the activation by creating a toggle function to add the ".active" class.
- I was unable to work the second issue, if I click a stock Mode, it does not deactivate MyMode button.
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 custom mode example in MyMode.ts and reproduce the activateUIButton("myMode") and deactivation behavior described in the issue. Trace how stock mode buttons are activated and deactivated, then verify that the custom button activates on setup and deactivates when switching modes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100