Leaflet.Path.Drag icon indicating copy to clipboard operation
Leaflet.Path.Drag copied to clipboard

Disable dragging automatically on the Map

Open zindelluib opened this issue 8 years ago • 2 comments
trafficstars

How can I disable dragging by using the map variable? I dont want to disable dragging one by one

zindelluib avatar Jul 19 '17 03:07 zindelluib

You can't. Why is it a problem? Group your layers in a LayerGroup and then it will be easier.

w8r avatar Jul 19 '17 05:07 w8r

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();
});

w8r avatar Jul 19 '17 08:07 w8r