9
9
10
10
import numpy as np
11
11
12
+ from .. import config
12
13
from ..constants import *
13
14
14
15
from ..utils .color import color_gradient
@@ -336,7 +337,7 @@ def digest_mobject_attrs(self):
336
337
in the submobjects list.
337
338
"""
338
339
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 )
340
341
]
341
342
self .set_submobjects (list_update (self .submobjects , mobject_attrs ))
342
343
return self
@@ -694,7 +695,11 @@ def align_on_border(self, direction, buff=DEFAULT_MOBJECT_TO_EDGE_BUFFER):
694
695
Direction just needs to be a vector pointing towards side or
695
696
corner in the 2d plane.
696
697
"""
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
+ )
698
703
point_to_align = self .get_bounding_box_point (direction )
699
704
shift_val = target_point - point_to_align - buff * np .array (direction )
700
705
shift_val = shift_val * abs (np .sign (direction ))
@@ -717,7 +722,7 @@ def next_to(
717
722
index_of_submobject_to_align = None ,
718
723
coor_mask = np .array ([1 , 1 , 1 ]),
719
724
):
720
- if isinstance (mobject_or_point , Mobject ):
725
+ if isinstance (mobject_or_point , OpenGLMobject ):
721
726
mob = mobject_or_point
722
727
if index_of_submobject_to_align is not None :
723
728
target_aligner = mob [index_of_submobject_to_align ]
@@ -739,7 +744,7 @@ def next_to(
739
744
return self
740
745
741
746
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" ] ]
743
748
for vect in UP , DOWN , LEFT , RIGHT :
744
749
dim = np .argmax (np .abs (vect ))
745
750
buff = kwargs .get ("buff" , DEFAULT_MOBJECT_TO_EDGE_BUFFER )
@@ -750,13 +755,13 @@ def shift_onto_screen(self, **kwargs):
750
755
return self
751
756
752
757
def is_off_screen (self ):
753
- if self .get_left ()[0 ] > FRAME_X_RADIUS :
758
+ if self .get_left ()[0 ] > config [ "frame_x_radius" ] :
754
759
return True
755
- if self .get_right ()[0 ] < - FRAME_X_RADIUS :
760
+ if self .get_right ()[0 ] < - config [ "frame_x_radius" ] :
756
761
return True
757
- if self .get_bottom ()[1 ] > FRAME_Y_RADIUS :
762
+ if self .get_bottom ()[1 ] > config [ "frame_y_radius" ] :
758
763
return True
759
- if self .get_top ()[1 ] < - FRAME_Y_RADIUS :
764
+ if self .get_top ()[1 ] < - config [ "frame_y_radius" ] :
760
765
return True
761
766
return False
762
767
@@ -1086,7 +1091,7 @@ def get_pieces(self, n_pieces):
1086
1091
template = self .copy ()
1087
1092
template .set_submobjects ([])
1088
1093
alphas = np .linspace (0 , 1 , n_pieces + 1 )
1089
- return Group (
1094
+ return OpenGLGroup (
1090
1095
* [
1091
1096
template .copy ().pointwise_become_partial (self , a1 , a2 )
1092
1097
for a1 , a2 in zip (alphas [:- 1 ], alphas [1 :])
@@ -1141,7 +1146,7 @@ def align_to(self, mobject_or_point, direction=ORIGIN):
1141
1146
horizontally so that it's center is directly above/below
1142
1147
the center of mob2
1143
1148
"""
1144
- if isinstance (mobject_or_point , Mobject ):
1149
+ if isinstance (mobject_or_point , OpenGLMobject ):
1145
1150
point = mobject_or_point .get_bounding_box_point (direction )
1146
1151
else :
1147
1152
point = mobject_or_point
0 commit comments