geoman-io / leaflet-geoman

🍂🗺️ The most powerful leaflet plugin for drawing and editing geometry layers
https://geoman.io
MIT License
2.21k stars 433 forks source link

How drag mode works with markers? #512

Closed NtsDK closed 4 years ago

NtsDK commented 4 years ago

Hi!

I need to listen dragend event on marker. In my expectations I initialized it right but it doesn't work. I found similar problem here https://github.com/geoman-io/leaflet-geoman/issues/190 And conclusion was listen to pm:edit event.

How drag events should work? Is dragging marker a use case for drag events?

Demo: https://jsfiddle.net/dvh1r2je/

rcollette commented 4 years ago

Oddly enough, if you enable a layer with draggable, you do get the drag events.

https://jsfiddle.net/cmbopjae/

    const marker = L.circleMarker([39.74739, -105]).addTo(map);

    marker.on('pm:edit', () => console.log('pm:edit'));
    marker.on('pm:drag', () => console.log('pm:drag'));
    marker.on('pm:dragstart', () => console.log('pm:dragstart'));
    marker.on('pm:dragend', () => console.log('pm:dragend'));
    marker.pm.enable({draggable:true});
AdamJamesNaylor commented 4 years ago

I'm seeing the same issue, I can't seem to bind to any of the drag events for markers.

codeofsumit commented 4 years ago

hmm seems like a bug. Thanks for reporting I will take a closer look!

hoangeiu commented 4 years ago

Has this problem been fixed?

codeofsumit commented 4 years ago

Fixed by #591

Will be in the next release @hoangeiu

cswww commented 3 years ago

Is it solved now? I tried or couldn't

Falke-Design commented 3 years ago

Yes this is solved look into: https://jsfiddle.net/dvh1r2je/