Leaflet.Editable
Leaflet.Editable copied to clipboard
contextmenu event not triggered when continuing polyline
When a polyline is being continued, map's "contextmenu" event is not triggered when user right-clicks on the map.
To reproduce:
- open https://jsfiddle.net/p3jr7rp8/11/
- right click on map: it does not show an alert message, which should be opened by the "contextmenu" listener
if you stop polyline continuation by clicking on last vertex of the line, then right-clicking on the map properly shows the alert window.
Leaflet.Editable disable all previous registered events while drawing (and add them back when drawing is finished). It's a bit extreme, but I didn't get to a softer but still robust solution yet. If you want events to be triggered while drawing you need to register them after the drawing has started. See #54 for context. This certainly needs to be documented.
Ok, I agree this would need to be documented. In addition I can't make it work: https://jsfiddle.net/p3jr7rp8/13/ Could you provide an example? Thanks
Sorry, was in a mission in Jordan, and a bit overwhelmed. So that's not that simple that was I said before: events will only work for element added to the map after the drawing started (so they are active for draw tools). Your best option for now I think is to try to override L.Editable.blockEvents/unblockEvents: https://github.com/Leaflet/Leaflet.Editable/blob/gh-pages/src/Leaflet.Editable.js#L210
But this will suddenly reactivate all others events, so you may have trouble with popups or anything like that during drawing.
Not sure we have a best option, short term speaking.
Is there a way to draw a polygon/ any shape using the right mouse click instead of the left mouse click?