mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 11:11:53 +00:00
Try connecting to snapped first
This commit is contained in:
@@ -455,12 +455,28 @@ export function useSlotLinkInteraction({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const candidate = candidateFromTarget(event.target)
|
// Prefer using the snapped candidate captured during hover for perf + consistency
|
||||||
let connected = tryConnectToCandidate(candidate)
|
const snappedCandidate = state.candidate?.compatible
|
||||||
|
? state.candidate
|
||||||
|
: null
|
||||||
|
|
||||||
|
let connected = tryConnectToCandidate(snappedCandidate)
|
||||||
|
|
||||||
|
// Fallback to DOM slot under pointer (if any), then node fallback, then reroute
|
||||||
|
if (!connected) {
|
||||||
|
const domCandidate = candidateFromTarget(event.target)
|
||||||
|
connected = tryConnectToCandidate(domCandidate)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!connected) {
|
||||||
|
const nodeCandidate = candidateFromNodeTarget(event.target)
|
||||||
|
connected = tryConnectToCandidate(nodeCandidate)
|
||||||
|
}
|
||||||
|
|
||||||
if (!connected) connected = tryConnectViaRerouteAtPointer() || connected
|
if (!connected) connected = tryConnectViaRerouteAtPointer() || connected
|
||||||
|
|
||||||
// Drop on canvas: disconnect moving input link(s)
|
// Drop on canvas: disconnect moving input link(s)
|
||||||
if (!connected && !candidate && state.source.type === 'input') {
|
if (!connected && !snappedCandidate && state.source.type === 'input') {
|
||||||
ensureActiveAdapter()?.disconnectMovingLinks()
|
ensureActiveAdapter()?.disconnectMovingLinks()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user