L.Pather
L.Pather copied to clipboard
addPolyline
Would love to be able to repopulate the paths into pather without triggering 'created'.
So currently the only way is to use createPath
which triggers the 'created'
event. But I already have the polylines and would just like to add them. So having something like:
pather.addPolyline(polyline)
// `polyline` is instance of `L.Pather.Polyline`
// this triggers 'added' event instead
The alternate approach is to check every latlng of every line against a current list to make sure duplicates aren't added.
I also tried pather.polylines.push(polyline)
but the line isn't added to the map for some reason.
I'll submit a PR if this sounds like something you'd 📦
Found a workaround for now:
markup.forEach(item => {
pather.polylines.push(item.polyline);
item.polyline.redraw(item.polyline.edges);
});
Which basically points to the implementation I'd submit.
Do you think an optional second argument to createPath
would be acceptable?
createPath([...], false);
@Wildhoney totally