|
@@ -634,7 +634,13 @@ dagre.layout = (nodes, edges, layout, state) => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
const depths = treeDepths(g);
|
|
const depths = treeDepths(g);
|
|
|
- const height = Math.max(...Object.values(depths)) - 1; // Note: depths is an Object not an array
|
|
|
|
|
|
|
+ let height = 0;
|
|
|
|
|
+ for (const value of Object.values(depths)) {
|
|
|
|
|
+ if (value > height) {
|
|
|
|
|
+ height = value;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ height -= 1;
|
|
|
const nodeSep = 2 * height + 1;
|
|
const nodeSep = 2 * height + 1;
|
|
|
state.nestingRoot = root;
|
|
state.nestingRoot = root;
|
|
|
// Multiply minlen by nodeSep to align nodes on non-border ranks.
|
|
// Multiply minlen by nodeSep to align nodes on non-border ranks.
|