Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable dragging automatically on the Map #33

Open
zindelluib opened this issue Jul 19, 2017 · 2 comments
Open

Disable dragging automatically on the Map #33

zindelluib opened this issue Jul 19, 2017 · 2 comments

Comments

@zindelluib
Copy link

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

@w8r
Copy link
Owner

w8r commented Jul 19, 2017

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

@w8r
Copy link
Owner

w8r commented Jul 19, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants