mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Small fixes
This commit is contained in:
parent
68255b1c9a
commit
b3dec3fd51
1 changed files with 4 additions and 14 deletions
|
@ -144,24 +144,14 @@ class VMobject(Mobject):
|
||||||
def __getitem__(self, value: int | slice) -> VMobject:
|
def __getitem__(self, value: int | slice) -> VMobject:
|
||||||
return super().__getitem__(value)
|
return super().__getitem__(value)
|
||||||
|
|
||||||
|
def __iter__(self) -> Iterable[VMobject]:
|
||||||
|
return super().__iter__()
|
||||||
|
|
||||||
def add(self, *vmobjects: VMobject):
|
def add(self, *vmobjects: VMobject):
|
||||||
if not all((isinstance(m, VMobject) for m in vmobjects)):
|
if not all((isinstance(m, VMobject) for m in vmobjects)):
|
||||||
raise Exception("All submobjects must be of type VMobject")
|
raise Exception("All submobjects must be of type VMobject")
|
||||||
super().add(*vmobjects)
|
super().add(*vmobjects)
|
||||||
|
|
||||||
def add_background_rectangle(
|
|
||||||
self,
|
|
||||||
color: ManimColor | None = None,
|
|
||||||
opacity: float = 0.75,
|
|
||||||
**kwargs
|
|
||||||
):
|
|
||||||
normal = self.family_members_with_points()[0].get_unit_normal()
|
|
||||||
super().add_background_rectangle(color, opacity, **kwargs)
|
|
||||||
rect = self.background_rectangle
|
|
||||||
if np.dot(rect.get_unit_normal(), normal) < 0:
|
|
||||||
rect.reverse_points()
|
|
||||||
return self
|
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
def init_colors(self):
|
def init_colors(self):
|
||||||
self.set_fill(
|
self.set_fill(
|
||||||
|
@ -459,7 +449,7 @@ class VMobject(Mobject):
|
||||||
def use_winding_fill(self, value: bool = True, recurse: bool = True):
|
def use_winding_fill(self, value: bool = True, recurse: bool = True):
|
||||||
for submob in self.get_family(recurse):
|
for submob in self.get_family(recurse):
|
||||||
submob._use_winding_fill = value
|
submob._use_winding_fill = value
|
||||||
if not value:
|
if not value and submob.has_points():
|
||||||
submob.subdivide_intersections()
|
submob.subdivide_intersections()
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue