summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/util/undostack.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-08-29 22:13:20 -0400
committerJules Laplace <jules@okfoc.us>2014-08-29 22:13:20 -0400
commita7e198fd71b1d0b9ec544c3f2b1e38eaca4d719f (patch)
tree0313e94681c2cf57cf1794e3940579ed6c53d871 /public/assets/javascripts/rectangles/util/undostack.js
parent8abb36413413363f226486c78e7c01e7c37632bd (diff)
undo/redo for colors
Diffstat (limited to 'public/assets/javascripts/rectangles/util/undostack.js')
-rw-r--r--public/assets/javascripts/rectangles/util/undostack.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/public/assets/javascripts/rectangles/util/undostack.js b/public/assets/javascripts/rectangles/util/undostack.js
index b93c79e..959e3d1 100644
--- a/public/assets/javascripts/rectangles/util/undostack.js
+++ b/public/assets/javascripts/rectangles/util/undostack.js
@@ -31,16 +31,17 @@
this.types[ action.type ].redo(action.redo)
return this.pointer < this.stack.length-1
}
- UndoStack.prototype.register = function(actionType){
- if (actionType.length) {
- actionType.forEach(this.registerOne.bind(this))
+ UndoStack.prototype.register = function(actions){
+ if (actions.length) {
+ actions.forEach(this.registerOne.bind(this))
}
else {
- this.registerOne(actionType)
+ this.registerOne(actions)
}
}
- UndoStack.prototype.registerOne = function(actionType){
- this.types[ actionType.type ] = actionType
+ UndoStack.prototype.registerOne = function(action){
+ if (! action.redo) { action.redo = action.undo }
+ this.types[ action.type ] = action
}
if ('window' in this) {
window.UndoStack = new UndoStack