Leaflet.draw
Leaflet.draw copied to clipboard
Question : draw:editstop:save event ?
Hello, I am adding extra data in a popup when editing. It would be nice to have an editstop:cancel event and an editstop:save event to known if I have to save these data or delete them. I can't manage the distinction in the current editstop event...
// Triggered on cancel and save
map.on('draw:editstop', function (e) {
if (e.something == 'save') {
saveExtraData()
}
});
Or is there another way ? Thank you
When will this functions will be added? Is there anyone has an alternative solution for this at the meantime.
Until now, I manage this missing feature with jquery. But this is a pretty ugly hack... It would be better to have separate events.
$('#map .leaflet-draw-section:eq(1) .leaflet-draw-actions li:eq(1) a').on('click', (e) => {
console.log('cancel event');
this.cancelEvent = true;
});
I submitted a PR (#651) that expands the info provided by the edit events, but I am unsure of the status.
The editstop:save event that you want is called editdone. editstop without a corresponding editdone is your editstop:cancel event.
On Mon, Jan 16, 2017 at 5:50 PM, visernchua [email protected] wrote:
When will this functions will be added? Is there anyone has an alternative solution for this at the meantime.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Leaflet/Leaflet.draw/issues/545#issuecomment-273001323, or mute the thread https://github.com/notifications/unsubscribe-auth/AAzNEg-UdFZ9jFqJNdSg8egPkVsD0f7nks5rTB5NgaJpZM4ItYet .
whats the status on this?
@danielduhh I found that if you want to check whenever to save button triggered you can use draw:edited
callback
It's 2022, does anyone have a solution for this problem?