feat(core): add clickConnectStart & clickConnectEnd events

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-04-03 08:53:33 +02:00
committed by Braks
parent 707aaef535
commit 5a50cfd90b
4 changed files with 21 additions and 4 deletions
+8 -3
View File
@@ -184,9 +184,10 @@ export default function useHandle({
function onPointerUp(event: MouseTouchEvent) {
if ((prevClosestHandle || handleDomNode) && connection && isValid) {
if (!onEdgeUpdate) {
emits.connect(connection)
} else {
onEdgeUpdate(event, connection)
emits.connect(connection)
} else {
onEdgeUpdate(event, connection)
}
}
}
@@ -227,6 +228,8 @@ export default function useHandle({
}
if (!connectionClickStartHandle.value) {
emits.clickConnectStart({ event, nodeId, handleId })
startConnection({ nodeId: unref(nodeId), type: unref(type), handleId: unref(handleId) }, undefined, event, true)
} else {
let isValidConnectionHandler = isValidConnection || isValidConnectionProp.value || alwaysValid
@@ -266,6 +269,8 @@ export default function useHandle({
emits.connect(connection)
}
emits.clickConnectEnd(event)
endConnection(event, true)
}
}