fix: Arrowheads

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
Mark Tolmacs
2026-03-21 15:46:01 +01:00
parent ae1195a8f2
commit d73f700fa8
2 changed files with 44 additions and 27 deletions
+11 -8
View File
@@ -317,26 +317,29 @@ export const getClosedCurveShape = <Point extends GlobalPoint | LocalPoint>(
};
}
const ops = getCurvePathOps(roughShape);
// Prefer the fillPath set
const fillPathSet = roughShape.sets.find((s) => s.type === "fillPath");
const ops = fillPathSet ? fillPathSet.ops : getCurvePathOps(roughShape);
const points: Point[] = [];
let odd = false;
for (const operation of ops) {
if (operation.op === "move") {
odd = !odd;
if (odd) {
if (fillPathSet) {
// fillPath is always a single run — no odd/even skipping needed
points.push(pointFrom(operation.data[0], operation.data[1]));
} else {
odd = !odd;
if (odd) {
points.push(pointFrom(operation.data[0], operation.data[1]));
}
}
} else if (operation.op === "bcurveTo") {
if (odd) {
if (fillPathSet || odd) {
points.push(pointFrom(operation.data[0], operation.data[1]));
points.push(pointFrom(operation.data[2], operation.data[3]));
points.push(pointFrom(operation.data[4], operation.data[5]));
}
} else if (operation.op === "lineTo") {
if (odd) {
points.push(pointFrom(operation.data[0], operation.data[1]));
}
}
}