geoman-io / leaflet-geoman

🍂🗺️ The most powerful leaflet plugin for drawing and editing geometry layers
https://geoman.io
MIT License
2.15k stars 431 forks source link

Markers are draggable after drawing a new marker #1113

Open Falke-Design opened 2 years ago

Falke-Design commented 2 years ago
    var marker1 = L.marker(
        [5, 5],
    ).addTo(map);

    marker1.pm.setOptions({draggable: false});

Because of the markerEditable option, other existing markers are going into edit mode and keeping that for the drag mode

1105

jayli3n commented 1 year ago

im also experiencing the same behaviour. If you set draggable to false:

marker1.pm.setOptions({draggable: false});

and then go into edit mode, and then drag mode, you can drag the marker around :(

From what ive noticed, the marker pm options.draggable gets reset back to whatever is set at globalOptions.

Falke-Design commented 11 months ago

Workaround, apply this to the layer:

layer.on('pm:enable',()=>{
    layer.pm.setOptions({draggable: false});
});