Skip to content

Commit

Permalink
fix port pos for lateral links
Browse files Browse the repository at this point in the history
  • Loading branch information
FloSch62 committed Jan 7, 2025
1 parent 71e87f5 commit c17e0df
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/diagram/diagram_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ def add_ports(self, diagram, styles, verbose=True):
spacing = styles["node_height"] / (num_links + 1)
for i, link in enumerate(sorted_links):
if link.target.pos_x > link.source.pos_x:
port_x = node.pos_x + styles["node_width"]
port_x = node.pos_x + styles["node_width"] - styles["port_width"] / 2
else:
port_x = node.pos_x
port_y = node.pos_y + (i + 1) * spacing
port_x = node.pos_x - styles["port_width"] / 2
port_y = node.pos_y + (i + 1) * spacing - styles["port_height"] / 2
link.port_pos = (port_x, port_y)
else:
# horizontal layout
Expand All @@ -83,10 +83,10 @@ def add_ports(self, diagram, styles, verbose=True):
spacing = styles["node_width"] / (num_links + 1)
for i, link in enumerate(sorted_links):
if link.target.pos_y > link.source.pos_y:
port_y = node.pos_y + styles["node_height"]
port_y = node.pos_y + styles["node_height"] - styles["port_height"] / 2
else:
port_y = node.pos_y
port_x = node.pos_x + (i + 1) * spacing
port_y = node.pos_y - styles["port_height"] / 2
port_x = node.pos_x + (i + 1) * spacing - styles["port_width"] / 2
link.port_pos = (port_x, port_y)

# Create connectors and midpoint connectors
Expand Down

0 comments on commit c17e0df

Please sign in to comment.