fix: Linear elements

This commit is contained in:
Mark Tolmacs
2025-08-14 11:45:29 +02:00
parent c9f553b78d
commit d47ac63d17
2 changed files with 4 additions and 16 deletions

View File

@@ -6,7 +6,6 @@ import {
isValidPolygon, isValidPolygon,
LinearElementEditor, LinearElementEditor,
newElementWith, newElementWith,
getHoveredElementForBinding,
} from "@excalidraw/element"; } from "@excalidraw/element";
import { import {
@@ -229,21 +228,10 @@ export const actionFinalize = register<FormData>({
element.type !== "freedraw" && element.type !== "freedraw" &&
appState.lastPointerDownWith !== "touch" appState.lastPointerDownWith !== "touch"
) { ) {
const { x: rx, y: ry, points, lastCommittedPoint } = element; const { points, lastCommittedPoint } = element;
const lastGlobalPoint = pointFrom<GlobalPoint>(
rx + points[points.length - 1][0],
ry + points[points.length - 1][1],
);
const hoveredElementForBinding = getHoveredElementForBinding(
lastGlobalPoint,
app.scene.getNonDeletedElements(),
elementsMap,
app.state.zoom,
);
if ( if (
!hoveredElementForBinding && !lastCommittedPoint ||
(!lastCommittedPoint || points[points.length - 1] !== lastCommittedPoint
points[points.length - 1] !== lastCommittedPoint)
) { ) {
scene.mutateElement(element, { scene.mutateElement(element, {
points: element.points.slice(0, -1), points: element.points.slice(0, -1),

View File

@@ -7975,7 +7975,7 @@ class App extends React.Component<AppProps, AppState> {
// clicking inside commit zone → finalize arrow // clicking inside commit zone → finalize arrow
if ( if (
hoveredElementForBinding || (isBindingElement(multiElement) && hoveredElementForBinding) ||
(multiElement.points.length > 1 && (multiElement.points.length > 1 &&
lastCommittedPoint && lastCommittedPoint &&
pointDistance( pointDistance(