Creating UNDO/REDO functions? - Forum

Forum Navigation
You need to log in to create posts and topics.

Creating UNDO/REDO functions?

Hi @luishp

What’s the ideal approach to create an UNDO and REDO buttons? Is JSON one way to save/load to get the UNDO effect. If so, how could we save multiple actions into JSON to allow multiple UNDOs and subsequently, REDO? Is there a way to do so?

Thanks

Hi @ronnie, it seems to me not an easy task.
I have found a JQuery library that perhaps can help:
https://github.com/jzaefferer/undo

Hi @luishp, this jsfiddle link shows a working example of UNDO/REDO - http://jsfiddle.net/gcollect/b3aMF/

How do we interface with VisualNeo Web to start the action state log, and then have separate buttons to call UNDO and REDO functions...

@ronnie, sorry for the delay answering you, but it takes some time, and time is a treasure for me these days :)
Take a look at my attached example. I have adapted the original code to work with FabricJS plugin.
Anyway, I'm not sure the original code works as expected...

Uploaded files:
  • You need to login to have access to uploads.

Hi @luishp, YES, your sample works. It's similar to the one I tried on on jsfiddle.

Thanks for the time taken to provide a solution. Would be great if you can (when you have the time to spare) update the fabric demo so that those who are tempted to try out in future, will save the time to explore these wonderful 'enhancement features.'

Aside to all, what @luishp has shared on fabricJS is great!  You should explore using them...