Closed physikerwelt closed 6 years ago
If you don't want elements to be in a layout don't include those elements in the eles.layout()
call.
Thank you. For reference I had to replace
cytoscape.use(dagre);
cy.layout({
name: 'dagre',
fit:true
}).run();
with
cytoscape.use(dagre);
cy.elements().filter(e => e.visible()).layout({
name: 'dagre',
fit:true
}).run();
In the default configuration even hidden nodes use space. This might result in an unintuitive layout. Space is reserved for those nodes, but no content is displayed.
According to http://js.cytoscape.org/#style/visibility elements with the property display:none do not use space and elements should not use space and not be connected.
However, the cytoscape API http://js.cytoscape.org/#ele.visible provides a 'hide' method that sets display to 'none' and a 'hidden' function that is just the oposit of the 'visible' function.
Thus a new option 'onlyVisible' was added that the user can define, if invisible elements should use space.