From f942be8d3f9f9cb13b1a212e94988c88a765da5e Mon Sep 17 00:00:00 2001 From: Kaushik Narayan R Date: Thu, 9 Jan 2025 15:23:08 -0700 Subject: [PATCH] mm. --- src/pages/Graph/index.tsx | 54 ++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/src/pages/Graph/index.tsx b/src/pages/Graph/index.tsx index 579d788..f3480dc 100644 --- a/src/pages/Graph/index.tsx +++ b/src/pages/Graph/index.tsx @@ -70,8 +70,8 @@ const nodeOffsets = { }, unconnected: { origin: { - x: 800, - y: 0, + x: 0, + y: 1600, }, scaling: { x: 160, @@ -275,12 +275,7 @@ const Graph = () => { (nodes: Node[], edges: Edge[], options: getLayoutedElementsOpts) => { const g = new Dagre.graphlib.Graph(); g.setDefaultEdgeLabel(() => ({})); - g.setGraph({ - rankdir: options.direction, - nodesep: 100, - edgesep: 100, - ranksep: 100, - }); + g.setGraph({ rankdir: options.direction, ranksep: 200 }); edges.forEach((edge) => g.setEdge(edge.source, edge.target)); @@ -327,10 +322,10 @@ const Graph = () => { const position = { x: nodeOffsets.unconnected.origin.x + - Math.floor(idx / 20) * nodeOffsets.unconnected.scaling.x, + Math.floor(idx / 5) * nodeOffsets.unconnected.scaling.x, y: nodeOffsets.unconnected.origin.y + - Math.floor(idx % 20) * nodeOffsets.unconnected.scaling.y, + Math.floor(idx % 5) * nodeOffsets.unconnected.scaling.y, }; const x = position.x - (node.measured?.width ?? 0) / 2; const y = position.y - (node.measured?.height ?? 0) / 2; @@ -413,7 +408,6 @@ const Graph = () => { showWarnToastNotification( "Some links with deleted playlists were removed." ); - await refreshGraph(); }; const refreshGraph = async () => { @@ -452,26 +446,34 @@ const Graph = () => { - +