@@ -379,17 +379,18 @@ def get_drain_distance(stage_data)
379379 ticks_since_finished
380380 end
381381
382+ # Check if connection has flowing animation (vs idle/drained state)
383+ def connection_flowing? ( stage_data )
384+ stage_data [ :status ] == :running
385+ end
386+
382387 # Draw a fan-out connection (one source to multiple targets)
383388 def render_fanout_connection ( terminal , from_pos , target_positions , stage_data , x_offset , y_offset )
384389 from_x = from_pos [ :x ] + from_pos [ :width ] / 2
385390 from_y = from_pos [ :y ] + from_pos [ :height ]
386391
387- # Get drain distance (non-nil when stage finished)
388392 drain_distance = get_drain_distance ( stage_data )
389-
390- # Connection is active if flowing OR draining
391- # When draining, keep animation visible until fully drained
392- active = ( stage_data [ :throughput ] && stage_data [ :throughput ] > 0 ) || !drain_distance . nil?
393+ active = connection_flowing? ( stage_data )
393394
394395 # Calculate split point (horizontal spine where fan-out occurs)
395396 split_y = from_y + 1
@@ -457,11 +458,8 @@ def render_fanin_connection(terminal, source_positions, to_pos, stage_data, x_of
457458 to_x = to_pos [ :x ] + to_pos [ :width ] / 2
458459 to_y = to_pos [ :y ]
459460
460- # Get drain distance (non-nil when stage finished)
461461 drain_distance = get_drain_distance ( stage_data )
462-
463- # Connection is active if flowing OR draining
464- active = ( stage_data [ :throughput ] && stage_data [ :throughput ] > 0 ) || !drain_distance . nil?
462+ active = connection_flowing? ( stage_data )
465463
466464 # Calculate merge point (where horizontal lines converge)
467465 # Place it 1 line above the target
@@ -546,11 +544,8 @@ def render_connection_line(terminal, from_pos, to_pos, stage_data, x_offset, y_o
546544 to_x = to_pos [ :x ] + to_pos [ :width ] / 2
547545 to_y = to_pos [ :y ]
548546
549- # Get drain distance (non-nil when stage finished)
550547 drain_distance = get_drain_distance ( stage_data )
551-
552- # Connection is active if flowing OR draining
553- active = ( stage_data [ :throughput ] && stage_data [ :throughput ] > 0 ) || !drain_distance . nil?
548+ active = connection_flowing? ( stage_data )
554549
555550 # Distance counter starts at 0 from source
556551 distance = 0
0 commit comments