Fix node size

This commit is contained in:
Will Miao
2025-03-03 05:32:54 +08:00
parent 6db4ff3bd6
commit 1281ae29cb
4 changed files with 28 additions and 15 deletions

View File

@@ -666,13 +666,23 @@ export function addLorasWidget(node, name, opts, callback) {
setValue: function(v) {
widgetValue = v || "";
renderLoras(widgetValue, widget);
// Update container height after rendering
requestAnimationFrame(() => {
const minHeight = this.getMinHeight();
container.style.height = `${minHeight}px`;
// Force node to update size
node.setSize([node.size[0], node.computeSize()[1]]);
node.setDirtyCanvas(true, true);
});
},
getHeight: function() {
getMinHeight: function() {
// Calculate height based on content
const lorasCount = parseLoraValue(widgetValue).length;
return Math.max(
100,
lorasCount > 0 ? 60 + lorasCount * 44 : 60 // Header + entries or minimum height
lorasCount > 0 ? 60 + lorasCount * 44 : 60
);
},
});