feat(vue-widgets): add max height constraint for LoRA autocomplete widgets

Introduce AUTOCOMPLETE_TEXT_WIDGET_MAX_HEIGHT constant and apply it to autocomplete text widgets when modelType is 'loras'. This ensures LoRA-specific widgets have a consistent maximum height of 100px, improving UI consistency and preventing excessive widget expansion.
This commit is contained in:
Will Miao
2026-01-25 09:59:04 +08:00
parent d655fb8008
commit b71b3f99dc
3 changed files with 14 additions and 12 deletions

View File

@@ -23,6 +23,7 @@ const LORA_CYCLER_WIDGET_MAX_HEIGHT = LORA_CYCLER_WIDGET_MIN_HEIGHT
const JSON_DISPLAY_WIDGET_MIN_WIDTH = 300
const JSON_DISPLAY_WIDGET_MIN_HEIGHT = 200
const AUTOCOMPLETE_TEXT_WIDGET_MIN_HEIGHT = 60
const AUTOCOMPLETE_TEXT_WIDGET_MAX_HEIGHT = 100
// @ts-ignore - ComfyUI external module
import { app } from '../../../scripts/app.js'
@@ -441,7 +442,12 @@ function createAutocompleteTextWidgetFactory(
serialize: true,
getMinHeight() {
return AUTOCOMPLETE_TEXT_WIDGET_MIN_HEIGHT
}
},
...(modelType === 'loras' && {
getMaxHeight() {
return AUTOCOMPLETE_TEXT_WIDGET_MAX_HEIGHT
}
})
}
)
@@ -467,12 +473,6 @@ function createAutocompleteTextWidgetFactory(
const appKey = node.id * 100000 + widgetName.charCodeAt(0)
vueApps.set(appKey, vueApp)
widget.computeLayoutSize = () => {
const minHeight = AUTOCOMPLETE_TEXT_WIDGET_MIN_HEIGHT
return { minHeight }
}
widget.onRemove = () => {
const vueApp = vueApps.get(appKey)
if (vueApp) {

View File

@@ -13735,6 +13735,7 @@ const LORA_CYCLER_WIDGET_MAX_HEIGHT = LORA_CYCLER_WIDGET_MIN_HEIGHT;
const JSON_DISPLAY_WIDGET_MIN_WIDTH = 300;
const JSON_DISPLAY_WIDGET_MIN_HEIGHT = 200;
const AUTOCOMPLETE_TEXT_WIDGET_MIN_HEIGHT = 60;
const AUTOCOMPLETE_TEXT_WIDGET_MAX_HEIGHT = 100;
function forwardMiddleMouseToCanvas(container) {
if (!container) return;
container.addEventListener("pointerdown", (event) => {
@@ -14065,6 +14066,11 @@ function createAutocompleteTextWidgetFactory(node, widgetName, modelType, inputO
serialize: true,
getMinHeight() {
return AUTOCOMPLETE_TEXT_WIDGET_MIN_HEIGHT;
},
...modelType === "loras" && {
getMaxHeight() {
return AUTOCOMPLETE_TEXT_WIDGET_MAX_HEIGHT;
}
}
}
);
@@ -14084,10 +14090,6 @@ function createAutocompleteTextWidgetFactory(node, widgetName, modelType, inputO
vueApp.mount(container);
const appKey = node.id * 1e5 + widgetName.charCodeAt(0);
vueApps.set(appKey, vueApp);
widget.computeLayoutSize = () => {
const minHeight = AUTOCOMPLETE_TEXT_WIDGET_MIN_HEIGHT;
return { minHeight };
};
widget.onRemove = () => {
const vueApp2 = vueApps.get(appKey);
if (vueApp2) {

File diff suppressed because one or more lines are too long