Leaflet.Editable icon indicating copy to clipboard operation
Leaflet.Editable copied to clipboard

Feature Request: Add Ability to Split and Join Polylines

Open sarcanon opened this issue 8 years ago • 1 comments

Specifically, the ability to:

  1. Select any vertex on a Polyline and split it at the selected vertex into two Polylines, and
  2. Drag one Polyline until one of its terminal vertices overlaps another Polyline's terminal vertex, and have the two Polylines be joined into a single Polyline.

These features would be immensely useful to me.

Thank you!

sarcanon avatar Sep 27 '16 18:09 sarcanon

  1. Select any vertex on a Polyline and split it at the selected vertex into two Polylines
map.on('vertex:click', function (e) {
    e.vertex.split();
});
  1. Drag one Polyline until one of its terminal vertices overlaps another Polyline's terminal vertex, and have the two Polylines be joined into a single Polyline.

See https://github.com/umap-project/Leaflet.Storage/blob/master/src/js/leaflet.storage.features.js#L889 for inspiration. It may worth cleaning and adding into Leaflet.Editable at some point, yep.

yohanboniface avatar Sep 28 '16 05:09 yohanboniface