Reputation: 7416
I'm using Leaflet.draw v1.0.3
Here is my basic scenario :
I load all shapes (only polygons or circles) created previously by the user from my DB.
These shapes are editable.
However, I can't find an Edited
or EditedComplete
event, fired when edit ends. My goal is to get the new coordinates (radius and center if it's a circle, or lat/lng of every polygon's vertex) and store them in my DB.
Obviously, I need only one update operation, when edit process is over.
I've only found :
L.Draw.Event.EDITRESIZE
but it's fired during the resize process, not when it's over.L.Draw.Event.EDITMOVE
but it's fired during the move process, not when it's over.The event L.Draw.Event.EDITED
exists but it doesn't fire when expected.
I guess these events exist, but I can't find them. I've only found this issue, and it worries me...
Any help ?
Upvotes: 1
Views: 5503
Reputation: 131
I met the same issue and I fixed it by doing the following :
after creating the layer (circle / polygone ) , I added an edit listener on the created layer :
map.on(L.Draw.Event.CREATED, function(e) {
var type = e.layerType
, layer = e.layer;
drawnItems.addLayer(layer);
layer.on("edit", function(event) {
console.log("layer edited !");
..........
});
});
You can take a look at this example :
http://jsfiddle.net/Zoubir/oer03zu4/ In order to check : Create a polygone or circle and pass to edit mode , update a radius and see
I hope this can Help
Upvotes: 4