Restore resolution widget initialization

This commit is contained in:
2026-10-22 12:59:33 +00:00
parent acfc45d11d
commit 3efa92492b
+4 -7
View File
@@ -143,11 +143,11 @@ function render(node, root) {
function setup(node) {
node.resizable = false;
const root=document.createElement("div"); root.className="dumas-res";
const widget=node.addDOMWidget("dumas_resolution_ui", "custom", root, {serialize:false, getValue:()=>read(node), setValue:()=>{}, getMinHeight:()=>570});
const widget=node.addDOMWidget("dumas_resolution_ui", "custom", root, {serialize:false, getValue:()=>read(node), setValue:()=>{}, getMinHeight:()=>500});
// Keep the LiteGraph frame at least as tall as the rendered controls.
// The DOM widget otherwise keeps its old compact minimum and overhangs
// the node even when the node itself is marked non-resizable.
widget.computeLayoutSize=()=>({minHeight:570,minWidth:1});
widget.computeLayoutSize=()=>({minHeight:500,minWidth:1});
root.addEventListener("click", (event) => {
const button=event.target.closest("button"); if (!button) return;
const s=read(node), id=button.dataset.id;
@@ -160,10 +160,7 @@ function setup(node) {
render(node,root);
});
root.addEventListener("change", (event) => { const key=event.target.dataset.key; if(!key)return; const s=read(node), value=key==="batch" ? Math.max(1,Math.min(64,Number(event.target.value)||1)) : Math.max(1,Math.min(16384,Number(event.target.value)||1)); s[key]=value; if(s.mode==="custom") { s.w=snap(clamp(s.custom_w),s.snap); s.h=snap(clamp(s.custom_h),s.snap); } else if(s.mode==="custom_ratio") { [s.w,s.h]=ratioPair(s.w,s.custom_ratio_w,s.custom_ratio_h,s.snap); } write(node,s); render(node,root); });
node._dumasResolutionRoot=root;
node.setSize?.([300,620]);
node.size=[300,620];
queueMicrotask(()=>{ node.setSize?.([300,620]); render(node,root); });
node._dumasResolutionRoot=root; node.size=[300,540]; queueMicrotask(()=>render(node,root));
}
const originalGraphToPrompt=app.graphToPrompt?.bind(app);
@@ -177,7 +174,7 @@ app.registerExtension({
if(nodeData?.name!==CLASS)return;
const oldConfigure=nodeType.prototype.onConfigure;
nodeType.prototype.onConfigure=function(...args){const result=oldConfigure?.apply(this,args); if(this._dumasResolutionRoot)render(this,this._dumasResolutionRoot); return result;};
nodeType.prototype.onResize=function(){this.setSize?.([300,620]); this.size=[300,620];};
nodeType.prototype.onResize=function(){this.size=[300,540];};
},
nodeCreated(node){if(node.comfyClass===CLASS)setup(node);},
});