Skip to content

fix(geometry): preserve Angle.angle_value across become()#4853

Open
Chessing234 wants to merge 1 commit into
ManimCommunity:mainfrom
Chessing234:fix/4512-angle-become-value
Open

fix(geometry): preserve Angle.angle_value across become()#4853
Chessing234 wants to merge 1 commit into
ManimCommunity:mainfrom
Chessing234:fix/4512-angle-become-value

Conversation

@Chessing234

Copy link
Copy Markdown

Changelog / Overview

Angle.get_value() returned the initial angle even after the defining lines moved, when the angle was wrapped in always_redraw.

Cause

always_redraw(lambda: Angle(l1, l2)) refreshes the mobject via become(), which copies points/submobjects but not the cached angle_value attribute that get_value() returns.

Fix

Override become() on Angle to copy angle_value from the source Angle.

Testing

l1 = Line(LEFT, RIGHT); l2 = Line(DOWN, UP)
a = always_redraw(lambda: Angle(l1, l2))
l1.rotate(PI/4); a.update()
a.get_value()   # before: 1.5708 (stale); after: 0.7854

Fixes #4512

Made with Cursor

become() copies points/submobjects but not angle_value, so
always_redraw(lambda: Angle(l1, l2)) left get_value() returning the
initial angle even after the lines moved. Copy angle_value in an Angle
override of become().

Fixes ManimCommunity#4512

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Angle does not change value when line updates

1 participant