mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-11-15 02:04:21 +01:00
fix: Use last point for existing arrows
This commit is contained in:
@@ -685,10 +685,10 @@ const getBindingStrategyForDraggingBindingElementEndpoints_simple = (
|
|||||||
|
|
||||||
// Handle outside-outside binding to the same element
|
// Handle outside-outside binding to the same element
|
||||||
if (otherBinding && otherBinding.elementId === hit?.id) {
|
if (otherBinding && otherBinding.elementId === hit?.id) {
|
||||||
const [startFixedPoint, endFixedPoint] = getGlobalFixedPoints(
|
// const [startFixedPoint, endFixedPoint] = getGlobalFixedPoints(
|
||||||
arrow,
|
// arrow,
|
||||||
elementsMap,
|
// elementsMap,
|
||||||
);
|
// );
|
||||||
|
|
||||||
invariant(
|
invariant(
|
||||||
!opts?.newArrow || appState.selectedLinearElement?.initialState.origin,
|
!opts?.newArrow || appState.selectedLinearElement?.initialState.origin,
|
||||||
@@ -704,12 +704,22 @@ const getBindingStrategyForDraggingBindingElementEndpoints_simple = (
|
|||||||
: // NOTE: Can only affect the start point because new arrows always drag the end point
|
: // NOTE: Can only affect the start point because new arrows always drag the end point
|
||||||
opts?.newArrow
|
opts?.newArrow
|
||||||
? appState.selectedLinearElement!.initialState.origin!
|
? appState.selectedLinearElement!.initialState.origin!
|
||||||
: startFixedPoint,
|
: LinearElementEditor.getPointAtIndexGlobalCoordinates(
|
||||||
|
arrow,
|
||||||
|
0,
|
||||||
|
elementsMap,
|
||||||
|
), // startFixedPoint,
|
||||||
},
|
},
|
||||||
end: {
|
end: {
|
||||||
mode: "inside",
|
mode: "inside",
|
||||||
element: hit,
|
element: hit,
|
||||||
focusPoint: endDragged ? globalPoint : endFixedPoint,
|
focusPoint: endDragged
|
||||||
|
? globalPoint
|
||||||
|
: LinearElementEditor.getPointAtIndexGlobalCoordinates(
|
||||||
|
arrow,
|
||||||
|
-1,
|
||||||
|
elementsMap,
|
||||||
|
), // endFixedPoint
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import {
|
import {
|
||||||
debugDrawLine,
|
|
||||||
DEFAULT_ADAPTIVE_RADIUS,
|
DEFAULT_ADAPTIVE_RADIUS,
|
||||||
DEFAULT_PROPORTIONAL_RADIUS,
|
DEFAULT_PROPORTIONAL_RADIUS,
|
||||||
invariant,
|
invariant,
|
||||||
@@ -32,9 +31,9 @@ import { elementCenterPoint, getDiamondPoints } from "./bounds";
|
|||||||
|
|
||||||
import { generateLinearCollisionShape } from "./shape";
|
import { generateLinearCollisionShape } from "./shape";
|
||||||
|
|
||||||
|
import { isPointInElement } from "./collision";
|
||||||
import { LinearElementEditor } from "./linearElementEditor";
|
import { LinearElementEditor } from "./linearElementEditor";
|
||||||
import { isRectangularElement } from "./typeChecks";
|
import { isRectangularElement } from "./typeChecks";
|
||||||
import { isPointInElement } from "./collision";
|
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
ElementsMap,
|
ElementsMap,
|
||||||
@@ -599,9 +598,9 @@ export const projectFixedPointOntoDiagonal = (
|
|||||||
p = p1 || p2 || null;
|
p = p1 || p2 || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
debugDrawLine(diagonalOne, { color: "purple", permanent: true });
|
// debugDrawLine(diagonalOne, { color: "purple", permanent: true });
|
||||||
debugDrawLine(diagonalTwo, { color: "purple", permanent: true });
|
// debugDrawLine(diagonalTwo, { color: "purple", permanent: true });
|
||||||
debugDrawLine(intersector, { color: "orange", permanent: true });
|
// debugDrawLine(intersector, { color: "orange", permanent: true });
|
||||||
|
|
||||||
return p && isPointInElement(p, element, elementsMap) ? p : null;
|
return p && isPointInElement(p, element, elementsMap) ? p : null;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user