-
Notifications
You must be signed in to change notification settings - Fork 992
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
Ability to cancel drawing #34
Comments
I'm attempting to do this programmatically without using the L.Draw UI, is there a function that triggers the cancelling of the drawing? I've been using this successfully to start the drawing: new L.Draw.Polyline(map, drawControl.options.polyline).enable(); I've tried clearing the target FeatureGroup but it seems there's nothing in there until the shape has been finished? thanks :) |
@georgecoltart All you need to do is disable the handler :) // Start drawing
var myPolylineDrawHandler = new L.Draw.Polyline(map).enable();
// Cancel drawing
myPolylineDrawHandler.disable(); |
Thanks but the handler seems to be undefined when I try cancel it? the first line works fine to activate the drawing mode though
This traces as undefined in the console... |
Ah sorry var myPolylineDrawHandler = new L.Draw.Polyline(map);
// Start drawing
myPolylineDrawHandler.enable();
// Cancel drawing
myPolylineDrawHandler.disable(); |
How can I cancel drawing if started by the Toolbar button? How can I get the drawHandler? |
try this |
this worked for me: |
Currently the user can press Esc to cancel drawing. Should also add a button that cancels as well. Could appear only when user has selected a drawing tool.
The text was updated successfully, but these errors were encountered: