mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-09 18:40:08 +02:00
Do not trigger arrow binding for linear elements
This commit is contained in:
@@ -2,6 +2,7 @@ import { pointFrom } from "@excalidraw/math";
|
|||||||
|
|
||||||
import { bindOrUnbindBindingElement } from "@excalidraw/element/binding";
|
import { bindOrUnbindBindingElement } from "@excalidraw/element/binding";
|
||||||
import {
|
import {
|
||||||
|
isSimpleArrow,
|
||||||
isValidPolygon,
|
isValidPolygon,
|
||||||
LinearElementEditor,
|
LinearElementEditor,
|
||||||
newElementWith,
|
newElementWith,
|
||||||
@@ -83,28 +84,30 @@ export const actionFinalize = register<FormData>({
|
|||||||
app.scene,
|
app.scene,
|
||||||
);
|
);
|
||||||
|
|
||||||
const newArrow = !appState.selectedLinearElement?.selectedPointsIndices;
|
if (isSimpleArrow(element)) {
|
||||||
|
const newArrow = !appState.selectedLinearElement?.selectedPointsIndices;
|
||||||
|
|
||||||
const selectedPointsIndices = newArrow
|
const selectedPointsIndices = newArrow
|
||||||
? [element.points.length - 1] // New arrow creation
|
? [element.points.length - 1] // New arrow creation
|
||||||
: appState.selectedLinearElement.selectedPointsIndices;
|
: appState.selectedLinearElement.selectedPointsIndices;
|
||||||
|
|
||||||
const draggedPoints: PointsPositionUpdates =
|
const draggedPoints: PointsPositionUpdates =
|
||||||
selectedPointsIndices.reduce((map, index) => {
|
selectedPointsIndices.reduce((map, index) => {
|
||||||
map.set(index, {
|
map.set(index, {
|
||||||
point: LinearElementEditor.pointFromAbsoluteCoords(
|
point: LinearElementEditor.pointFromAbsoluteCoords(
|
||||||
element,
|
element,
|
||||||
pointFrom<GlobalPoint>(sceneCoords.x, sceneCoords.y),
|
pointFrom<GlobalPoint>(sceneCoords.x, sceneCoords.y),
|
||||||
elementsMap,
|
elementsMap,
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
}, new Map()) ?? new Map();
|
}, new Map()) ?? new Map();
|
||||||
|
|
||||||
bindOrUnbindBindingElement(element, draggedPoints, scene, appState, {
|
bindOrUnbindBindingElement(element, draggedPoints, scene, appState, {
|
||||||
newArrow,
|
newArrow,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (linearElementEditor !== appState.selectedLinearElement) {
|
if (linearElementEditor !== appState.selectedLinearElement) {
|
||||||
// `handlePointerUp()` updated the linear element instance,
|
// `handlePointerUp()` updated the linear element instance,
|
||||||
|
Reference in New Issue
Block a user