Fixed inconsistent stroke width scaling for text in compound objects (#4694)

* fixed zero-stroke mobject scaling

* updated vectorized_mobject scale docstring text
This commit is contained in:
Vihaan Dutta 2026-04-19 16:10:14 -04:00 committed by GitHub
commit 429f25328d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -500,8 +500,10 @@ class VMobject(Mobject):
will shrink, and for :math:`|\alpha| > 1` it will grow. Furthermore, will shrink, and for :math:`|\alpha| > 1` it will grow. Furthermore,
if :math:`\alpha < 0`, the mobject is also flipped. if :math:`\alpha < 0`, the mobject is also flipped.
scale_stroke scale_stroke
Boolean determining if the object's outline is scaled when the object is scaled. Boolean determining if each submobject's outline is scaled when the object
If enabled, and object with 2px outline is scaled by a factor of .5, it will have an outline of 1px. is scaled. If enabled, each submobject keeps its relative stroke width (for
example, a submobject with a 2px outline scaled by a factor of .5 will have
a 1px outline, while a submobject with 0px stroke remains at 0px).
kwargs kwargs
Additional keyword arguments passed to Additional keyword arguments passed to
:meth:`~.Mobject.scale`. :meth:`~.Mobject.scale`.
@ -538,11 +540,17 @@ class VMobject(Mobject):
""" """
if scale_stroke: if scale_stroke:
self.set_stroke(width=abs(scale_factor) * self.get_stroke_width()) for mob in self.get_family():
self.set_stroke( if isinstance(mob, VMobject):
width=abs(scale_factor) * self.get_stroke_width(background=True), mob.set_stroke(
background=True, width=abs(scale_factor) * mob.get_stroke_width(),
) family=False,
)
mob.set_stroke(
width=abs(scale_factor) * mob.get_stroke_width(background=True),
background=True,
family=False,
)
super().scale(scale_factor, about_point=about_point, about_edge=about_edge) super().scale(scale_factor, about_point=about_point, about_edge=about_edge)
return self return self