From ee0b8a07b607e6dd14caf65bcc2ed68c2f444a53 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Mon, 22 Jul 2024 01:09:17 +1000 Subject: [PATCH] Fix empty input not used when connecting links (#24) When dragging a link onto a node, it will always replace the first matching input type, unless you drop in the (respectively tiny) input hit box. This commit fixes that, honouring the intended behaviour (preferFreeSlot is true in internal calls). --- src/litegraph.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/litegraph.js b/src/litegraph.js index 5892adf64..62a8d571e 100755 --- a/src/litegraph.js +++ b/src/litegraph.js @@ -4059,7 +4059,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]; } }