Save/Cancel buttons for the toolbar actions #1116
Unanswered
gagamilano
asked this question in
Questions & Help
Replies: 1 comment 1 reply
-
Not sure if this will work for you but this is how i handled this. i saves a 'state' inside the layer itself on each edit in an array. Tehn i just went back to step inside this array on every "undo" action. Not sure if this is the "best" way to handle it.. but i thought i throw my own 25 cents. You should probably wait to hear from the orginal contributor as his advice are most valuable if this doesnt work for you |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I would like the user to confirm or cancel the edits he's making on the geometries, like in this Leaflet.Draw demo: https://leaflet.github.io/Leaflet.draw/docs/examples/full.html
So I'd like to add Save and Cancel buttons to the following actions: Edit, Drag, Cut, Rotate. I reckon the Save's button is just the "finishMode" toolbar action, so that should be easy. The Cancel however is proving to be a little bit harder to code in a clean way.
This is what I have so far...
Setup Geoman normally, then replace the various button's actions:
Then inside the various pm:edit, pm:dragstart etc events I memorize the original coordinates inside the this._coords object. In my application only one layer max has geoman enabled at any given time, and this layer will be in the this.target object. So there's no need to handle possible multiple rollbacks.
Is there a better way of doing this?
Beta Was this translation helpful? Give feedback.
All reactions