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

Markers not draggable anymore after overlay hide/show #8

Open
jcoupey opened this issue Jan 24, 2019 · 0 comments
Open

Markers not draggable anymore after overlay hide/show #8

jcoupey opened this issue Jan 24, 2019 · 0 comments

Comments

@jcoupey
Copy link

jcoupey commented Jan 24, 2019

I'm grouping some draggable markers in a layer in order to be able to hide/show them at once with the leaflet built-in control for overlays.

The markers are draggable all right at first, but as soon as the layer has been hidden and shown again using the control checkbox, then trying to drag a marker will move the whole map.

Minimum example to reproduce:

var myLatLng1 = L.latLng(48, 5);
var myLatLng2 = L.latLng(48.1, 5.1);

map.setView(myLatLng1, 11);

var myMarker1 = L.circleMarker(myLatLng1, {draggable: true});
var myMarker2 = L.circleMarker(myLatLng2, {draggable: true});

var myLayer = L.layerGroup([myMarker1, myMarker2]);
myLayer.addTo(map);

L.control.layers({}, {'My layer': myLayer}).addTo(map);

I'm experiencing this with both leaflet 1.3.4 and 1.4.

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

1 participant