Skip to content

Commit c17e0df

Browse files
committed
fix port pos for lateral links
1 parent 71e87f5 commit c17e0df

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

core/diagram/diagram_builder.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ def add_ports(self, diagram, styles, verbose=True):
5353
spacing = styles["node_height"] / (num_links + 1)
5454
for i, link in enumerate(sorted_links):
5555
if link.target.pos_x > link.source.pos_x:
56-
port_x = node.pos_x + styles["node_width"]
56+
port_x = node.pos_x + styles["node_width"] - styles["port_width"] / 2
5757
else:
58-
port_x = node.pos_x
59-
port_y = node.pos_y + (i + 1) * spacing
58+
port_x = node.pos_x - styles["port_width"] / 2
59+
port_y = node.pos_y + (i + 1) * spacing - styles["port_height"] / 2
6060
link.port_pos = (port_x, port_y)
6161
else:
6262
# horizontal layout
@@ -83,10 +83,10 @@ def add_ports(self, diagram, styles, verbose=True):
8383
spacing = styles["node_width"] / (num_links + 1)
8484
for i, link in enumerate(sorted_links):
8585
if link.target.pos_y > link.source.pos_y:
86-
port_y = node.pos_y + styles["node_height"]
86+
port_y = node.pos_y + styles["node_height"] - styles["port_height"] / 2
8787
else:
88-
port_y = node.pos_y
89-
port_x = node.pos_x + (i + 1) * spacing
88+
port_y = node.pos_y - styles["port_height"] / 2
89+
port_x = node.pos_x + (i + 1) * spacing - styles["port_width"] / 2
9090
link.port_pos = (port_x, port_y)
9191

9292
# Create connectors and midpoint connectors

0 commit comments

Comments
 (0)