fix: render continuation edges exiting compound nodes (SPLIT, CHOICE)
All checks were successful
CI / cleanup-branch (push) Has been skipped
CI / build (push) Successful in 1m2s
CI / docker (push) Successful in 42s
CI / deploy-feature (push) Has been skipped
CI / deploy (push) Successful in 37s

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) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-03-29 16:39:14 +02:00
parent 090c51c809
commit 9eb2c2692b

View File

@@ -309,8 +309,22 @@ public class ElkDiagramRenderer implements DiagramRenderer {
if (ctx.compoundNodeIds.contains(re.getSource()) && isDescendantOf(targetElk, sourceElk)) { if (ctx.compoundNodeIds.contains(re.getSource()) && isDescendantOf(targetElk, sourceElk)) {
continue; continue;
} }
// Skip edges that cross ELK root boundaries // Skip edges that cross ELK root boundaries — but allow continuation
if (getElkRoot(sourceElk) != getElkRoot(targetElk)) continue; // 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 elkEdge = ctx.factory.createElkEdge();
elkEdge.setContainingNode(findCommonParent(sourceElk, targetElk)); elkEdge.setContainingNode(findCommonParent(sourceElk, targetElk));