fix: Tighten curve index in linear sampling

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
Mark Tolmacs committed 2026-09-18 12:18:00 +02:00
1 parent 94d5e43f0b
commit 99150ea161
1 file changed
+6 -1
+6 -1
View File
@@ -834,6 +834,11 @@ export class LinearElementEditor {
let index = 0;
const midpoints: (GlobalPoint | null)[] = [];
while (index < points.length - 1) {
// Elbow arrows route around obstacles, so their deconstructed geometry
// can have fewer segments than there are point pairs. Suppress the
// midpoint handle for those extra pairs (no segment exists to place it
// on). For non-elbow lines/arrows segmentCount === points.length - 1, so
// this never fires.
if (segmentCount > 0 && index >= segmentCount) {
midpoints.push(null);
index++;
@@ -969,7 +974,7 @@ export class LinearElementEditor {
"Only linears built out of curves are supported",
);
invariant(
lines.length + curves.length >= index,
curves.length > index,
"Invalid segment index while calculating mid point",
);