Leaflet / Leaflet.draw

Vector drawing and editing plugin for Leaflet
https://leaflet.github.io/Leaflet.draw/docs/leaflet-draw-latest.html
MIT License
1.96k stars 992 forks source link

Drawing boundary & control enable/disable toggle? #150

Open xyzxyz442 opened 11 years ago

xyzxyz442 commented 11 years ago
  1. Is it possible to create boundary for drawing layer? Like create draw only for area I specific.
  2. I have to use this control like a View Only Mode and Edit Mode, I use some kind "$(control._container).hide();" to toggle view of control but problem is that I have to cancel the process by outside code if still in drawing process. Is it and method to cancel current process? I think this should be a feature some kind enable/disable method that cancel all current process. Only rectangle and circle process is cancel after hide the control.

Thank you

jacobtoye commented 11 years ago
  1. No sorry. Your best bet would be to fork the repo and add this functionality.
  2. There is no way or programatically doing this (yet). It is something I need to do. You could hack it in like:
for(var id in drawControl._toolbars) {
   drawControl._toolbars[id].disable();
}

This should disable any currently active mode.