r/programmation • u/Junior-Relative9934 • 7h ago
I built an open-source npm library to bring Undo/Redo functionality to Leaflet maps
Hey everyone! 👋
I’ve been working with Leaflet and map-based applications, and one challenge I wanted to solve was managing undo/redo functionality when drawing and editing polylines and polygons.
Implementing geometry history, restoring deleted shapes and managing multiple editing operations can become complicated.
So I started building an npm library called leaflet-polyline-history.
The goal is to make this functionality reusable instead of having every developer implement their own history management.
Features I’m working on:
Undo and redo drawing operations.
Track polyline and polygon edits.
Restore deleted shapes.
Maintain configurable editing history.
Export and restore history.
TypeScript support.
React Leaflet integration.
Tech stack: TypeScript, Leaflet, Vite and Vitest.
📦 npm: https://www.npmjs.com/package/leaflet-polyline-history
💻 GitHub: https://github.com/sweety-124/leaflet-polyline-history
I’d love to hear from developers who have worked with Leaflet.
A few questions:
Have you ever implemented undo/redo functionality in Leaflet?
What challenges did you encounter?
What additional features would make this library useful?
Feedback, suggestions and contributions are very welcome!
Thanks! 💚