[object Object]

← back to Exo

viz positioning of inteface description

5f6625a79b7707eb896f7ea70dd0c9300ab35d83 · 2024-12-06 23:30:28 +0000 · Alex Cheema

Files touched

Diff

commit 5f6625a79b7707eb896f7ea70dd0c9300ab35d83
Author: Alex Cheema <alexcheema123@gmail.com>
Date:   Fri Dec 6 23:30:28 2024 +0000

    viz positioning of inteface description
---
 exo/viz/topology_viz.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/exo/viz/topology_viz.py b/exo/viz/topology_viz.py
index 4487cb22..1519612f 100644
--- a/exo/viz/topology_viz.py
+++ b/exo/viz/topology_viz.py
@@ -266,9 +266,11 @@ class TopologyViz:
       # Add connection description near the midpoint of the line
       mid_x = (x + next_x) // 2
       mid_y = (y + next_y) // 2
+      # Center the description text around the midpoint
+      desc_start_x = mid_x - len(connection_description) // 2
       for j, char in enumerate(connection_description):
-        if 0 <= mid_y < 48 and 0 <= mid_x + j < 100:
-          visualization[mid_y][mid_x + j] = char
+        if 0 <= mid_y < 48 and 0 <= desc_start_x + j < 100:
+          visualization[mid_y][desc_start_x + j] = char
 
     # Convert to string
     return "\n".join("".join(str(char) for char in row) for row in visualization)

← 02ee8b7d macos interface type  ·  back to Exo  ·  fx 22e4bc23 →