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

question: While dragging a vertex prevent clicking another layer #754

Closed henrikmaa closed 3 years ago

henrikmaa commented 3 years ago

What: While dragging a vertex i need to prevent clicking another layer. Not sure how to go about this.

Why: Im only editing one layer at a time, and restore the selected layer if another layer is clicked. On touch devices when i drag an vertex over another layer and releasing, it causes a click on the line/layer below which causes my code to restore the layer im editing to the initial position.

Arrow explanation: click Selected layer -> start editing -> dragging a vertex over another line -> releasing -> Clicks the layer below -> Selected layer set back to "restorePosition".

Falke-Design commented 3 years ago

Can you create an example?

I think this can be fixed if you call L.DomUtil.stop(e) at the end after dragging. https://github.com/geoman-io/leaflet-geoman/blob/7cdb0edadc800edf3498fe6f78d140bccaa0aaa9/src/js/Edit/L.PM.Edit.Line.js#L730-L765

henrikmaa commented 3 years ago

I think its a combination of using React, and the way I have implemented it. I will take a look at stop(), seems like the bug was actually really rare as well.

I do not think this is an issue with geoman itself, everything works fine when using normal js.