diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-08-29 22:34:54 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-08-29 22:34:54 -0400 |
| commit | 01755335859b19756f6d64a2f8a10ae98abceb5f (patch) | |
| tree | d5ba0258769f85fff5512498b04c3c037daecf79 /public/assets/javascripts/rectangles/util/undostack.js | |
| parent | 2235c34e498499b8141e835998b962067583a0ce (diff) | |
| parent | 851ddfd46abb7f944c1a6b7f198b5fd8cabd4c13 (diff) | |
merge
Diffstat (limited to 'public/assets/javascripts/rectangles/util/undostack.js')
| -rw-r--r-- | public/assets/javascripts/rectangles/util/undostack.js | 13 |
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 |
