Skip to content

Fixed text center of rotation for add_fixed_orientation_mobjects()#4701

Open
vihdutta wants to merge 1 commit intoManimCommunity:mainfrom
vihdutta:text_rotation
Open

Fixed text center of rotation for add_fixed_orientation_mobjects()#4701
vihdutta wants to merge 1 commit intoManimCommunity:mainfrom
vihdutta:text_rotation

Conversation

@vihdutta
Copy link
Copy Markdown
Contributor

Overview: What does this pull request change?

Modified the fix_orientation function under opengl_mobject.py to fix an error in center of rotation for text objects according to #4644 . The @affects_shader_info_id decorator called fix_orientation once per submobject, so each glyph used its own get_center() as the pivot instead of the whole label’s center. I changed it so that it computes a single anchor from the mobject fix_orientation is called on, then uses that one point for every part of the label (every submobject). This makes it so the whole string spins as a single unit around the text's real middle.

Motivation and Explanation: Why and how do your changes improve the library?

Bugfix.

Links to added or changed documentation pages

Added comment under the fix_orientation() function to detail why "@affects_shader_info_id" is not being used from this PR (since the surrounding functions use it).

Further Information and Comments

Showing the text rotation works properly given the reproduction code/example from issue #4644

image image image

This was also ran on the OpenGL renderer (like #4644 ) but on Windows 11.

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

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.

1 participant