Leaflet / Leaflet.draw

Vector drawing and editing plugin for Leaflet
https://leaflet.github.io/Leaflet.draw/docs/leaflet-draw-latest.html
MIT License
1.96k stars 992 forks source link

Mouse events are not firing when drawing #1031

Open artuska opened 2 years ago

artuska commented 2 years ago

When i create some drawing shape i subscribe to the mouse events and then start drawing:

let drawingShape = new Leaflet.Draw.Rectangle(map, drawingOptions)

map.on('mousedown', handleDrawingMouseDownEvent);
map.on('mousemove', handleDrawingMouseMoveEvent);

drawingShape.enable();

But when i press-and-hold the mouse and then move my mouse to draw a rectangle none of mousedown or mousemove events are firing.

So, it seems when the drawing starts all mouse events are defaultPrevented and stopPropagated and not firing to the map.

What should i do to catch all those mouse events?

I need mousedown event to know Rectangle's starting point coordinates and mousemove event to know the last point of the Rectangle while drawing.

ghost commented 1 year ago

I'm having the same issue.

Let me know if you found a workaround @artuska

Thanks!