Leaflet / Leaflet/Path.Drag.js
Markers not draggable anymore after overlay hide/show
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 30
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure using the circleMarker, layerGroup, and layers-control example in the issue, comparing dragging before and after hiding and showing the overlay. Trace the plugin's drag handling across the layer visibility change and verify that markers still drag without moving the map after the control checkbox is toggled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100