diff --git a/web/js/autosize.js b/web/js/autosize.js index 80882b3..543b85e 100644 --- a/web/js/autosize.js +++ b/web/js/autosize.js @@ -1,23 +1,31 @@ import { app } from '../../../scripts/app.js' -function addResizeHook(node, padding) { +function addResizeHook(node, padding, useOldMin=false) { let origOnCreated = node.onNodeCreated node.onNodeCreated = function() { let r = origOnCreated?.apply(this, arguments) let size = this.computeSize(); size[0] += padding || 0; + if (useOldMin) { + //equal to LiteGraph.NODE_WIDTH*1.5*1.5 + size[0] = Math.max(size[0], 315) + } this.setSize(size); return r } } - app.registerExtension({ name: "AnimateDiffEvolved.autosize", async beforeRegisterNodeDef(nodeType, nodeData, app) { - if (nodeData?.name?.startsWith("ADE_")) { + //since python_module is based off folder path, + //it could be changed by users and should only be used as fallback + if (nodeData?.name?.startsWith("ADE_") + || nodeData.python_module == 'custom_nodes.ComfyUI-AnimateDiff-Evolved') { if (nodeData?.input?.hidden?.autosize) { addResizeHook(nodeType.prototype, nodeData.input.hidden.autosize[1]?.padding) + } else if (!nodeData?.input?.optional?.autosize) { + addResizeHook(nodeType.prototype, 0, true) } } },