From 50eb5012b100fba85653e980c4b3363302886069 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 1 Sep 2022 19:18:46 +0200 Subject: [PATCH] perspective: place nodes not in tree --- packages/web/src/designer/GraphLayout.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/web/src/designer/GraphLayout.ts b/packages/web/src/designer/GraphLayout.ts index fb1b34cc4..caa818886 100644 --- a/packages/web/src/designer/GraphLayout.ts +++ b/packages/web/src/designer/GraphLayout.ts @@ -310,6 +310,18 @@ export class GraphLayout { res.createTreeLevel([root], rootLayout.right + NODE_SPACE_TREE); + let maxRight = _.max(_.values(res.nodes).map(x => x.right)); + + const notPlacedNodes = _.values(graph.nodes).filter(x => !res.nodes[x.designerId]); + for (const node of notPlacedNodes) { + maxRight += NODE_SPACE_TREE; + + const layoutNode = new LayoutNode(node, maxRight + node.width / 2, NODE_MARGIN + node.height / 2); + res.nodes[node.designerId] = layoutNode; + + maxRight += node.width; + } + return res; }