Add min_scale_factor to keep Mobjects from shrinking to 0, and hence losing all shape information, unless its purposeful

This commit is contained in:
Grant Sanderson
2021-03-23 08:50:10 -07:00
parent 52baf5b7c2
commit 6c3e4b94ea

View File

@ -561,7 +561,7 @@ class Mobject(object):
)
return self
def scale(self, scale_factor, **kwargs):
def scale(self, scale_factor, min_scale_factor=1e-8, **kwargs):
"""
Default behavior is to scale about the center of the mobject.
The argument about_edge can be a vector, indicating which side of
@ -571,6 +571,7 @@ class Mobject(object):
Otherwise, if about_point is given a value, scaling is done with
respect to that point.
"""
scale_factor = max(scale_factor, min_scale_factor)
self.apply_points_function(
lambda points: scale_factor * points,
works_on_bounding_box=True,