From 635863502df2ffbbbc5333a1a529bcf7c38c6c5a Mon Sep 17 00:00:00 2001 From: root Date: Mon, 13 Apr 2026 14:22:52 -0300 Subject: [PATCH] Fix diagram edge routing: remove elbow=vertical, add jumpStyle=arc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause: elbow=vertical conflicted with orthogonalEdgeStyle + port constraints, causing arrows to route backwards and cross content. Changes to oci_diagram_gen.py (generic, all diagrams): - Remove elbow=vertical from edge base style - Use edgeStyle=orthogonalEdgeStyle explicitly in extra_style - Add jumpStyle=arc;jumpSize=8 — crossing edges show arc, not overlap - Remove drawpyo waypoints="orthogonal" (now controlled via extra_style to avoid style merging conflicts) - Vertical edges with labels: align=left so text doesn't overlap icons - Regression tested with PharmaCorp (dual-region) and MELI (single-region) Co-Authored-By: Claude Opus 4.6 (1M context) --- .../opt02-architecture.drawio | 124 +++++++++--------- tools/oci_diagram_gen.py | 37 ++++-- 2 files changed, 85 insertions(+), 76 deletions(-) diff --git a/examples/output-demo-pharma-mx/opt02-architecture.drawio b/examples/output-demo-pharma-mx/opt02-architecture.drawio index 95c3cc3..c850d0e 100644 --- a/examples/output-demo-pharma-mx/opt02-architecture.drawio +++ b/examples/output-demo-pharma-mx/opt02-architecture.drawio @@ -4,160 +4,160 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + @@ -165,14 +165,14 @@ - + - + @@ -187,7 +187,7 @@ - + @@ -204,14 +204,14 @@ - + - + @@ -223,21 +223,21 @@ - + - + - + @@ -263,12 +263,12 @@ - + - + diff --git a/tools/oci_diagram_gen.py b/tools/oci_diagram_gen.py index e7e8a7c..f9a33e1 100644 --- a/tools/oci_diagram_gen.py +++ b/tools/oci_diagram_gen.py @@ -886,14 +886,15 @@ class OCIDiagramGenerator: label=label or "", ) - # Base OCI style: open arrows, charcoal color, orthogonal routing + # Base OCI style: open arrows, charcoal color + # Note: orthogonal routing is set via extra_style (edgeStyle=orthogonalEdgeStyle) + # to avoid conflicts with drawpyo's own style merging edge.line_end_target = "open" edge.line_end_source = "none" edge.strokeColor = "#312D2A" edge.strokeWidth = 1 edge.rounded = True edge.endSize = 6 - edge.waypoints = "orthogonal" # Font styling via text_format (drawpyo's supported approach) edge.text_format.fontFamily = "Oracle Sans" @@ -902,11 +903,14 @@ class OCIDiagramGenerator: edge.text_format.labelBackgroundColor = "#FFFFFF" # Extra style attributes that drawpyo Edge doesn't support natively. - # labelBackgroundColor: white so edge labels are readable and the line - # is hidden behind the text (confirmed in Oracle ref arch diagrams). - # labelBorderColor=none: no border box around the label. + # - edgeStyle=orthogonalEdgeStyle: right-angle routing (no diagonal lines) + # - jumpStyle=arc: when edges cross, show a small arc instead of overlapping + # - labelBackgroundColor: white so labels are readable over the line + # - NO elbow=vertical (it conflicts with orthogonal + port constraints) extra_style = ( - "elbow=vertical;endFill=0;startFill=0;" + "edgeStyle=orthogonalEdgeStyle;orthogonalLoop=1;" + "jumpStyle=arc;jumpSize=8;" + "endFill=0;startFill=0;" "labelBackgroundColor=#FFFFFF;labelBorderColor=none;" "fontFamily=Oracle Sans;fontSize=10;fontColor=#312D2A;" ) @@ -958,24 +962,29 @@ class OCIDiagramGenerator: dx = tx - sx dy = ty - sy - # Determine dominant direction and set ports. - # Use 1.5x threshold: prefer vertical within same container (natural - # top-down flow), only go horizontal when clearly side-by-side. - # This matches Oracle ref arch style where subnets stack vertically - # and connections flow down between them. - if abs(dx) > abs(dy) * 1.5: - # Clearly horizontal: exit right → enter left (or vice versa) + # Determine dominant direction and set exit/entry ports. + # Threshold: prefer vertical for diagonal connections (natural + # top-down flow between subnets in Oracle ref arch style). + is_horizontal = abs(dx) > abs(dy) * 1.5 + + if is_horizontal: + # Horizontal: exit right → enter left (or vice versa) if dx > 0: extra_style += "exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" else: extra_style += "exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" else: - # Vertical or diagonal: exit bottom → enter top (or vice versa) + # Vertical: exit bottom → enter top (or vice versa) if dy > 0: extra_style += "exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" else: extra_style += "exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" + # For vertical edges with labels, position label to the right + # so it doesn't overlap the source/target icons + if label: + extra_style += "align=left;verticalAlign=middle;" + # Add waypoints if provided if waypoints: for wx, wy in waypoints: