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

addPolyline #13

Open
knownasilya opened this issue Dec 30, 2016 · 3 comments
Open

addPolyline #13

knownasilya opened this issue Dec 30, 2016 · 3 comments

Comments

@knownasilya
Copy link

knownasilya commented Dec 30, 2016

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 📦

@knownasilya
Copy link
Author

knownasilya commented Dec 30, 2016

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.

@Wildhoney
Copy link
Owner

Do you think an optional second argument to createPath would be acceptable?

createPath([...], false);

@knownasilya
Copy link
Author

@Wildhoney totally

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

2 participants