From b8b208d219cf782c39d054ad741724c6995a0b62 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 12 Aug 2014 18:49:01 -0400 Subject: undo stuff working on rooms editor --- public/assets/javascripts/rectangles/util/undo.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'public/assets/javascripts/rectangles/util/undo.js') 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 } -- cgit v1.2.3-70-g09d2