From d5c36de3c59d77fd446355bd402fab61352ff6cd Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Tue, 10 Dec 2024 19:23:15 -0600 Subject: [PATCH] DEFAULT_MOBJECT_TO_MOBJECT_BUFFER -> DEFAULT_MOBJECT_TO_MOBJECT_BUFF And likewise DEFAULT_MOBJECT_TO_MOBJECT_BUFFER -> DEFAULT_MOBJECT_TO_MOBJECT_BUFF --- docs/source/documentation/constants.rst | 4 ++-- manimlib/constants.py | 4 ++-- manimlib/mobject/mobject.py | 14 +++++++------- manimlib/mobject/svg/brace.py | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/source/documentation/constants.rst b/docs/source/documentation/constants.rst index 81ec493704..c9116e2c10 100644 --- a/docs/source/documentation/constants.rst +++ b/docs/source/documentation/constants.rst @@ -30,8 +30,8 @@ Buffs MED_LARGE_BUFF = 0.5 LARGE_BUFF = 1 - DEFAULT_MOBJECT_TO_EDGE_BUFFER = MED_LARGE_BUFF # Distance between object and edge - DEFAULT_MOBJECT_TO_MOBJECT_BUFFER = MED_SMALL_BUFF # Distance between objects + DEFAULT_MOBJECT_TO_EDGE_BUFF = MED_LARGE_BUFF # Distance between object and edge + DEFAULT_MOBJECT_TO_MOBJECT_BUFF = MED_SMALL_BUFF # Distance between objects Run times --------- diff --git a/manimlib/constants.py b/manimlib/constants.py index 65e1e4eca4..20df34ff52 100644 --- a/manimlib/constants.py +++ b/manimlib/constants.py @@ -30,8 +30,8 @@ MED_LARGE_BUFF: float = GLOBAL_CONFIG["sizes"]["med_large_buff"] LARGE_BUFF: float = GLOBAL_CONFIG["sizes"]["large_buff"] -DEFAULT_MOBJECT_TO_EDGE_BUFFER: float = GLOBAL_CONFIG["sizes"]["default_mobject_to_edge_buff"] -DEFAULT_MOBJECT_TO_MOBJECT_BUFFER: float = GLOBAL_CONFIG["sizes"]["default_mobject_to_mobject_buff"] +DEFAULT_MOBJECT_TO_EDGE_BUFF: float = GLOBAL_CONFIG["sizes"]["default_mobject_to_edge_buff"] +DEFAULT_MOBJECT_TO_MOBJECT_BUFF: float = GLOBAL_CONFIG["sizes"]["default_mobject_to_mobject_buff"] # Standard vectors diff --git a/manimlib/mobject/mobject.py b/manimlib/mobject/mobject.py index 63089e435e..36cd5c64a7 100644 --- a/manimlib/mobject/mobject.py +++ b/manimlib/mobject/mobject.py @@ -12,8 +12,8 @@ import numbers import numpy as np -from manimlib.constants import DEFAULT_MOBJECT_TO_EDGE_BUFFER -from manimlib.constants import DEFAULT_MOBJECT_TO_MOBJECT_BUFFER +from manimlib.constants import DEFAULT_MOBJECT_TO_EDGE_BUFF +from manimlib.constants import DEFAULT_MOBJECT_TO_MOBJECT_BUFF from manimlib.constants import DOWN, IN, LEFT, ORIGIN, OUT, RIGHT, UP from manimlib.constants import FRAME_X_RADIUS, FRAME_Y_RADIUS from manimlib.constants import MED_SMALL_BUFF @@ -1055,7 +1055,7 @@ def center(self) -> Self: def align_on_border( self, direction: Vect3, - buff: float = DEFAULT_MOBJECT_TO_EDGE_BUFFER + buff: float = DEFAULT_MOBJECT_TO_EDGE_BUFF ) -> Self: """ Direction just needs to be a vector pointing towards side or @@ -1071,14 +1071,14 @@ def align_on_border( def to_corner( self, corner: Vect3 = LEFT + DOWN, - buff: float = DEFAULT_MOBJECT_TO_EDGE_BUFFER + buff: float = DEFAULT_MOBJECT_TO_EDGE_BUFF ) -> Self: return self.align_on_border(corner, buff) def to_edge( self, edge: Vect3 = LEFT, - buff: float = DEFAULT_MOBJECT_TO_EDGE_BUFFER + buff: float = DEFAULT_MOBJECT_TO_EDGE_BUFF ) -> Self: return self.align_on_border(edge, buff) @@ -1086,7 +1086,7 @@ def next_to( self, mobject_or_point: Mobject | Vect3, direction: Vect3 = RIGHT, - buff: float = DEFAULT_MOBJECT_TO_MOBJECT_BUFFER, + buff: float = DEFAULT_MOBJECT_TO_MOBJECT_BUFF, aligned_edge: Vect3 = ORIGIN, submobject_to_align: Mobject | None = None, index_of_submobject_to_align: int | slice | None = None, @@ -1117,7 +1117,7 @@ def shift_onto_screen(self, **kwargs) -> Self: space_lengths = [FRAME_X_RADIUS, FRAME_Y_RADIUS] for vect in UP, DOWN, LEFT, RIGHT: dim = np.argmax(np.abs(vect)) - buff = kwargs.get("buff", DEFAULT_MOBJECT_TO_EDGE_BUFFER) + buff = kwargs.get("buff", DEFAULT_MOBJECT_TO_EDGE_BUFF) max_val = space_lengths[dim] - buff edge_center = self.get_edge_center(vect) if np.dot(edge_center, vect) > max_val: diff --git a/manimlib/mobject/svg/brace.py b/manimlib/mobject/svg/brace.py index 9399e73e6e..4078e68767 100644 --- a/manimlib/mobject/svg/brace.py +++ b/manimlib/mobject/svg/brace.py @@ -5,7 +5,7 @@ import numpy as np -from manimlib.constants import DEFAULT_MOBJECT_TO_MOBJECT_BUFFER, SMALL_BUFF +from manimlib.constants import DEFAULT_MOBJECT_TO_MOBJECT_BUFF, SMALL_BUFF from manimlib.constants import DOWN, LEFT, ORIGIN, RIGHT, DL, DR, UL from manimlib.constants import PI from manimlib.animation.composition import AnimationGroup @@ -79,7 +79,7 @@ def put_at_tip( ) else: mob.move_to(self.get_tip()) - buff = kwargs.get("buff", DEFAULT_MOBJECT_TO_MOBJECT_BUFFER) + buff = kwargs.get("buff", DEFAULT_MOBJECT_TO_MOBJECT_BUFF) shift_distance = mob.get_width() / 2.0 + buff mob.shift(self.get_direction() * shift_distance) return self @@ -116,7 +116,7 @@ def __init__( text: str | Iterable[str], brace_direction: np.ndarray = DOWN, label_scale: float = 1.0, - label_buff: float = DEFAULT_MOBJECT_TO_MOBJECT_BUFFER, + label_buff: float = DEFAULT_MOBJECT_TO_MOBJECT_BUFF, **kwargs ) -> None: super().__init__(**kwargs)