Closed agrimgupta92 closed 6 years ago
@agrimgupta92 I can't give any timelines, I work on leaflet.pm when I find the time. a solution to add redo is to do this inside your application. Whenever the user changes something, or "undoes" something, save the layer and show a "redo" button. When the user clicks it, overwrite the layer with the saved one.
I will add #284 soon, I'm not sure about redo though.
I will mark this issue as a feature request, especially for Redo. Anyone who is also interested in this, please give it an upvote π
Hey guys, let us discuss how this should work.
undo
able to call?
...This is my idea of how it should work
Modes:
Edit: cancel was not in this feature request, but i think also cancel editing should be included in this.
This is my cancel edit just for inspiration
//this code is not perfect
//currentLayer = e.target
//restoreLayer = e.target from pm:enable
//restoreLatLng = restoreLayer.getLatLng()
static cancelEditOnLayer = (map, currentLayer, restoreLayer, restoreLatLng) => {
if (!(restoreLayer instanceof L.Polyline)) {
restoreLayer.setLatLng(restoreLatLng)
} else {
restoreLayer.setLatLngs(restoreLatLng)
}
currentLayer.pm.disable()
}
Is there any plan to add the option to undo/redo in polygons/polylines? I see from previous issues that you plan to add them. Can you please tell when the feature will be ready or suggest a temporary/hacky way to get it to work? Update: I was able to get "undo" working as this pull request does this: https://github.com/codeofsumit/leaflet.pm/pull/284 Is it possible to add redo also?