mirror of
https://github.com/excalidraw/excalidraw.git
synced 2026-11-29 00:29:42 +03:00
fix: Tighten curve index in linear sampling
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
1 file changed
+6
-1
@@ -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",
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user