fix: Mid-point for rounded linears are not precisely centered (#9544)

This commit is contained in:
Márk Tolmács
2025-06-12 21:08:37 +02:00
committed by GitHub
parent 9f3fdf5505
commit f0458cc216
21 changed files with 609 additions and 661 deletions

View File

@@ -22,7 +22,7 @@ import type { GlobalPoint, LineSegment, Radians } from "@excalidraw/math";
import type { FrameNameBounds } from "@excalidraw/excalidraw/types";
import { isPathALoop } from "./shapes";
import { isPathALoop } from "./utils";
import {
type Bounds,
doBoundsIntersect,
@@ -250,25 +250,16 @@ export const intersectElementWithLineSegment = (
case "line":
case "freedraw":
case "arrow":
return intersectLinearOrFreeDrawWithLineSegment(
element,
elementsMap,
line,
onlyFirst,
);
return intersectLinearOrFreeDrawWithLineSegment(element, line, onlyFirst);
}
};
const intersectLinearOrFreeDrawWithLineSegment = (
element: ExcalidrawLinearElement | ExcalidrawFreeDrawElement,
elementsMap: ElementsMap,
segment: LineSegment<GlobalPoint>,
onlyFirst = false,
): GlobalPoint[] => {
const [lines, curves] = deconstructLinearOrFreeDrawElement(
element,
elementsMap,
);
const [lines, curves] = deconstructLinearOrFreeDrawElement(element);
const intersections = [];
for (const l of lines) {