From b2ff243447b5499e813af814912a2f3d36a13bb6 Mon Sep 17 00:00:00 2001 From: ViperEkura <3081035982@qq.com> Date: Wed, 6 May 2026 22:13:11 +0800 Subject: [PATCH] fix: call align_to AFTER move_to so bars follow rect positions --- continuous_batching.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/continuous_batching.py b/continuous_batching.py index 86267c3..73d4319 100644 --- a/continuous_batching.py +++ b/continuous_batching.py @@ -284,23 +284,23 @@ class ContinuousBatching(Scene): s_label = Text("Static Batching", font_size=24, color=RED) s_rect = Rectangle(width=bar_max_w, height=bar_h, color=RED, stroke_width=1.5) s_bar = Rectangle(width=bar_max_w * ratio, height=bar_h, - color=RED, fill_opacity=0.55, stroke_width=0) \ - .align_to(s_rect, LEFT).align_to(s_rect, UP) + color=RED, fill_opacity=0.55, stroke_width=0) s_num = Text("1.0x", font_size=24, color=RED) # ---- Continuous Batching row ---- c_label = Text("Continuous Batching", font_size=24, color=GREEN) c_rect = Rectangle(width=bar_max_w, height=bar_h, color=GREEN, stroke_width=1.5) c_bar = Rectangle(width=bar_max_w, height=bar_h, - color=GREEN, fill_opacity=0.55, stroke_width=0) \ - .align_to(c_rect, LEFT).align_to(c_rect, UP) + color=GREEN, fill_opacity=0.55, stroke_width=0) c_num = Text("3.4x", font_size=24, color=GREEN) - # position rects vertically stacked, same x + # position rects first, then align bars s_rect.move_to(ORIGIN + UP * (row_gap / 2 + bar_h / 2)) c_rect.move_to(ORIGIN + DOWN * (row_gap / 2 + bar_h / 2)) + s_bar.align_to(s_rect, LEFT).align_to(s_rect, UP) + c_bar.align_to(c_rect, LEFT).align_to(c_rect, UP) - # labels left, nums right, bars follow rects + # labels left, nums right s_label.next_to(s_rect, LEFT, buff=0.4) c_label.next_to(c_rect, LEFT, buff=0.4) s_num.next_to(s_rect, RIGHT, buff=0.4)