Leaflet.curve
Leaflet.curve copied to clipboard
How to implement Leaflet.curve to LeafletDraw plugin
Any plan?
Hello, It will require significant effort to implement that integration. Although I would like it to happen, unfortunately there are no current plans. I do welcome contributions though.
Links:
- Repo: https://github.com/Leaflet/Leaflet.draw
- Demo: https://leaflet.github.io/Leaflet.draw/docs/examples/full.html
I plan to submit a pull request to the Leaflet.draw project with the ability to draw curves. Since this Leaflet.draw does not have any dependency, it would involve integrating the source code of Leaflet.curve to Leaflet.draw (with attribution of course). An option would also be to tell users to import Leaflet.curve before Leaflet.draw to be able to draw curves. Maybe it's better, but it will of course involve a bit of more work on my end. What do you think ?
@pinconquentin That would be great! In my opinion, I think it would be better to tell users to import Leaflet.curve. I think Leaflet.draw already depends on the main leaflet.js code, so this could be another dependency (optional one). Decoupling it in this way would mean users not interested in drawing curves won't have unnecessary code. And for those interested, any updates to Leaflet.curve would be immediately available to them (instead of having to wait for those changes to be integrated into Leaflet.draw source code).
Whichever option is taken, I appreciate the effort and I'll be glad to assist time permitting. Thanks!
@elfalem Yes, I leaned towards that option as well. Thank you for your answer ! I will probably submit the PR around next week.
PR for reference - https://github.com/Leaflet/Leaflet.draw/pull/1008 thanks for your work on this @pinconquentin , hopefully it gets merged soon.
With pleasure ! The repo seems pretty dead unfortunatly, I hope somebody will check it out. Meanwhile, if someone wants to use this feature, install this branch from the forked repo.
@qpincon I checked your branch, but it seems like it's not working because there are some errors in console.log
I successfully added that feature from @qpincon branch to my project (using the leaflet.draw.js
file under dist
).
I only had to manually add the icon to the control panel (as it was missing) and there are a few errors in the console but it does the trick if you plan to generate curves out of production.