Implemented in Leaflet-Geoman with Release 2.11.0. This Library will not longer supported
This is a Leaflet Geoman Subplugin
Demo: PMDrag
Download pmDrag.js and include them in your project.
<script src="./dist/pmDrag.js"></script>
or use the script over cdn:
<script src="https://cdn.jsdelivr.net/gh/Falke-Design/PMDrag/dist/pmDrag.js"></script>
Add PMDrag after added Controls of Leaflet Geoman map.pm.addControls()
pmDrag = new L.PMDrag(map)
If you want to use L.LayerGroup instead of L.FeatureGroup (recommended) you have to set the option "overwriteLayerGroup: true" to overwrite the default L.LayerGroup of Leaflet and adding events.
pmDrag = new L.PMDrag(map, {overwriteLayerGroup: true})
Disable layer and layergroup drag
L.marker([lat,lng],{pmDrag: false})
Disable layer drag
L.marker([lat,lng],{pmDrag: {layer: false})
Disable layergroup drag
L.marker([lat,lng],{pmDrag: {layergroup: false}})
pmDrag.setText(text)
text: {layer: "Layer", layergroup: "Layergroup"}
Mode layer: 0 or "layer", mode layergroup: 1 or "layergroup"
pmDrag.setMode(mode)
Mode layer = 0, layergroup = 1
pmDrag.getMode()
Returns "layer" or "layergroup"
pmDrag.getTextMode()