Leaflet.Path.Drag
Leaflet.Path.Drag copied to clipboard
Disable dragging automatically on the Map
trafficstars
How can I disable dragging by using the map variable? I dont want to disable dragging one by one
You can't. Why is it a problem? Group your layers in a LayerGroup and then it will be easier.
like that
var group = new L.LayerGroup().addTo(map);
for (var i = 0; i < things.length; i++) {
var poly = new L.Polygon([...], { draggable: true }).addTo(group);
}
...
group.eachLayer(function(layer) {
layer.dragging.disable();
});