@@ -53,10 +53,10 @@ def add_ports(self, diagram, styles, verbose=True):
53
53
spacing = styles ["node_height" ] / (num_links + 1 )
54
54
for i , link in enumerate (sorted_links ):
55
55
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
57
57
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
60
60
link .port_pos = (port_x , port_y )
61
61
else :
62
62
# horizontal layout
@@ -83,10 +83,10 @@ def add_ports(self, diagram, styles, verbose=True):
83
83
spacing = styles ["node_width" ] / (num_links + 1 )
84
84
for i , link in enumerate (sorted_links ):
85
85
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
87
87
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
90
90
link .port_pos = (port_x , port_y )
91
91
92
92
# Create connectors and midpoint connectors
0 commit comments