소스 검색

viz positioning of inteface description

Alex Cheema 5 달 전
부모
커밋
5f6625a79b
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      exo/viz/topology_viz.py

+ 4 - 2
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)