fix(core): use whole handle for snapping area (#1843)

* chore(changeset): add

* fix(core): use whole handle for snapping area

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>

---------

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2025-05-15 17:55:14 +02:00
parent 666e4eabab
commit 735c81c63f
3 changed files with 18 additions and 5 deletions

View File

@@ -163,6 +163,7 @@ export function useHandle({
id: toValue(handleId),
type: handleType,
position: (clickedHandle?.getAttribute('data-handlepos') as Position) || Position.Top,
...connectionPosition,
},
{
x: x - containerBounds.left,
@@ -217,8 +218,8 @@ export function useHandle({
...previousConnection,
isValid,
to:
closestHandle && isValid
? rendererPointToPoint({ x: closestHandle.x, y: closestHandle.y }, viewport.value)
result.toHandle && isValid
? rendererPointToPoint({ x: result.toHandle.x, y: result.toHandle.y }, viewport.value)
: connectionPosition,
toHandle: result.toHandle,
toPosition: isValid && result.toHandle ? result.toHandle.position : oppositePosition[fromHandle.position],
@@ -325,7 +326,13 @@ export function useHandle({
emits.clickConnectStart({ event, nodeId: toValue(nodeId), handleId: toValue(handleId) })
startConnection(
{ nodeId: toValue(nodeId), type: toValue(type), id: toValue(handleId), position: Position.Top },
{
nodeId: toValue(nodeId),
type: toValue(type),
id: toValue(handleId),
position: Position.Top,
...getEventPosition(event),
},
undefined,
true,
)
@@ -355,10 +362,11 @@ export function useHandle({
id: toValue(handleId),
type: toValue(type),
position: Position.Top,
...getEventPosition(event),
},
connectionMode: connectionMode.value,
fromNodeId: connectionClickStartHandle.value.nodeId,
fromHandleId: connectionClickStartHandle.value.id || null,
fromHandleId: connectionClickStartHandle.value.id ?? null,
fromType: connectionClickStartHandle.value.type,
isValidConnection: isValidConnectionHandler,
doc,

View File

@@ -19,7 +19,7 @@ export interface ConnectionHandle extends XYPosition {
nodeId: string
}
export interface ConnectingHandle {
export interface ConnectingHandle extends XYPosition {
nodeId: string
type: HandleType
id?: string | null