generated from coulomb/repo-seed
Tune graph layout affinities
This commit is contained in:
@@ -582,13 +582,30 @@ def graph_explorer_page() -> str:
|
||||
updateUrlState();
|
||||
};
|
||||
|
||||
const edgeIdealLength = (edge) => Number(edge.data("layoutIdealLength")) || 110;
|
||||
|
||||
const edgeElasticity = (edge) => Number(edge.data("layoutElasticity")) || 80;
|
||||
|
||||
const runLayout = () => {
|
||||
if (!cy) return;
|
||||
cy.elements().stop();
|
||||
const name = layoutSelect.value || "cose";
|
||||
const options = name === "breadthfirst"
|
||||
? {name, directed: true, padding: 48, animate: false}
|
||||
: {name, padding: 48, animate: false};
|
||||
: name === "cose"
|
||||
? {
|
||||
name,
|
||||
padding: 48,
|
||||
animate: false,
|
||||
randomize: false,
|
||||
nodeOverlap: 12,
|
||||
idealEdgeLength: edgeIdealLength,
|
||||
edgeElasticity,
|
||||
nodeRepulsion: 5000,
|
||||
gravity: 1,
|
||||
numIter: 1400,
|
||||
}
|
||||
: {name, padding: 48, animate: false};
|
||||
cy.layout(options).run();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user