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

Disable/Remove Controls #824

Open
LoiKos opened this issue Oct 8, 2018 · 3 comments · May be fixed by #922
Open

Disable/Remove Controls #824

LoiKos opened this issue Oct 8, 2018 · 3 comments · May be fixed by #922
Labels
feature has PR ui Buttons & user interactions

Comments

@LoiKos
Copy link

LoiKos commented Oct 8, 2018

Hi,

I think that allowed the possibility to disable or remove controls could be interesting.

For example you want the user to create a polygon or a point but only one and still let him use update function or delete ...
Actually as far as i know you can't block drawing action that mean he can create as many polygon he wants and i can't find a way to update controls.

@raysuelzer
Copy link

+1 same use case here. There should be a way to update the options after initialization.

krvajal added a commit to krvajal/mapbox-gl-draw that referenced this issue Oct 8, 2019
exposes a new method called `setControls` to dynamically toggle the
drawing controls

fixes mapbox#824
@krvajal krvajal linked a pull request Oct 8, 2019 that will close this issue
@kkaefer kkaefer added feature has PR ui Buttons & user interactions labels Jan 7, 2020
@danawoodman
Copy link

danawoodman commented Oct 3, 2022

I am in need of this feature as we only allow a user to define one polygon. I'd like to be able to disable the polygon control unless they hit delete in which case I would re-enable. A simple method to update the control state would be ideal

@danawoodman
Copy link

Got around this for now by directly accessing the button via the DOM and setting disabled when a draw event is fired and enabling it again when the delete event is fired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature has PR ui Buttons & user interactions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants