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).
This commit is contained in:
filtered
2024-07-22 01:09:17 +10:00
committed by GitHub
parent 10a30604f4
commit ee0b8a07b6

View File

@@ -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];
}
}