Leaflet.PolylineMeasure
Leaflet.PolylineMeasure copied to clipboard
Evented leaflet objects that are added while polylinemeasure is toggled on are improperly handled
The curent implementations of _savePolylineEvents and _saveNonpolylineEvents are unable to account for adding evented leaflet objects to the map while Leaflet.PolylineMeasure is toggled on.
If an evented object is added while toggled on, it can be interacted with and steal clicks from polylinemeasure objects. Then when toggled off, the evented object is unable to be interacted with.
In my project, I'm re-creating leaflet markets whenever I receive updates on them. I am unable to change this. I've implemented a hacky workaround by:
- intercepting click events at a high z-index (like this solution from leaflet-measure's community)
- moving all of leaflet.polylinemeasure's leaflet map objects above the intercepting layer.
- changing _savePolylineEvents and _saveNonpolylineEvents to only add and remove Leaflet.PolylineMeasure owned objects from _map._targets (since saving nonpolyline events is no longer necessary while intercepting clicks at a higher z-index)
Hi, if you have an idea on how to solve this issue on your project, feel free to provide a PR for PolylineMeasure.
Sounds good, I'll try to get a PR in over the weekend.