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,
LinearElementEditor,
newElementWith,
getHoveredElementForBinding,
} from "@excalidraw/element";
import {
@@ -229,21 +228,10 @@ export const actionFinalize = register<FormData>({
element.type !== "freedraw" &&
appState.lastPointerDownWith !== "touch"
) {
const { x: rx, y: ry, 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,
);
const { points, lastCommittedPoint } = element;
if (
!hoveredElementForBinding &&
(!lastCommittedPoint ||
points[points.length - 1] !== lastCommittedPoint)
!lastCommittedPoint ||
points[points.length - 1] !== lastCommittedPoint
) {
scene.mutateElement(element, {
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
if (
hoveredElementForBinding ||
(isBindingElement(multiElement) && hoveredElementForBinding) ||
(multiElement.points.length > 1 &&
lastCommittedPoint &&
pointDistance(