mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Okay, actually fix Arrow
This commit is contained in:
parent
86fb1d82f5
commit
746b52cda5
1 changed files with 7 additions and 6 deletions
|
@ -685,7 +685,6 @@ class Arrow(Line):
|
||||||
self.width_to_tip_len = width_to_tip_len
|
self.width_to_tip_len = width_to_tip_len
|
||||||
self.max_tip_length_to_length_ratio = max_tip_length_to_length_ratio
|
self.max_tip_length_to_length_ratio = max_tip_length_to_length_ratio
|
||||||
self.max_width_to_length_ratio = max_width_to_length_ratio
|
self.max_width_to_length_ratio = max_width_to_length_ratio
|
||||||
self.max_stroke_width = stroke_width
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
start, end,
|
start, end,
|
||||||
stroke_color=stroke_color,
|
stroke_color=stroke_color,
|
||||||
|
@ -716,7 +715,7 @@ class Arrow(Line):
|
||||||
alpha = tip_len / arc_len
|
alpha = tip_len / arc_len
|
||||||
self.pointwise_become_partial(self, 0, 1 - alpha)
|
self.pointwise_become_partial(self, 0, 1 - alpha)
|
||||||
# Dumb that this is needed
|
# Dumb that this is needed
|
||||||
self.start_new_path(self.point_from_proportion(0.99))
|
self.start_new_path(self.point_from_proportion(1 - 1e-5))
|
||||||
self.add_line_to(prev_end)
|
self.add_line_to(prev_end)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
@ -728,6 +727,7 @@ class Arrow(Line):
|
||||||
float(self.get_stroke_width()),
|
float(self.get_stroke_width()),
|
||||||
self.max_width_to_length_ratio * self.get_length(),
|
self.max_width_to_length_ratio * self.get_length(),
|
||||||
)
|
)
|
||||||
|
self.data['stroke_width'][:-3] = self.data['stroke_width'][0]
|
||||||
self.data['stroke_width'][-3:, 0] = tip_width * np.linspace(1, 0, 3)
|
self.data['stroke_width'][-3:, 0] = tip_width * np.linspace(1, 0, 3)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
@ -745,13 +745,14 @@ class Arrow(Line):
|
||||||
*args, **kwargs
|
*args, **kwargs
|
||||||
):
|
):
|
||||||
super().set_stroke(color=color, width=width, *args, **kwargs)
|
super().set_stroke(color=color, width=width, *args, **kwargs)
|
||||||
if isinstance(width, numbers.Number):
|
if self.has_points():
|
||||||
self.max_stroke_width = width
|
self.reset_tip()
|
||||||
self.create_tip_with_stroke_width()
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def _handle_scale_side_effects(self, scale_factor: float):
|
def _handle_scale_side_effects(self, scale_factor: float):
|
||||||
return self.reset_tip()
|
if scale_factor != 1.0:
|
||||||
|
self.reset_tip()
|
||||||
|
return self
|
||||||
|
|
||||||
|
|
||||||
class FillArrow(Line):
|
class FillArrow(Line):
|
||||||
|
|
Loading…
Add table
Reference in a new issue