Fix a few vectorized mobject tests (#4546)

This commit is contained in:
F. Muenkel 2026-01-30 16:16:05 +01:00 committed by GitHub
commit 53882628c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 15 deletions

View file

@ -690,7 +690,10 @@ class Arrow(Line):
"""Sets stroke width based on length."""
max_ratio = self.max_stroke_width_to_length_ratio
self.set_stroke(
width=min(self.initial_stroke_width, max_ratio * self.get_length()),
width=min(
self.initial_stroke_width,
[max_ratio * self.get_length()] * len(self.initial_stroke_width),
),
recurse=False,
)
return self

View file

@ -221,12 +221,12 @@ class OpenGLVMobject(OpenGLMobject):
def set_stroke(
self,
color=None,
width=None,
opacity=None,
background=None,
recurse=True,
):
color: ParsableManimColor | Sequence[ParsableManimColor] | None = None,
width: float | None = None,
opacity: float | None = None,
background: bool | None = None,
recurse: bool = True,
) -> Self:
for mob in self.get_family(recurse):
if color is not None:
mob.stroke_color = listify(ManimColor.parse(color))
@ -1178,12 +1178,12 @@ class OpenGLVMobject(OpenGLMobject):
path = path_list[n]
# # Check for useless points at the end of the path and remove them
# # https://github.com/ManimCommunity/manim/issues/1959
# while len(path) > nppc:
# # If the last nppc points are all equal to the preceding point
# if self.consider_points_equals(path[-nppc:], path[-nppc - 1]):
# path = path[:-nppc]
# else:
# break
while len(path) > nppc:
# If the last nppc points are all equal to the preceding point
if self.consider_points_equals(path[-nppc:], path[-nppc - 1]):
path = path[:-nppc]
else:
break
return path
for n in range(n_subpaths):

View file

@ -19,8 +19,8 @@ def test_dashed_arrow_tip_not_duplicated_in_group_opacity():
dashed_group = (
VGroup(DashedVMobject(faded_arrow))
.set_fill(opacity=0.4, family=True)
.set_stroke(opacity=0.4, family=True)
.set_fill(opacity=0.4, recurse=True)
.set_stroke(opacity=0.4, recurse=True)
)
tips = _collect_tips(dashed_group)

View file

@ -14,6 +14,7 @@ from manim import (
Square,
VDict,
VGroup,
VMobject,
)
from manim.constants import PI
from manim.mobject.opengl.opengl_vectorized_mobject import OpenGLVMobject