Leaflet.draw icon indicating copy to clipboard operation
Leaflet.draw copied to clipboard

Question : draw:editstop:save event ?

Open mustikka opened this issue 8 years ago • 6 comments

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

mustikka avatar Jun 03 '16 10:06 mustikka

When will this functions will be added? Is there anyone has an alternative solution for this at the meantime.

visernchua avatar Jan 17 '17 01:01 visernchua

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;
});

mustikka avatar Jan 17 '17 08:01 mustikka

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 .

germanjoey avatar Jan 17 '17 08:01 germanjoey

whats the status on this?

danielduhh avatar Feb 09 '17 20:02 danielduhh

@danielduhh I found that if you want to check whenever to save button triggered you can use draw:edited callback

wh1le avatar Jun 05 '20 17:06 wh1le

It's 2022, does anyone have a solution for this problem?

1765659645 avatar May 10 '22 07:05 1765659645