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

Layers are no longer draggable after being toggled #192

Open
danmichaelo opened this issue Sep 8, 2019 · 2 comments
Open

Layers are no longer draggable after being toggled #192

danmichaelo opened this issue Sep 8, 2019 · 2 comments

Comments

@danmichaelo
Copy link

danmichaelo commented Sep 8, 2019

It seems like editable layers are no longer draggable after being toggled by Layers Control or by other means.

To demonstrate the issue, I modified (diff) the basic example by adding the editable layers to a LayerGroup that can be toggled using Layers Control:

https://danmichaelo.github.io/Leaflet.Editable/example/

To reproduce the issue:

  1. Use the Layers Control on the right to hide, then show the "Editing layer"
  2. Try dragging any of the editable shapes

Result: They are no longer draggable. The vertices can still be dragged though.

Update: Layers Control uses Map.removeLayer(layer) and Map.addLayer(layer) to toggle things, so I created a slightly more minimal example demonstrating the issue here:

https://danmichaelo.github.io/Leaflet.Editable/example/minimal.html

Also created two tests:

danmichaelo@36d15b5

The first one passes (when using layer.disableEdit(); layer.enableEdit();), the second one fails (when using this.map.removeLayer(layer); this.map.addLayer(layer);). Calling layer.disableEdit(); before removing the layer also doesn't seem to help.

@danmichaelo danmichaelo changed the title Layers are no longer draggable after being toggled by Layers Control Layers are no longer draggable after being toggled Sep 8, 2019
danmichaelo added a commit to danmichaelo/Leaflet.Editable that referenced this issue Sep 8, 2019
@ssontag55
Copy link

@danmichaelo You find a work around on this? I have a clear all layers option on the map, and once I've done this I can't enable editing again. I've gotten so that it works if I don't clear canvas layers but separating panes don't matter.

@johandanforth
Copy link

@danmichaelo I stumbled on this problem to. After a map.removeLayer(featureGroup) and a map.addLayer(featureGroup), dragging is no longer working. I can still edit the points of a polyline, but dragging is not working. I suspect the error lies in the Path.Drag.js and not in Leaflet.Editable

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

3 participants