From bbbaf678addfc546da5b52c8d12d26301df33bec Mon Sep 17 00:00:00 2001 From: LeandroTreu Date: Thu, 2 May 2024 16:29:45 +0200 Subject: [PATCH] moved Dagre layout options to sdfv.ts --- src/renderer/renderer.ts | 5 ++--- src/sdfv.ts | 8 +++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/renderer/renderer.ts b/src/renderer/renderer.ts index 5a6b9e34..4759d61a 100644 --- a/src/renderer/renderer.ts +++ b/src/renderer/renderer.ts @@ -4239,12 +4239,11 @@ function relayoutSDFGState( const g: DagreGraph = new dagre.graphlib.Graph({ multigraph: true }); // Set layout options and a simpler algorithm for large graphs. - const layoutOptions: any = { ranksep: 30 }; + const layoutOptions: any = { ranksep: SDFV.RANKSEP }; if (state.nodes.length >= 1000) layoutOptions.ranker = 'longest-path'; - layoutOptions.nodesep = 20; // default: 50 - layoutOptions.ranksep = 70; // default: 50 + layoutOptions.nodesep = SDFV.NODESEP; g.setGraph(layoutOptions); // Set an object for the graph label. diff --git a/src/sdfv.ts b/src/sdfv.ts index d5c34894..7997fc85 100644 --- a/src/sdfv.ts +++ b/src/sdfv.ts @@ -67,9 +67,15 @@ export class SDFV { public static STATE_LOD: number = 100; // 100 public static DEFAULT_CANVAS_FONTSIZE: number = 10; - public static DEFAULT_MAX_FONTSIZE: number = 20; // 50 + public static DEFAULT_MAX_FONTSIZE: number = 20; // 20 public static DEFAULT_FAR_FONT_MULTIPLIER: number = 16; // 16 + // Dagre layout options. + // Separation between ranks (vertically) in pixels. + public static RANKSEP: number = 70; // Dagre default: 50 + // Separation between nodes (horizontally) in pixels. + public static NODESEP: number = 20; // Dagre default: 50 + protected renderer: SDFGRenderer | null = null; protected localViewRenderer: LViewRenderer | null = null;