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

[Feature] Allow drag of Polygons and Lines during edition #1336

Closed Razielwar closed 1 year ago

Razielwar commented 1 year ago

Hi there,

I'm a new user of geoman. We were previously using leaflet-draw but as it is not maintain we want to migrate to geoman plugin. In our application we allow to edit shape one by one and we were using also leaflet-draw-drag to allow dragging shape during edition.

On geoman, it seems it is possible to drag a marker or a circle during edition but it is not possible for a Polygon or a Line. Is it a feature you want to add? I tried some hacks to allow it by using the enableLayerDrag just after the enable. It works but the circles used to edit the shape are not moving with the shape. I tried also to use the events pm:dragstart and pm:dragend to disable edition when dragging and enable it again after and the circle does not disappear when i disable the edition during dragging but then are well moved after dragging.

So i'm not satisfied with this solution

https://jsfiddle.net/Razielwar/hmqgn69r/

Razielwar commented 1 year ago

Looking for the code, i have found that it is not possible to disable edition during dragging. There is a check on the property _dragging in the disable method of all the shape types.

So the following try do the job by switching the drawing property false before disabling the edition and true again after.

https://jsfiddle.net/Razielwar/hmqgn69r/14/

With that i can implement what i want but clearly the code is horrible :). I would like to know if this feature will be available in a future version?

Falke-Design commented 1 year ago

There is an open Feature Request for this #317 . But currently there are no plans to implement it.

AndrejGajdos commented 1 year ago

I just upvoted. This feature would be great :)