diff options
Diffstat (limited to 'public/assets/javascripts/rectangles/util/undo.js')
| -rw-r--r-- | public/assets/javascripts/rectangles/util/undo.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/public/assets/javascripts/rectangles/util/undo.js b/public/assets/javascripts/rectangles/util/undo.js index 5d8593c..dfc74dc 100644 --- a/public/assets/javascripts/rectangles/util/undo.js +++ b/public/assets/javascripts/rectangles/util/undo.js @@ -1,6 +1,7 @@ (function(){ var UndoStack = function(){ + this.debug = true this.stack = [] this.types = {} this.pointer = -1 @@ -17,6 +18,7 @@ UndoStack.prototype.undo = function(){ if (this.pointer == -1) return false var action = this.stack[this.pointer] + this.debug && console.log("undo", action.type) this.types[ action.type ].undo(action.prev) this.pointer-- return this.pointer > -1 @@ -25,6 +27,7 @@ if (this.pointer == this.stack.length-1) return false this.pointer++ var action = this.stack[this.pointer] + this.debug && console.log("redo", action.type) this.types[ action.type ].redo(action.next) return this.pointer < this.stack.length-1 } |
