@@ -893,30 +893,11 @@ export const getArrowheadPoints = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (arrowhead === "diamond" || arrowhead === "diamond_outline") {
|
if (arrowhead === "diamond" || arrowhead === "diamond_outline") {
|
||||||
// point opposite to the arrowhead point
|
// point opposite to the arrowhead point — use the same Bezier tangent
|
||||||
let ox;
|
// direction (nx, ny) as the wings so the diamond isn't distorted on
|
||||||
let oy;
|
// rounded arrows where the tangent differs from the chord direction.
|
||||||
|
const ox = tx - nx * minSize * 2;
|
||||||
if (position === "start") {
|
const oy = ty - ny * minSize * 2;
|
||||||
const [px, py] = element.points.length > 1 ? element.points[1] : [0, 0];
|
|
||||||
|
|
||||||
[ox, oy] = pointRotateRads(
|
|
||||||
pointFrom(tx + minSize * 2, ty),
|
|
||||||
pointFrom(tx, ty),
|
|
||||||
Math.atan2(py - ty, px - tx) as Radians,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
const [px, py] =
|
|
||||||
element.points.length > 1
|
|
||||||
? element.points[element.points.length - 2]
|
|
||||||
: [0, 0];
|
|
||||||
|
|
||||||
[ox, oy] = pointRotateRads(
|
|
||||||
pointFrom(tx - minSize * 2, ty),
|
|
||||||
pointFrom(tx, ty),
|
|
||||||
Math.atan2(ty - py, tx - px) as Radians,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return [tx, ty, x3, y3, ox, oy, x4, y4];
|
return [tx, ty, x3, y3, ox, oy, x4, y4];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user