summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/util/undo.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-08-12 18:49:01 -0400
committerJules Laplace <jules@okfoc.us>2014-08-12 18:49:01 -0400
commitb8b208d219cf782c39d054ad741724c6995a0b62 (patch)
tree7f77e4c10c3d86d7a80d6cf1c8ff20f9c1e393c3 /public/assets/javascripts/rectangles/util/undo.js
parent838ccfe6c2125e464d3c95c6e222e7e762dc8fd2 (diff)
undo stuff working on rooms editor
Diffstat (limited to 'public/assets/javascripts/rectangles/util/undo.js')
-rw-r--r--public/assets/javascripts/rectangles/util/undo.js3
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
}