File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 1717LINE_HEIGHT = 20
1818FANOUT_HEIGHT = 35
1919FANOUT_LEG_HEIGHT = 15
20- CABLE_HEIGHT = 4 * LINE_HEIGHT + FANOUT_HEIGHT + FANOUT_LEG_HEIGHT
20+ CABLE_HEIGHT = 5 * LINE_HEIGHT + FANOUT_HEIGHT + FANOUT_LEG_HEIGHT
2121
2222
2323class Node (Hyperlink ):
@@ -405,7 +405,17 @@ def render(self):
405405 end = far [0 ].top_center
406406 text_offset = 0
407407
408- if len (near ) > 1 :
408+ if len (near ) > 1 and len (far ) > 1 :
409+ start_center = sum ([pos .bottom_center [0 ] for pos in near ]) / len (near )
410+ end_center = sum ([pos .bottom_center [0 ] for pos in far ]) / len (far )
411+ center_x = (start_center + end_center ) / 2
412+
413+ start = (center_x , start [1 ] + FANOUT_HEIGHT + FANOUT_LEG_HEIGHT )
414+ end = (center_x , end [1 ] - FANOUT_HEIGHT - FANOUT_LEG_HEIGHT )
415+ text_offset -= (FANOUT_HEIGHT + FANOUT_LEG_HEIGHT )
416+ self .draw_fanin (start , near , color )
417+ self .draw_fanout (end , far , color )
418+ elif len (near ) > 1 :
409419 # Handle Fan-In - change start position to be directly below start
410420 start = (end [0 ], start [1 ] + FANOUT_HEIGHT + FANOUT_LEG_HEIGHT )
411421 self .draw_fanin (start , near , color )
You can’t perform that action at this time.
0 commit comments