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

How to implement Leaflet.curve to LeafletDraw plugin

Open osper66 opened this issue 3 years ago • 9 comments

Any plan?

osper66 avatar Sep 15 '20 18:09 osper66

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.

elfalem avatar Sep 17 '20 01:09 elfalem

Links:

  • Repo: https://github.com/Leaflet/Leaflet.draw
  • Demo: https://leaflet.github.io/Leaflet.draw/docs/examples/full.html

elfalem avatar Nov 24 '20 23:11 elfalem

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 ?

qpincon avatar Mar 11 '21 18:03 qpincon

@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 avatar Mar 11 '21 21:03 elfalem

@elfalem Yes, I leaned towards that option as well. Thank you for your answer ! I will probably submit the PR around next week.

qpincon avatar Mar 12 '21 09:03 qpincon

PR for reference - https://github.com/Leaflet/Leaflet.draw/pull/1008 thanks for your work on this @pinconquentin , hopefully it gets merged soon.

elfalem avatar Mar 22 '21 21:03 elfalem

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 avatar Mar 22 '21 21:03 qpincon

@qpincon I checked your branch, but it seems like it's not working because there are some errors in console.log

Screenshot 2023-06-01 at 16 38 46

AndrejGajdos avatar Jun 01 '23 14:06 AndrejGajdos

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. Screenshot 2023-11-24 at 11 40 07 am

antoinelouis avatar Nov 24 '23 00:11 antoinelouis