fix: Arrow vanishes when orbit binding to the same element

This commit is contained in:
Mark Tolmacs
2025-10-30 18:47:39 +01:00
parent f4ab372ed6
commit 481296efa9
2 changed files with 34 additions and 26 deletions

View File

@@ -434,6 +434,10 @@ const bindingStrategyForSimpleArrowEndpointDragging = (
mode: "inside", mode: "inside",
} }
: { mode: null }; : { mode: null };
other =
finalize && hit && hit.id === oppositeBinding?.elementId
? { mode: null }
: other;
return { current, other }; return { current, other };
} }

View File

@@ -2220,14 +2220,12 @@ const pointDraggingUpdates = (
const startIsDraggingOverEndElement = const startIsDraggingOverEndElement =
element.endBinding && element.endBinding &&
nextArrow.startBinding && nextArrow.startBinding &&
app.state.bindMode === "inside" && startIsDragged &&
endIsDragged &&
nextArrow.startBinding.elementId === element.endBinding.elementId; nextArrow.startBinding.elementId === element.endBinding.elementId;
const endIsDraggingOverStartElement = const endIsDraggingOverStartElement =
element.startBinding && element.startBinding &&
nextArrow.endBinding && nextArrow.endBinding &&
app.state.bindMode === "inside" && endIsDragged &&
startIsDragged &&
element.startBinding.elementId === nextArrow.endBinding.elementId; element.startBinding.elementId === nextArrow.endBinding.elementId;
// We need to update the non-dragged point too if bound, // We need to update the non-dragged point too if bound,
@@ -2238,8 +2236,11 @@ const pointDraggingUpdates = (
nextArrow.endBinding.elementId, nextArrow.endBinding.elementId,
)! as ExcalidrawBindableElement) )! as ExcalidrawBindableElement)
: null; : null;
const endLocalPoint = const endLocalPoint = startIsDraggingOverEndElement
endBindable && !endIsDraggingOverStartElement ? nextArrow.points[nextArrow.points.length - 1]
: endIsDraggingOverStartElement && app.state.bindMode !== "inside"
? nextArrow.points[0]
: endBindable
? updateBoundPoint( ? updateBoundPoint(
nextArrow, nextArrow,
"endBinding", "endBinding",
@@ -2263,8 +2264,11 @@ const pointDraggingUpdates = (
)! as ExcalidrawBindableElement) )! as ExcalidrawBindableElement)
: null; : null;
const startLocalPoint = const startLocalPoint = endIsDraggingOverStartElement
startBindable && startIsDraggingOverEndElement ? nextArrow.points[0]
: startIsDraggingOverEndElement && app.state.bindMode !== "inside"
? nextArrow.points[nextArrow.points.length - 1]
: startBindable
? updateBoundPoint( ? updateBoundPoint(
nextArrow, nextArrow,
"startBinding", "startBinding",