From c10842163403fd1c091ccbe279c0a43dea62f54e Mon Sep 17 00:00:00 2001 From: webfiltered <176114999+webfiltered@users.noreply.github.com> Date: Sun, 21 Jul 2024 23:55:03 +1000 Subject: [PATCH] Fix empty input not used when connecting links When dragging a link onto a node, it will always replace the first matching input type, unless you hit the (respectively small) input hit box. This commit fixes that, honouring the intended behaviour (preferFreeSlot is true in internal calls). --- web/lib/litegraph.core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/lib/litegraph.core.js b/web/lib/litegraph.core.js index 427a62b59..7409a4885 100644 --- a/web/lib/litegraph.core.js +++ b/web/lib/litegraph.core.js @@ -4063,7 +4063,7 @@ if (aSource[sI]=="*") aSource[sI] = 0; if (aDest[sI]=="*") aDest[sI] = 0; if (aSource[sI] == aDest[dI]) { - if (preferFreeSlot && aSlots[i].links && aSlots[i].links !== null) continue; + if (preferFreeSlot && (aSlots[i].links && aSlots[i].links !== null) || (aSlots[i].link && aSlots[i].link !== null)) continue; return !returnObj ? i : aSlots[i]; } }