mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Alternate fix to Decimal scaling issue
This commit is contained in:
parent
bbeba108bc
commit
e151334675
2 changed files with 9 additions and 4 deletions
|
@ -561,7 +561,7 @@ class Mobject(object):
|
|||
)
|
||||
return self
|
||||
|
||||
def scale(self, scale_factor, min_scale_factor=1e-8, about_point=None, about_edge=ORIGIN, recurse=True):
|
||||
def scale(self, scale_factor, min_scale_factor=1e-8, about_point=None, about_edge=ORIGIN):
|
||||
"""
|
||||
Default behavior is to scale about the center of the mobject.
|
||||
The argument about_edge can be a vector, indicating which side of
|
||||
|
@ -572,6 +572,8 @@ class Mobject(object):
|
|||
respect to that point.
|
||||
"""
|
||||
scale_factor = max(scale_factor, min_scale_factor)
|
||||
for mob in self.get_family():
|
||||
mob._handle_scale_side_effects(scale_factor)
|
||||
self.apply_points_function(
|
||||
lambda points: scale_factor * points,
|
||||
about_point=about_point,
|
||||
|
@ -580,6 +582,11 @@ class Mobject(object):
|
|||
)
|
||||
return self
|
||||
|
||||
def _handle_scale_side_effects(self, scale_factor):
|
||||
# In case subclasses, such as DecimalNumber, need to make
|
||||
# any other changes when the size gets altered
|
||||
pass
|
||||
|
||||
def stretch(self, factor, dim, **kwargs):
|
||||
def func(points):
|
||||
points[:, dim] *= factor
|
||||
|
|
|
@ -135,10 +135,8 @@ class DecimalNumber(VMobject):
|
|||
sm1.match_style(sm2)
|
||||
return self
|
||||
|
||||
def scale(self, scale_factor, **kwargs):
|
||||
super().scale(scale_factor, **kwargs)
|
||||
def _handle_scale_side_effects(self, scale_factor):
|
||||
self.data["font_size"] *= scale_factor
|
||||
return self
|
||||
|
||||
def get_value(self):
|
||||
return self.number
|
||||
|
|
Loading…
Add table
Reference in a new issue