mirror of
https://github.com/dtzp555-max/aci-sim.git
synced 2026-07-19 09:46:33 +00:00
fix(graph): legend min-width on narrow diagrams; regenerate README topology image (v0.20.2)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
972fe87798
commit
dc43b3550d
@@ -368,6 +368,11 @@ def _svg_body(graph: Graph, topo: Topology) -> tuple[str, int, int]:
|
||||
max_x = max_y = 0.0
|
||||
|
||||
width = int(max_x - min_x + 2 * MARGIN)
|
||||
# A narrow diagram (few nodes) must still fit the single-row legend
|
||||
# (role swatches at 150px pitch + three link-type samples at 130px) —
|
||||
# otherwise the ISN-uplink/vPC legend entries clip off the right edge.
|
||||
_roles_n = len([r for r in LEGEND_ORDER if any(n.role == r for n in graph.nodes)])
|
||||
width = max(width, int(2 * MARGIN + _roles_n * 150 + 20 + 3 * 130))
|
||||
height = int(max_y - min_y + 2 * MARGIN + TITLE_H + LEGEND_H)
|
||||
|
||||
# Shift everything so the drawing starts at (MARGIN, MARGIN + TITLE_H).
|
||||
|
||||
Reference in New Issue
Block a user