alex3165 / react-leaflet-draw

React component for leaflet-draw on top of react-leaflet
228 stars 152 forks source link

Disabling "edit" toolbar - PR proposal #15

Closed chrisbolin closed 7 years ago

chrisbolin commented 7 years ago

I'd like to disable editing and just use the drawing features of Leaflet.Draw. In Leaflet.Draw this is done by setting the edit option to false (its default).

I'm totally happy to make a PR, just want to make sure you'd be amenable before I do anything.

What I'd propose for a first effort is an optional edit prop. By default the behavior would be the same as it is now. When edit is explicitly set to false the options object (https://github.com/alex3165/react-leaflet-draw/blob/master/src/EditControl.js#L91) would be set to an empty object, without the edit sub-object.

What do you think? Just let me know and I can make a PR.

alex3165 commented 7 years ago

Hey @chrisbolin it make sense, I would be happy to review and merge a PR from you for that.

chrisbolin commented 7 years ago

I chose to do this with CSS for my use-case. Easy enough!

.leaflet-draw-edit-edit { display: none !important; }
.leaflet-draw-edit-remove { display: none !important; }
mertkahramanturk commented 2 years ago

<EditControl position='topright' edit={{ remove:false, edit:false }} />