Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

activateUIButton("myMode") and deactivate functionality #1213

Open
basaran opened this issue Mar 5, 2024 · 0 comments
Open

activateUIButton("myMode") and deactivate functionality #1213

basaran opened this issue Mar 5, 2024 · 0 comments

Comments

@basaran
Copy link

basaran commented Mar 5, 2024

User Story

I create my own custom mode as per documentation:

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

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant