Adapted to spacing convention & added doc comments
This commit is contained in:
parent
6316e64394
commit
b298b58d9f
@ -253,7 +253,7 @@
|
|||||||
* @param {UndoManager} manager The UndoManager-instance on which an "undo"/"redo"-Event is triggered afterwards
|
* @param {UndoManager} manager The UndoManager-instance on which an "undo"/"redo"-Event is triggered afterwards
|
||||||
* @param {UndoStack} stack The UndoStack on which we perform
|
* @param {UndoStack} stack The UndoStack on which we perform
|
||||||
* @param {Boolean} magic If true, undoes / redoes all actions with the same magicFusionIndex
|
* @param {Boolean} magic If true, undoes / redoes all actions with the same magicFusionIndex
|
||||||
* @param {Boolean} everything If true, undoes / redoes every actions that have been tracked
|
* @param {Boolean} everything If true, undoes / redoes every action that had been tracked
|
||||||
* @return {undefined}
|
* @return {undefined}
|
||||||
*/
|
*/
|
||||||
function managerUndoRedo (which, manager, stack, magic, everything) {
|
function managerUndoRedo (which, manager, stack, magic, everything) {
|
||||||
@ -273,10 +273,11 @@
|
|||||||
stack.pointer++;
|
stack.pointer++;
|
||||||
action = stack.at(stack.pointer);
|
action = stack.at(stack.pointer);
|
||||||
}
|
}
|
||||||
if (everything)
|
if (everything) {
|
||||||
actions = _.clone(stack.models);
|
actions = _.clone(stack.models);
|
||||||
else
|
} else {
|
||||||
actions = magic ? stack.where({"magicFusionIndex": action.get("magicFusionIndex")}) : [action];
|
actions = magic ? stack.where({"magicFusionIndex": action.get("magicFusionIndex")}) : [action];
|
||||||
|
}
|
||||||
|
|
||||||
stack.pointer += (isUndo ? -1 : 1) * (actions.length - 1);
|
stack.pointer += (isUndo ? -1 : 1) * (actions.length - 1);
|
||||||
while (action = isUndo ? actions.pop() : actions.shift()) {
|
while (action = isUndo ? actions.pop() : actions.shift()) {
|
||||||
@ -681,6 +682,10 @@
|
|||||||
managerUndoRedo("undo", this, this.stack, magic);
|
managerUndoRedo("undo", this, this.stack, magic);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undoes all actions ever tracked by the undo manager
|
||||||
|
* @return {undefined}
|
||||||
|
*/
|
||||||
undoAll: function () {
|
undoAll: function () {
|
||||||
managerUndoRedo("undo", this, this.stack, false, true);
|
managerUndoRedo("undo", this, this.stack, false, true);
|
||||||
},
|
},
|
||||||
@ -694,6 +699,10 @@
|
|||||||
managerUndoRedo("redo", this, this.stack, magic);
|
managerUndoRedo("redo", this, this.stack, magic);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redoes all actions ever tracked by the undo manager
|
||||||
|
* @return {undefined}
|
||||||
|
*/
|
||||||
redoAll: function () {
|
redoAll: function () {
|
||||||
managerUndoRedo("redo", this, this.stack, false, true);
|
managerUndoRedo("redo", this, this.stack, false, true);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user