mirror of
https://github.com/3b1b/manim.git
synced 2025-08-01 08:54:38 +08:00
First page of chapter 5
This commit is contained in:
@ -189,6 +189,7 @@ class Bubble(SVGMobject):
|
||||
self.stretch_to_fit_width(self.width)
|
||||
if self.direction[0] > 0:
|
||||
Mobject.flip(self)
|
||||
self.direction_was_specified = ("direction" in kwargs)
|
||||
self.content = Mobject()
|
||||
|
||||
def get_tip(self):
|
||||
@ -207,9 +208,11 @@ class Bubble(SVGMobject):
|
||||
self.direction = -np.array(self.direction)
|
||||
return self
|
||||
|
||||
def pin_to(self, mobject, allow_flipping = True):
|
||||
def pin_to(self, mobject):
|
||||
mob_center = mobject.get_center()
|
||||
if np.sign(mob_center[0]) != np.sign(self.direction[0]) and allow_flipping:
|
||||
want_to_filp = np.sign(mob_center[0]) != np.sign(self.direction[0])
|
||||
can_flip = not self.direction_was_specified
|
||||
if want_to_filp and can_flip:
|
||||
self.flip()
|
||||
boundary_point = mobject.get_critical_point(UP-self.direction)
|
||||
vector_from_center = 1.0*(boundary_point-mob_center)
|
||||
|
Reference in New Issue
Block a user