Can't enable editing on a polyline
See original GitHub issueOn the current master branch I can’t manually enable editing mode on a polyline.
Calling layer.editing.enable()
results in an error:
Uncaught TypeError: Cannot set property 'fill' of undefined
And I believe that leads us back to this line: https://github.com/Leaflet/Leaflet.draw/commit/07b1448f4eba33982f662398988f0337ee55cc02#diff-417e4ee28e399d7a4c5dbc14f6897ffaR1153
I can go into editing mode using the control on the map, but not when I try to enable the editing mode myself.
I have created a small project to help demonstrate this issue.
The line that causes the error is: https://github.com/kyletolle/leaflet-draw-polyline-enable-editing-bug/blob/master/index.html#L133
If you pull down the project, open it in your browser, and then click on the polyline, you can see the error in the dev tools console. Try clicking on the marker, and then dragging it around. You can drag it with no problems. You can click on the polygon to get it into editing mode too. So going into editing mode works on some features, but not the polyline.
Hope this helps narrow down where the issue might be.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:4
- Comments:8 (5 by maintainers)
Top GitHub Comments
A workaround for this is to set the layer’s editing option to an empty object before enabling editing.
This doesn’t give any of the default styling when editing, but it does keep things from crashing.
When you add a polyline to the map, add it to the drawnItems feature Layer (or whatever featureGroup you are using for the items you want to edit).
http://jsfiddle.net/ddproxy/suL12z93/3/