Skip to content

Commit

Permalink
moved Dagre layout options to sdfv.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
LeandroTreu committed May 2, 2024
1 parent 0aaa125 commit bbbaf67
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/renderer/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 7 additions & 1 deletion src/sdfv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit bbbaf67

Please sign in to comment.