fix(ui): prevent tags widget from auto-resizing in Vue mode when tags change

This commit is contained in:
Will Miao
2026-07-13 14:55:40 +08:00
parent 03dd047e62
commit 9d85c2a44a
2 changed files with 19 additions and 0 deletions

View File

@@ -133,6 +133,14 @@
outline: none;
}
/* Vue node mode: prevent content from pushing node size via ResizeObserver.
Same technique as .lm-loras-container.lm-vue-node above. */
.comfy-tags-container.lm-vue-node {
height: 100%;
min-height: var(--comfy-widget-min-height, 150px);
contain: layout size;
}
.lm-lora-empty-state {
text-align: center;
padding: 20px 0;

View File

@@ -1,6 +1,7 @@
import { app } from "../../scripts/app.js";
import { forwardMiddleMouseToCanvas, forwardWheelToCanvas } from "./utils.js";
import { copyToClipboard } from "./loras_widget_utils.js";
import { ensureLmStyles } from "./lm_styles_loader.js";
const MIN_HEIGHT = 150;
const GROUP_EDITOR_ID = "lm-trigger-group-editor";
@@ -696,6 +697,16 @@ export function addTagsWidget(node, name, opts, callback, wheelSensitivity = 0.0
outline: "none",
});
// Set a fixed minimum height so the node has a reasonable starting size.
// Adding or removing tags does NOT change the node size — the container
// scrolls when content exceeds the allocated space.
ensureLmStyles();
container.style.setProperty("--comfy-widget-min-height", `${MIN_HEIGHT}px`);
if (typeof LiteGraph !== "undefined" && LiteGraph.vueNodesMode) {
container.classList.add("lm-vue-node");
}
const initialTagsData = opts?.defaultVal || [];
function renderSimpleTag(tagData, index, widget, showStrengthInfo) {