diff --git a/src_web/comfyui/base_node.ts b/src_web/comfyui/base_node.ts index 6f6d03a..3868833 100644 --- a/src_web/comfyui/base_node.ts +++ b/src_web/comfyui/base_node.ts @@ -7,6 +7,7 @@ import type { ContextMenuItem, INodeOutputSlot, INodeInputSlot, + Vector2, } from "typings/litegraph.js"; import type { RgthreeBaseServerNodeConstructor, RgthreeBaseVirtualNodeConstructor } from "typings/rgthree.js"; @@ -317,6 +318,12 @@ export class RgthreeBaseServerNode extends RgthreeBaseNode { return ComfyWidgets; } + override computeSize(out?: Vector2): [number, number] { + const v = super.computeSize(out); + console.log('comuteSize', v); + return v; + } + /** * This takes the server data and builds out the inputs, outputs and widgets. It's similar to the * ComfyNode constructor in registerNodes in ComfyUI's app.js, but is more stable and thus @@ -396,8 +403,12 @@ export class RgthreeBaseServerNode extends RgthreeBaseNode { } const s = this.computeSize(); - s[0] = Math.max(config.minWidth, s[0] * 1.5); - s[1] = Math.max(config.minHeight, s[1]); + // Sometime around v1.12.6 this broke as `minWidth` and `minHeight` were being explicitly set + // to `undefined` in the above Object.assign call (specifically for `WIDGETS[INT]`. We can avoid + // that by ensureing we're at a number in that case. + // See https://github.com/Comfy-Org/ComfyUI_frontend/issues/3045 + s[0] = Math.max(config.minWidth ?? 1, s[0] * 1.5); + s[1] = Math.max(config.minHeight ?? 1, s[1]); this.size = s; this.serialize_widgets = true; } diff --git a/web/comfyui/base_node.js b/web/comfyui/base_node.js index 7949ae8..874c0c9 100644 --- a/web/comfyui/base_node.js +++ b/web/comfyui/base_node.js @@ -193,8 +193,13 @@ export class RgthreeBaseServerNode extends RgthreeBaseNode { getWidgets() { return ComfyWidgets; } + computeSize(out) { + const v = super.computeSize(out); + console.log('comuteSize', v); + return v; + } async setupFromServerNodeData() { - var _a, _b, _c; + var _a, _b, _c, _d, _e; const nodeData = this.constructor.nodeData; if (!nodeData) { throw Error("No node data"); @@ -254,8 +259,8 @@ export class RgthreeBaseServerNode extends RgthreeBaseNode { this.addOutput(outputName, output, { shape: outputShape }); } const s = this.computeSize(); - s[0] = Math.max(config.minWidth, s[0] * 1.5); - s[1] = Math.max(config.minHeight, s[1]); + s[0] = Math.max((_d = config.minWidth) !== null && _d !== void 0 ? _d : 1, s[0] * 1.5); + s[1] = Math.max((_e = config.minHeight) !== null && _e !== void 0 ? _e : 1, s[1]); this.size = s; this.serialize_widgets = true; }