mirror of
https://github.com/excalidraw/excalidraw.git
synced 2026-11-21 13:34:11 +03:00
fix: do not finalize multi-point lines if binding not enabled (#10410)
* fix: do not finalize multi-point lines if binding not enabled * refactor
This commit is contained in:
1 parent
019ce4c52c
commit
210dc85c8c
1 file changed
+21
-16
@@ -6396,12 +6396,15 @@ class App extends React.Component<AppProps, AppState> {
|
||||
setCursorForShape(this.interactiveCanvas, this.state);
|
||||
|
||||
if (lastPoint === lastCommittedPoint) {
|
||||
const hoveredElement = getHoveredElementForBinding(
|
||||
pointFrom<GlobalPoint>(scenePointerX, scenePointerY),
|
||||
this.scene.getNonDeletedElements(),
|
||||
this.scene.getNonDeletedElementsMap(),
|
||||
(el) => maxBindingDistance_simple(this.state.zoom),
|
||||
);
|
||||
const hoveredElement =
|
||||
isArrowElement(this.state.newElement) &&
|
||||
isBindingEnabled(this.state) &&
|
||||
getHoveredElementForBinding(
|
||||
pointFrom<GlobalPoint>(scenePointerX, scenePointerY),
|
||||
this.scene.getNonDeletedElements(),
|
||||
this.scene.getNonDeletedElementsMap(),
|
||||
(el) => maxBindingDistance_simple(this.state.zoom),
|
||||
);
|
||||
if (hoveredElement) {
|
||||
this.actionManager.executeAction(actionFinalize, "ui", {
|
||||
event: event.nativeEvent,
|
||||
@@ -8464,16 +8467,18 @@ class App extends React.Component<AppProps, AppState> {
|
||||
const { x: rx, y: ry } = multiElement;
|
||||
const { lastCommittedPoint } = selectedLinearElement;
|
||||
|
||||
const hoveredElementForBinding = getHoveredElementForBinding(
|
||||
pointFrom<GlobalPoint>(
|
||||
this.lastPointerMoveCoords?.x ??
|
||||
rx + multiElement.points[multiElement.points.length - 1][0],
|
||||
this.lastPointerMoveCoords?.y ??
|
||||
ry + multiElement.points[multiElement.points.length - 1][1],
|
||||
),
|
||||
this.scene.getNonDeletedElements(),
|
||||
this.scene.getNonDeletedElementsMap(),
|
||||
);
|
||||
const hoveredElementForBinding =
|
||||
isBindingEnabled(this.state) &&
|
||||
getHoveredElementForBinding(
|
||||
pointFrom<GlobalPoint>(
|
||||
this.lastPointerMoveCoords?.x ??
|
||||
rx + multiElement.points[multiElement.points.length - 1][0],
|
||||
this.lastPointerMoveCoords?.y ??
|
||||
ry + multiElement.points[multiElement.points.length - 1][1],
|
||||
),
|
||||
this.scene.getNonDeletedElements(),
|
||||
this.scene.getNonDeletedElementsMap(),
|
||||
);
|
||||
|
||||
// clicking inside commit zone → finalize arrow
|
||||
if (
|
||||
|
||||
Reference in new issue
Block a user