From 9eb2c2692b17298353b25e0e2bdee0cde8e94420 Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Sun, 29 Mar 2026 16:39:14 +0200 Subject: [PATCH] fix: render continuation edges exiting compound nodes (SPLIT, CHOICE) The cross-root boundary check in createElkEdges() was too aggressive, skipping all edges where source and target have different ELK roots. Compound nodes are their own ELK roots, so valid continuation edges from the last child inside a compound to the next sibling were lost. Now allows edges when nodes share a common grandparent or when one node exits/enters a compound boundary. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../server/app/diagram/ElkDiagramRenderer.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/cameleer3-server-app/src/main/java/com/cameleer3/server/app/diagram/ElkDiagramRenderer.java b/cameleer3-server-app/src/main/java/com/cameleer3/server/app/diagram/ElkDiagramRenderer.java index b3bec6ec..76b5067f 100644 --- a/cameleer3-server-app/src/main/java/com/cameleer3/server/app/diagram/ElkDiagramRenderer.java +++ b/cameleer3-server-app/src/main/java/com/cameleer3/server/app/diagram/ElkDiagramRenderer.java @@ -309,8 +309,22 @@ public class ElkDiagramRenderer implements DiagramRenderer { if (ctx.compoundNodeIds.contains(re.getSource()) && isDescendantOf(targetElk, sourceElk)) { continue; } - // Skip edges that cross ELK root boundaries - if (getElkRoot(sourceElk) != getElkRoot(targetElk)) continue; + // Skip edges that cross ELK root boundaries — but allow continuation + // edges that exit a compound (source inside compound, target outside) + if (getElkRoot(sourceElk) != getElkRoot(targetElk)) { + // Allow if source and target share the same grandparent (main root) + // i.e., one is inside a compound and the other is a sibling + ElkNode sourceRoot = getElkRoot(sourceElk); + ElkNode targetRoot = getElkRoot(targetElk); + boolean sameGrandparent = sourceRoot.getParent() != null + && targetRoot.getParent() != null + && sourceRoot.getParent() == targetRoot.getParent(); + boolean sourceExitsCompound = sourceRoot.getParent() != null + && targetRoot == sourceRoot.getParent(); + boolean targetExitsCompound = targetRoot.getParent() != null + && sourceRoot == targetRoot.getParent(); + if (!sameGrandparent && !sourceExitsCompound && !targetExitsCompound) continue; + } ElkEdge elkEdge = ctx.factory.createElkEdge(); elkEdge.setContainingNode(findCommonParent(sourceElk, targetElk));