Skip to content

Commit e5c3815

Browse files
author
leonarddrv
committed
Incremental layout applied in show all master branch iVis-at-Bilkent/newt#167
1 parent 451c6e0 commit e5c3815

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Diff for: src/utilities/main-utilities.js

+33
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,39 @@ mainUtilities.hideAndPerformLayout = function(eles, layoutparam) {
674674
}
675675
};
676676

677+
/*
678+
* Shows all elements (the ones which are hidden if any) and perform given layout afterward. Layout parameter may be layout options
679+
* or a function to call. Requires viewUtilities extension and considers undoable option.
680+
*/
681+
mainUtilities.showAllAndPerformLayout = function(layoutparam) {
682+
var hiddenEles = cy.elements(':hidden');
683+
if (hiddenEles.length === 0) {
684+
return;
685+
}
686+
if (!options.undoable) {
687+
var nodesWithHiddenNeighbor = cy.edges(":hidden").connectedNodes(':visible');
688+
chise.thinBorder(nodesWithHiddenNeighbor);
689+
elementUtilities.showAndPerformLayout(hiddenEles, layoutparam);
690+
}
691+
else {
692+
var param = {
693+
eles: hiddenEles,
694+
layoutparam: layoutparam,
695+
firstTime: true
696+
};
697+
698+
var ur = cy.undoRedo();
699+
ur.action("thickenBorder", chise.thickenBorder, chise.thinBorder);
700+
ur.action("thinBorder", chise.thinBorder, chise.thickenBorder);
701+
702+
var actions = [];
703+
var nodesWithHiddenNeighbor = cy.nodes("[thickBorder]");
704+
actions.push({name: "thinBorder", param: nodesWithHiddenNeighbor});
705+
actions.push({name: "showAndPerformLayout", param: param});
706+
cy.undoRedo().do("batch", actions);
707+
}
708+
};
709+
677710
/*
678711
* Unhide given eles (the ones which are hidden if any) and perform given layout afterward. Layout parameter may be layout options
679712
* or a function to call. Requires viewUtilities extension and considers undoable option.

0 commit comments

Comments
 (0)