summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/util/undo.js
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2014-08-15 09:26:10 -0400
committerJulie Lala <jules@okfoc.us>2014-08-15 09:26:10 -0400
commitaecaf2de2b4ed5277b34e9209a0f31602e8a7999 (patch)
tree78e46648032b91ebb0267e38f39f6227da7d8732 /public/assets/javascripts/rectangles/util/undo.js
parent02bde51c24ae1c6e189d031b80226e6a9f7cbc59 (diff)
parent1be685f9fe4a7f3a3e947d45f865fe07c03ddbaf (diff)
Merge branch 'walls' of github.com:okfocus/vvalls into walls
Diffstat (limited to 'public/assets/javascripts/rectangles/util/undo.js')
-rw-r--r--public/assets/javascripts/rectangles/util/undo.js42
1 files changed, 0 insertions, 42 deletions
diff --git a/public/assets/javascripts/rectangles/util/undo.js b/public/assets/javascripts/rectangles/util/undo.js
deleted file mode 100644
index 3700817..0000000
--- a/public/assets/javascripts/rectangles/util/undo.js
+++ /dev/null
@@ -1,42 +0,0 @@
-(function(){
-
- var UndoStack = function(){
- this.stack = []
- this.types = {}
- this.pointer = -1
- }
- UndoStack.prototype.push = function(action){
- this.pointer++
- this.stack[this.pointer] = action
- this.purge()
- }
- UndoStack.prototype.purge = function(){
- if (this.stack.length-1 == this.pointer) return
- this.stack.length = this.pointer+1
- }
- UndoStack.prototype.undo = function(){
- if (this.pointer == -1) return false
- var action = this.stack[this.pointer]
- this.types[ action.type ].undo(action)
- this.pointer--
- return this.pointer > -1
- }
- UndoStack.prototype.redo = function(){
- if (this.pointer == this.stack.length-1) return false
- this.pointer++
- var action = this.stack[this.pointer]
- this.types[ action.type ].redo(action)
- return this.pointer < this.stack.length-1
- }
- UndoStack.prototype.register = function(actionType){
- this.types[ actionType.type ] = actionType
- }
-
- if ('window' in this) {
- window.UndoStack = new UndoStack
- }
- else {
- module.exports = new UndoStack
- }
-
-})()