Skip to content

Commit

Permalink
Undo-redo extension update for demo
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsfy committed Jul 8, 2016
1 parent 1105d2a commit a1dcf3d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 29 deletions.
51 changes: 27 additions & 24 deletions cytoscape-expand-collapse.js

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions src/cytoscape-undo-redo.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
for (var key in options.actions)
actions[key] = options.actions[key];


}

if (!isInitialized && !dontInit) {
if (_instance.options.keyboardShortcuts) {
var sh = _instance.options.keyboardShortcuts;
Expand Down Expand Up @@ -109,7 +109,7 @@


if (!action.args)
action.args = {};
action.args = {};
action.args.firstTime = action.firstTime ? true : false;

var res = actions[action.name]._do(action.args);
Expand All @@ -130,6 +130,7 @@
// Calls registered function with action name actionName via actionFunction(args)
_instance.do = function (actionName, args) {

redoStack = [];
redoStack.push({
name: actionName,
args: args,
Expand Down Expand Up @@ -217,7 +218,7 @@
y: node.position("y")
};
if (mouseUpPosition.x != lastMouseDownPosition.x ||
mouseUpPosition.y != lastMouseDownPosition.y) {
mouseUpPosition.y != lastMouseDownPosition.y) {
var positionDiff = {
x: mouseUpPosition.x - lastMouseDownPosition.x,
y: mouseUpPosition.y - lastMouseDownPosition.y
Expand Down Expand Up @@ -424,7 +425,7 @@
if(args.eles)
getEles(args.eles).layout(args.options);
else
cy.layout(args.options);
cy.layout(args.options);
return nodesData;
} else
return returnToPositionsAndSizes(options);
Expand Down

0 comments on commit a1dcf3d

Please sign in to comment.