mapbox-gl-draw icon indicating copy to clipboard operation
mapbox-gl-draw copied to clipboard

Disable/Remove Controls

Open LoiKos opened this issue 6 years ago • 3 comments

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.

LoiKos avatar Oct 08 '18 10:10 LoiKos

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

raysuelzer avatar Dec 06 '18 01:12 raysuelzer

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 avatar Oct 03 '22 19:10 danawoodman

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.

danawoodman avatar Oct 03 '22 19:10 danawoodman