fix: improve DO_TRY diagram layout and node text clipping
- Use NETWORK_SIMPLEX placement for vertical centering of root flow nodes - Skip structural edges from all compound nodes to descendants (not just DO_TRY) - Reduce DO_TRY section spacing from NODE_SPACING*0.4 to fixed 20px - Use SVG clipPath for node text instead of character-count truncation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -292,11 +292,11 @@ public class ElkDiagramRenderer implements DiagramRenderer {
|
||||
root.setProperty(CoreOptions.HIERARCHY_HANDLING, HierarchyHandling.INCLUDE_CHILDREN);
|
||||
root.setProperty(CoreOptions.EDGE_ROUTING, EdgeRouting.POLYLINE);
|
||||
root.setProperty(org.eclipse.elk.alg.layered.options.LayeredOptions.NODE_PLACEMENT_STRATEGY,
|
||||
NodePlacementStrategy.LINEAR_SEGMENTS);
|
||||
NodePlacementStrategy.NETWORK_SIMPLEX);
|
||||
return root;
|
||||
}
|
||||
|
||||
/** Create ELK edges, skipping DO_TRY-to-descendant and cross-root edges. */
|
||||
/** Create ELK edges, skipping structural compound-to-child edges and cross-root edges. */
|
||||
private void createElkEdges(RouteGraph graph, LayoutContext ctx) {
|
||||
if (graph.getEdges() == null) return;
|
||||
for (RouteEdge re : graph.getEdges()) {
|
||||
@@ -304,8 +304,9 @@ public class ElkDiagramRenderer implements DiagramRenderer {
|
||||
ElkNode targetElk = ctx.elkNodeMap.get(re.getTarget());
|
||||
if (sourceElk == null || targetElk == null) continue;
|
||||
|
||||
// Skip edges from DO_TRY to its own children (keep continuation edges)
|
||||
if (ctx.doTryNodeIds.contains(re.getSource()) && isDescendantOf(targetElk, sourceElk)) {
|
||||
// Skip edges from any compound node to its own descendants
|
||||
// (these are structural edges, not flow edges)
|
||||
if (ctx.compoundNodeIds.contains(re.getSource()) && isDescendantOf(targetElk, sourceElk)) {
|
||||
continue;
|
||||
}
|
||||
// Skip edges that cross ELK root boundaries
|
||||
@@ -334,7 +335,7 @@ public class ElkDiagramRenderer implements DiagramRenderer {
|
||||
if (sections.size() < 2) continue;
|
||||
|
||||
double startY = sections.stream().mapToDouble(ElkNode::getY).min().orElse(0);
|
||||
double spacing = NODE_SPACING * 0.4;
|
||||
double spacing = 20;
|
||||
double currentY = startY;
|
||||
for (ElkNode section : sections) {
|
||||
section.setY(currentY);
|
||||
|
||||
Reference in New Issue
Block a user