Update jsnodes.js

This commit is contained in:
kijai 2024-04-25 20:32:50 +03:00
parent f2dd09aa12
commit 501c1df1bc

View File

@ -177,14 +177,13 @@ app.registerExtension({
// to keep Set/Get node virtual connections visible when offscreen // to keep Set/Get node virtual connections visible when offscreen
const originalComputeVisibleNodes = LGraphCanvas.prototype.computeVisibleNodes; const originalComputeVisibleNodes = LGraphCanvas.prototype.computeVisibleNodes;
LGraphCanvas.prototype.computeVisibleNodes = function (nodes, out) { LGraphCanvas.prototype.computeVisibleNodes = function (nodes, out) {
const visibleNodes = originalComputeVisibleNodes.apply(this, arguments); const visibleNodesSet = new Set(originalComputeVisibleNodes.apply(this, arguments));
const setAndGetNodes = this.graph._nodes.filter(node => node.type === "SetNode" || node.type === "GetNode"); for (const node of this.graph._nodes) {
for (const node of setAndGetNodes) { if ((node.type === "SetNode" || node.type === "GetNode") && node.drawConnection) {
if (!visibleNodes.includes(node) && node.drawConnection) { visibleNodesSet.add(node);
visibleNodes.push(node);
} }
} }
return visibleNodes; return Array.from(visibleNodesSet);
}; };
}, },
}); });