I have a Sketching app done in all HTML5 and Javascript, and I was wondering how I would create an Undo Button, so you could undo the last thing you drew. Any idea? Thanks!
+4
A:
You have to store all modifications in a datastructure. Then you can delete the latest modification if the user want to undo it. Then you repaint all drawing operations from your datastructure again.
Jonas
2010-06-23 06:23:01
Please see http://whiffdoc.appspot.com/tests/schema/diagram for an example of how to do this -- in this case by storing a JSON data structure representing the canvas information in an invisible DIV element. (follow link on page to source)
Aaron Watters
2010-06-23 13:46:50