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

allow to dynamically update the drawing controls

Open krvajal opened this issue 4 years ago • 3 comments

Exposes a new method called setControls to dynamically toggle the drawing controls

Example usage

 const drawControl = new MapboxDraw({
            displayControlsDefault: false,
            controls: {
                polygon: true,
                trash: true,
            },
        });
// add the control to the map
map.addControl(drawControl, 'bottom-right');

// now show only the trash 
drawControl.setControls({trash: true})

This is my first PR to this project and not sure if I missing some necessary step. I would appreciate any help to get this merged as it is a very handy feature.

fixes #824

krvajal avatar Oct 08 '19 09:10 krvajal

Please merge this 👍

JClackett avatar Oct 14 '20 11:10 JClackett

I'd also vote for this to be merged, would be super useful :)

I need to restrict users to only create 1 element and not multiple, and this would allow me to do that.

lupas avatar Jan 10 '21 15:01 lupas

Hey, any update on this will be really really useful , thank you

crow7m avatar Nov 06 '23 23:11 crow7m