Improve the Shape tool's arrow drawing controls (#3650)

* fixed the arrow's parameters

Signed-off-by: krVatsal <kumarvatsal34@gmail.com>

* shifted the arrow's origin to its tail

Signed-off-by: krVatsal <kumarvatsal34@gmail.com>

* modified arrow shapetype fucntion to be like other shapes

* fixed rust formatting

* Remove misleading part of comment referencing the origin

---------

Signed-off-by: krVatsal <kumarvatsal34@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Vatsal Kumar
2026-02-16 03:05:20 +05:30
committed by GitHub
parent 87739ff877
commit 82f7dc7062
3 changed files with 92 additions and 29 deletions

View File

@@ -330,14 +330,16 @@ impl<PointId: Identifier> Subpath<PointId> {
let head_base_distance = (length - head_length).max(0.);
let head_base = start + direction * head_base_distance;
// Arrow path starts at the tail, traces around the shape, and returns to the tail
let anchors = [
start - perpendicular * half_shaft, // Tail bottom
head_base - perpendicular * half_shaft, // Head base bottom (shaft)
head_base - perpendicular * half_head, // Head base bottom (wide)
end, // Tip
head_base + perpendicular * half_head, // Head base top (wide)
head_base + perpendicular * half_shaft, // Head base top (shaft)
start, // Tail center (origin)
start + perpendicular * half_shaft, // Tail top
head_base + perpendicular * half_shaft, // Head base top (shaft)
head_base + perpendicular * half_head, // Head base top (wide)
end, // Tip
head_base - perpendicular * half_head, // Head base bottom (wide)
head_base - perpendicular * half_shaft, // Head base bottom (shaft)
start - perpendicular * half_shaft, // Tail bottom
];
Self::from_anchors(anchors, true)