99
1010import numpy as np
1111
12+ from .. import config
1213from ..constants import *
1314
1415from ..utils .color import color_gradient
@@ -336,7 +337,7 @@ def digest_mobject_attrs(self):
336337 in the submobjects list.
337338 """
338339 mobject_attrs = [
339- x for x in list (self .__dict__ .values ()) if isinstance (x , Mobject )
340+ x for x in list (self .__dict__ .values ()) if isinstance (x , OpenGLMobject )
340341 ]
341342 self .set_submobjects (list_update (self .submobjects , mobject_attrs ))
342343 return self
@@ -694,7 +695,11 @@ def align_on_border(self, direction, buff=DEFAULT_MOBJECT_TO_EDGE_BUFFER):
694695 Direction just needs to be a vector pointing towards side or
695696 corner in the 2d plane.
696697 """
697- target_point = np .sign (direction ) * (FRAME_X_RADIUS , FRAME_Y_RADIUS , 0 )
698+ target_point = np .sign (direction ) * (
699+ config ["frame_x_radius" ],
700+ config ["frame_y_radius" ],
701+ 0 ,
702+ )
698703 point_to_align = self .get_bounding_box_point (direction )
699704 shift_val = target_point - point_to_align - buff * np .array (direction )
700705 shift_val = shift_val * abs (np .sign (direction ))
@@ -717,7 +722,7 @@ def next_to(
717722 index_of_submobject_to_align = None ,
718723 coor_mask = np .array ([1 , 1 , 1 ]),
719724 ):
720- if isinstance (mobject_or_point , Mobject ):
725+ if isinstance (mobject_or_point , OpenGLMobject ):
721726 mob = mobject_or_point
722727 if index_of_submobject_to_align is not None :
723728 target_aligner = mob [index_of_submobject_to_align ]
@@ -739,7 +744,7 @@ def next_to(
739744 return self
740745
741746 def shift_onto_screen (self , ** kwargs ):
742- space_lengths = [FRAME_X_RADIUS , FRAME_Y_RADIUS ]
747+ space_lengths = [config [ "frame_x_radius" ], config [ "frame_y_radius" ] ]
743748 for vect in UP , DOWN , LEFT , RIGHT :
744749 dim = np .argmax (np .abs (vect ))
745750 buff = kwargs .get ("buff" , DEFAULT_MOBJECT_TO_EDGE_BUFFER )
@@ -750,13 +755,13 @@ def shift_onto_screen(self, **kwargs):
750755 return self
751756
752757 def is_off_screen (self ):
753- if self .get_left ()[0 ] > FRAME_X_RADIUS :
758+ if self .get_left ()[0 ] > config [ "frame_x_radius" ] :
754759 return True
755- if self .get_right ()[0 ] < - FRAME_X_RADIUS :
760+ if self .get_right ()[0 ] < - config [ "frame_x_radius" ] :
756761 return True
757- if self .get_bottom ()[1 ] > FRAME_Y_RADIUS :
762+ if self .get_bottom ()[1 ] > config [ "frame_y_radius" ] :
758763 return True
759- if self .get_top ()[1 ] < - FRAME_Y_RADIUS :
764+ if self .get_top ()[1 ] < - config [ "frame_y_radius" ] :
760765 return True
761766 return False
762767
@@ -1086,7 +1091,7 @@ def get_pieces(self, n_pieces):
10861091 template = self .copy ()
10871092 template .set_submobjects ([])
10881093 alphas = np .linspace (0 , 1 , n_pieces + 1 )
1089- return Group (
1094+ return OpenGLGroup (
10901095 * [
10911096 template .copy ().pointwise_become_partial (self , a1 , a2 )
10921097 for a1 , a2 in zip (alphas [:- 1 ], alphas [1 :])
@@ -1141,7 +1146,7 @@ def align_to(self, mobject_or_point, direction=ORIGIN):
11411146 horizontally so that it's center is directly above/below
11421147 the center of mob2
11431148 """
1144- if isinstance (mobject_or_point , Mobject ):
1149+ if isinstance (mobject_or_point , OpenGLMobject ):
11451150 point = mobject_or_point .get_bounding_box_point (direction )
11461151 else :
11471152 point = mobject_or_point
0 commit comments