diff --git a/manim/mobject/mobject.py b/manim/mobject/mobject.py index 9f3818c188..fff250fb91 100644 --- a/manim/mobject/mobject.py +++ b/manim/mobject/mobject.py @@ -1911,7 +1911,7 @@ def move_to( self.shift((target - point_to_align) * coor_mask) return self - def replace( + def match_size_and_position_to( self, mobject: Mobject, dim_to_match: int = 0, stretch: bool = False ) -> Self: if not mobject.get_num_points() and not mobject.submobjects: @@ -1928,6 +1928,19 @@ def replace( self.shift(mobject.get_center() - self.get_center()) return self + def replace( + self, mobject: Mobject, dim_to_match: int = 0, stretch: bool = False + ) -> Self: + """Deprecated: use match_size_and_position_to() instead.""" + import warnings + + warnings.warn( + "replace() is deprecated, use match_size_and_position_to() instead.", + DeprecationWarning, + stacklevel=2, + ) + return self.match_size_and_position_to(mobject, dim_to_match, stretch) + def surround( self, mobject: Mobject, diff --git a/manim/mobject/opengl/opengl_mobject.py b/manim/mobject/opengl/opengl_mobject.py index 52cb3f3ac2..a2f3ad20ce 100644 --- a/manim/mobject/opengl/opengl_mobject.py +++ b/manim/mobject/opengl/opengl_mobject.py @@ -2100,7 +2100,7 @@ def move_to( self.shift((target - point_to_align) * coor_mask) return self - def replace( + def match_size_and_position_to( self, mobject: OpenGLMobject, dim_to_match: int = 0, @@ -2121,6 +2121,19 @@ def replace( self.shift(mobject.get_center() - self.get_center()) return self + def replace( + self, mobject: OpenGLMobject, dim_to_match: int = 0, stretch: bool = False + ) -> Self: + """Deprecated: use match_size_and_position_to() instead.""" + import warnings + + warnings.warn( + "replace() is deprecated, use match_size_and_position_to() instead.", + DeprecationWarning, + stacklevel=2, + ) + return self.match_size_and_position_to(mobject, dim_to_match, stretch) + def surround( self, mobject: OpenGLMobject,