Skip to content

fix(svg): propagate constructor z_index to glyph submobjects#4857

Closed
Chessing234 wants to merge 2 commits into
ManimCommunity:mainfrom
Chessing234:fix/4667-svg-z-index-propagation
Closed

fix(svg): propagate constructor z_index to glyph submobjects#4857
Chessing234 wants to merge 2 commits into
ManimCommunity:mainfrom
Chessing234:fix/4667-svg-z-index-propagation

Conversation

@Chessing234

Copy link
Copy Markdown

Summary

  • Text(..., z_index=3) (and other SVG-based mobjects like MathTex) ignored the z_index because glyph submobjects are created after super().__init__ stored self.z_index. The glyphs kept z_index=0, so z-ordering was wrong during rendering.
  • Propagate the constructor z_index to the whole family once the glyphs exist.

Before:

Text("A", z_index=3).submobjects  # each glyph has z_index == 0

Fixes #4667

Test plan

  • pytest tests/module/mobject/text/test_text_mobject.py::test_z_index_propagates_to_glyphs
  • pytest tests/module/mobject/svg tests/module/mobject/text (pre-existing typst-dependency failures unrelated to this change)

Made with Cursor

Chessing234 and others added 2 commits July 1, 2026 20:26
Glyphs are added after super().__init__ stored self.z_index, so a
z_index passed to Text/MathTex/SVGMobject never reached the glyphs and
was ignored when rendering z-order. Propagate it to the whole family.

Fixes ManimCommunity#4667

Co-authored-by: Cursor <cursoragent@cursor.com>
Assign z_index on the family directly and guard with getattr so the OpenGL
renderer (which lacks set_z_index / a z_index attribute) no longer crashes.

Co-authored-by: Cursor <cursoragent@cursor.com>
@chopan050 chopan050 closed this Jul 8, 2026
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.

Text Mobject does not recursively propagation to submodules key kwargs arguments

2 participants