fix: 拓扑变换布局

This commit is contained in:
TsMask
2023-12-21 20:44:05 +08:00
parent 2470eed417
commit 0c52f2cf3b
2 changed files with 32 additions and 20 deletions

View File

@@ -1700,9 +1700,8 @@ export function randerGroph(graphG6Dom: HTMLElement | undefined, data: any) {
edges: processedEdges,
});
layout.instance.execute();
// console.log(processedEdges)
bindListener(graph);
// graph.data({ nodes: aggregatedData.nodes, edges: processedEdges });
graph.data({ nodes: aggregatedData.nodes, edges: processedEdges });
graph.render();
@@ -1740,3 +1739,17 @@ export function randerGroph(graphG6Dom: HTMLElement | undefined, data: any) {
return graph;
}
let gridLayout = false;
export function switchLayout() {
gridLayout = !gridLayout;
if (gridLayout) {
stopLayout();
graph.updateLayout({
type: 'grid',
begin: [20, 20],
});
} else {
layout.instance.execute();
}
}