Skip to content

Commit

Permalink
Incremental layout applied in show all master branch iVis-at-Bilkent/…
Browse files Browse the repository at this point in the history
  • Loading branch information
leonarddrv committed Aug 27, 2017
1 parent 451c6e0 commit e5c3815
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/utilities/main-utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,39 @@ mainUtilities.hideAndPerformLayout = function(eles, layoutparam) {
}
};

/*
* Shows all elements (the ones which are hidden if any) and perform given layout afterward. Layout parameter may be layout options
* or a function to call. Requires viewUtilities extension and considers undoable option.
*/
mainUtilities.showAllAndPerformLayout = function(layoutparam) {
var hiddenEles = cy.elements(':hidden');
if (hiddenEles.length === 0) {
return;
}
if (!options.undoable) {
var nodesWithHiddenNeighbor = cy.edges(":hidden").connectedNodes(':visible');
chise.thinBorder(nodesWithHiddenNeighbor);
elementUtilities.showAndPerformLayout(hiddenEles, layoutparam);
}
else {
var param = {
eles: hiddenEles,
layoutparam: layoutparam,
firstTime: true
};

var ur = cy.undoRedo();
ur.action("thickenBorder", chise.thickenBorder, chise.thinBorder);
ur.action("thinBorder", chise.thinBorder, chise.thickenBorder);

var actions = [];
var nodesWithHiddenNeighbor = cy.nodes("[thickBorder]");
actions.push({name: "thinBorder", param: nodesWithHiddenNeighbor});
actions.push({name: "showAndPerformLayout", param: param});
cy.undoRedo().do("batch", actions);
}
};

/*
* Unhide given eles (the ones which are hidden if any) and perform given layout afterward. Layout parameter may be layout options
* or a function to call. Requires viewUtilities extension and considers undoable option.
Expand Down

0 comments on commit e5c3815

Please sign in to comment.