fix(editor): block an elbow arrow's start on the grid like its end

The grid router blocked the true end point when the end had an element
(bound, or hovered while dragging), but the true start point only when
the arrow's previous startBinding was set. That ignored binding changes
in the update, and the unbound sub-arrows routed when releasing a fixed
segment. Use the start's element like for the end.

There's no visible effect in practice: the endpoints are rarely on the
grid themselves (only their dongles are).

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
Mark Tolmacs committed 2026-11-19 16:39:36 +00:00
1 parent dbd5e49287
commit 6dc7e5adff
1 file changed
+17 -17
+17 -17
View File
@@ -646,7 +646,7 @@ export const getElbowArrowRoute = (
getCornerPoints(
removeShortSegments(
getSimpleRoute(arrow, elbowArrowData, elementsMap) ??
getGridRoute(arrow, elbowArrowData) ??
getGridRoute(elbowArrowData) ??
[],
),
);
@@ -777,20 +777,18 @@ const getSimpleRoute = (
* The elbow arrow's route on the grid, keeping a padding around the elements
* it connects, or null if there's none
*/
const getGridRoute = (
arrow: ElbowArrowState,
{
dynamicAABBs,
startDonglePosition,
startGlobalPoint,
startHeading,
endDonglePosition,
endGlobalPoint,
endHeading,
commonBounds,
hoveredEndElement,
}: ElbowArrowData,
): GlobalPoint[] | null => {
const getGridRoute = ({
dynamicAABBs,
startDonglePosition,
startGlobalPoint,
startHeading,
endDonglePosition,
endGlobalPoint,
endHeading,
commonBounds,
hoveredStartElement,
hoveredEndElement,
}: ElbowArrowData): GlobalPoint[] | null => {
const grid = calculateGrid(
dynamicAABBs,
startDonglePosition,
@@ -803,13 +801,15 @@ const getGridRoute = (
const startDongle = pointToGridNode(startDonglePosition, grid);
const endDongle = pointToGridNode(endDonglePosition, grid);
// Do not allow stepping on the true end or true start points
// Do not allow stepping on the true end or true start points of bound
// endpoints (if they're on the grid at all, as usually only their dongles
// are)
const endNode = pointToGridNode(endGlobalPoint, grid);
if (endNode && hoveredEndElement) {
endNode.closed = true;
}
const startNode = pointToGridNode(startGlobalPoint, grid);
if (startNode && arrow.startBinding) {
if (startNode && hoveredStartElement) {
startNode.closed = true;
}