Fix incorrect scope for Display Int node. Fixes #13
This commit is contained in:
+5
-5
@@ -5,14 +5,13 @@ app.registerExtension({
|
||||
name: "rgthree.DisplayInt",
|
||||
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
||||
if (nodeData.name === "Display Int (rgthree)") {
|
||||
let showValueWidget;
|
||||
nodeType.title_mode = LiteGraph.NO_TITLE;
|
||||
const onNodeCreated = nodeType.prototype.onNodeCreated;
|
||||
nodeType.prototype.onNodeCreated = function () {
|
||||
onNodeCreated ? onNodeCreated.apply(this, []) : undefined;
|
||||
showValueWidget = ComfyWidgets["STRING"](this, "output", ["STRING", { multiline: true }], app).widget;
|
||||
showValueWidget.inputEl.readOnly = true;
|
||||
showValueWidget.serializeValue = async (node, index) => {
|
||||
this.showValueWidget = ComfyWidgets["STRING"](this, "output", ["STRING", { multiline: true }], app).widget;
|
||||
this.showValueWidget.inputEl.readOnly = true;
|
||||
this.showValueWidget.serializeValue = async (node, index) => {
|
||||
node.widgets_values[index] = '';
|
||||
return '';
|
||||
};
|
||||
@@ -20,8 +19,9 @@ app.registerExtension({
|
||||
addConnectionLayoutSupport(nodeType, app, [['Left'], ['Right']]);
|
||||
const onExecuted = nodeType.prototype.onExecuted;
|
||||
nodeType.prototype.onExecuted = function (message) {
|
||||
var _a;
|
||||
onExecuted === null || onExecuted === void 0 ? void 0 : onExecuted.apply(this, [message]);
|
||||
showValueWidget.value = message.text[0];
|
||||
(_a = this.showValueWidget) === null || _a === void 0 ? void 0 : _a.value = message.text[0];
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
+4
-5
@@ -14,7 +14,6 @@ app.registerExtension({
|
||||
name: "rgthree.DisplayInt",
|
||||
async beforeRegisterNodeDef(nodeType: typeof LGraphNode, nodeData: ComfyObjectInfo, app: ComfyApp) {
|
||||
if (nodeData.name === "Display Int (rgthree)") {
|
||||
let showValueWidget!: ComfyWidget;
|
||||
|
||||
(nodeType as any).title_mode = LiteGraph.NO_TITLE;
|
||||
|
||||
@@ -22,9 +21,9 @@ app.registerExtension({
|
||||
nodeType.prototype.onNodeCreated = function () {
|
||||
onNodeCreated ? onNodeCreated.apply(this, []) : undefined;
|
||||
|
||||
showValueWidget = ComfyWidgets["STRING"](this, "output", ["STRING", { multiline: true }], app).widget;
|
||||
showValueWidget.inputEl!.readOnly = true;
|
||||
showValueWidget.serializeValue = async (node: SerializedLGraphNode, index: number) => {
|
||||
(this as any).showValueWidget = ComfyWidgets["STRING"](this, "output", ["STRING", { multiline: true }], app).widget;
|
||||
(this as any).showValueWidget.inputEl!.readOnly = true;
|
||||
(this as any).showValueWidget.serializeValue = async (node: SerializedLGraphNode, index: number) => {
|
||||
// Since we need a round trip to get the value, the serizalized value means nothing, and
|
||||
// saving it to the metadata would just be confusing. So, we clear it here.
|
||||
node.widgets_values![index] = '';
|
||||
@@ -37,7 +36,7 @@ app.registerExtension({
|
||||
const onExecuted = nodeType.prototype.onExecuted;
|
||||
nodeType.prototype.onExecuted = function (message) {
|
||||
onExecuted?.apply(this, [message]);
|
||||
showValueWidget.value = message.text[0];
|
||||
(this as any).showValueWidget?.value = message.text[0];
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user