Skip to content

Markers not draggable anymore after overlay hide/show #8

@jcoupey

Description

@jcoupey

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions