fix: call align_to AFTER move_to so bars follow rect positions
This commit is contained in:
parent
f6ccefb34e
commit
b2ff243447
|
|
@ -284,23 +284,23 @@ class ContinuousBatching(Scene):
|
||||||
s_label = Text("Static Batching", font_size=24, color=RED)
|
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_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,
|
s_bar = Rectangle(width=bar_max_w * ratio, height=bar_h,
|
||||||
color=RED, fill_opacity=0.55, stroke_width=0) \
|
color=RED, fill_opacity=0.55, stroke_width=0)
|
||||||
.align_to(s_rect, LEFT).align_to(s_rect, UP)
|
|
||||||
s_num = Text("1.0x", font_size=24, color=RED)
|
s_num = Text("1.0x", font_size=24, color=RED)
|
||||||
|
|
||||||
# ---- Continuous Batching row ----
|
# ---- Continuous Batching row ----
|
||||||
c_label = Text("Continuous Batching", font_size=24, color=GREEN)
|
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_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,
|
c_bar = Rectangle(width=bar_max_w, height=bar_h,
|
||||||
color=GREEN, fill_opacity=0.55, stroke_width=0) \
|
color=GREEN, fill_opacity=0.55, stroke_width=0)
|
||||||
.align_to(c_rect, LEFT).align_to(c_rect, UP)
|
|
||||||
c_num = Text("3.4x", font_size=24, color=GREEN)
|
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))
|
s_rect.move_to(ORIGIN + UP * (row_gap / 2 + bar_h / 2))
|
||||||
c_rect.move_to(ORIGIN + DOWN * (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)
|
s_label.next_to(s_rect, LEFT, buff=0.4)
|
||||||
c_label.next_to(c_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)
|
s_num.next_to(s_rect, RIGHT, buff=0.4)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue