Use passed value 'to' for mode change rather than accessing this.mode (as other getters may be in the way). Partly for #362

This commit is contained in:
rgthree
2024-11-05 23:09:30 -05:00
parent 6f82a5c72f
commit 8df5e33109
4 changed files with 13 additions and 6 deletions
+2 -1
View File
@@ -103,7 +103,8 @@ class NodeModeRelay extends BaseCollectorNode {
if (this.inputs.length <= 1 && !this.isInputConnected(0) && this.isAnyOutputConnected()) {
const [n, v] = logger.infoParts(`Mode change without any inputs; relaying our mode.`);
console[n]?.(...v);
this.dispatchModeToRepeater(this.mode);
// Pass "to" since there may be other getters in the way to access this.mode directly.
this.dispatchModeToRepeater(to);
}
}
+6 -2
View File
@@ -167,7 +167,8 @@ class NodeModeRepeater extends BaseCollectorNode {
if (linkedNodes.length) {
for (const node of linkedNodes) {
if (node.type !== NodeTypesString.NODE_MODE_RELAY) {
node.mode = this.mode;
// Use "to" as there may be other getters in the way to access this.mode directly.
node.mode = to;
}
}
} else if (app.graph._groups?.length) {
@@ -176,7 +177,10 @@ class NodeModeRepeater extends BaseCollectorNode {
group.recomputeInsideNodes();
if (group._nodes?.includes(this)) {
for (const node of group._nodes) {
node.mode = this.mode;
if (node !== this) {
// Use "to" as there may be other getters in the way to access this.mode directly.
node.mode = to;
}
}
}
}
+1 -1
View File
@@ -55,7 +55,7 @@ class NodeModeRelay extends BaseCollectorNode {
if (this.inputs.length <= 1 && !this.isInputConnected(0) && this.isAnyOutputConnected()) {
const [n, v] = logger.infoParts(`Mode change without any inputs; relaying our mode.`);
(_a = console[n]) === null || _a === void 0 ? void 0 : _a.call(console, ...v);
this.dispatchModeToRepeater(this.mode);
this.dispatchModeToRepeater(to);
}
}
configure(info) {
+4 -2
View File
@@ -100,7 +100,7 @@ class NodeModeRepeater extends BaseCollectorNode {
if (linkedNodes.length) {
for (const node of linkedNodes) {
if (node.type !== NodeTypesString.NODE_MODE_RELAY) {
node.mode = this.mode;
node.mode = to;
}
}
}
@@ -109,7 +109,9 @@ class NodeModeRepeater extends BaseCollectorNode {
group.recomputeInsideNodes();
if ((_b = group._nodes) === null || _b === void 0 ? void 0 : _b.includes(this)) {
for (const node of group._nodes) {
node.mode = this.mode;
if (node !== this) {
node.mode = to;
}
}
}
}