mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-05-16 10:07:36 -03:00
fix(ui): default_active in group mode should not propagate to children; hide group badge/edit for single-child groups (#929)
This commit is contained in:
@@ -658,6 +658,7 @@ export function addTagsWidget(node, name, opts, callback, wheelSensitivity = 0.0
|
|||||||
textEl.style.maxWidth = "140px";
|
textEl.style.maxWidth = "140px";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tagData.items.length > 1) {
|
||||||
const countBadge = document.createElement("span");
|
const countBadge = document.createElement("span");
|
||||||
countBadge.className = "lm-trigger-count-badge";
|
countBadge.className = "lm-trigger-count-badge";
|
||||||
countBadge.textContent = `${groupState.activeChildren}/${groupState.totalChildren}`;
|
countBadge.textContent = `${groupState.activeChildren}/${groupState.totalChildren}`;
|
||||||
@@ -684,6 +685,7 @@ export function addTagsWidget(node, name, opts, callback, wheelSensitivity = 0.0
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
groupChip.appendChild(countBadge);
|
groupChip.appendChild(countBadge);
|
||||||
|
}
|
||||||
|
|
||||||
if (showStrengthInfo) {
|
if (showStrengthInfo) {
|
||||||
const strengthBadge = createStrengthBadge();
|
const strengthBadge = createStrengthBadge();
|
||||||
@@ -697,7 +699,10 @@ export function addTagsWidget(node, name, opts, callback, wheelSensitivity = 0.0
|
|||||||
groupChip.title = activePreview ? `${tagData.text}\nActive: ${activePreview}` : tagData.text;
|
groupChip.title = activePreview ? `${tagData.text}\nActive: ${activePreview}` : tagData.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
const editButton = document.createElement("button");
|
let editButton = null;
|
||||||
|
|
||||||
|
if (tagData.items.length > 1) {
|
||||||
|
editButton = document.createElement("button");
|
||||||
editButton.type = "button";
|
editButton.type = "button";
|
||||||
editButton.className = "lm-trigger-group-edit-button";
|
editButton.className = "lm-trigger-group-edit-button";
|
||||||
editButton.textContent = "⋯";
|
editButton.textContent = "⋯";
|
||||||
@@ -726,10 +731,11 @@ export function addTagsWidget(node, name, opts, callback, wheelSensitivity = 0.0
|
|||||||
groupChip.addEventListener("contextmenu", openEditor);
|
groupChip.addEventListener("contextmenu", openEditor);
|
||||||
|
|
||||||
groupChip.appendChild(editButton);
|
groupChip.appendChild(editButton);
|
||||||
|
}
|
||||||
|
|
||||||
groupChip.addEventListener("click", (e) => {
|
groupChip.addEventListener("click", (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (e.target === editButton) {
|
if (editButton && e.target === editButton) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
updateWidgetValue(widget, (updatedTags) => {
|
updateWidgetValue(widget, (updatedTags) => {
|
||||||
@@ -740,7 +746,7 @@ export function addTagsWidget(node, name, opts, callback, wheelSensitivity = 0.0
|
|||||||
|
|
||||||
if (showStrengthInfo) {
|
if (showStrengthInfo) {
|
||||||
groupChip.addEventListener("wheel", (e) => {
|
groupChip.addEventListener("wheel", (e) => {
|
||||||
if (e.target === editButton) {
|
if (editButton && e.target === editButton) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
@@ -303,6 +303,8 @@ app.registerExtension({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const groupMode = groupModeWidget?.value ?? false;
|
||||||
|
|
||||||
const updatedTags = node.tagWidget.value.map((tag) => {
|
const updatedTags = node.tagWidget.value.map((tag) => {
|
||||||
if (!Array.isArray(tag.items)) {
|
if (!Array.isArray(tag.items)) {
|
||||||
return {
|
return {
|
||||||
@@ -311,6 +313,15 @@ app.registerExtension({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In group mode, default_active only controls the group-level switch.
|
||||||
|
// Children's individual active states are managed exclusively via the group editor.
|
||||||
|
if (groupMode) {
|
||||||
|
return {
|
||||||
|
...tag,
|
||||||
|
active: value,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...tag,
|
...tag,
|
||||||
active: value,
|
active: value,
|
||||||
@@ -320,7 +331,6 @@ app.registerExtension({
|
|||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
node.tagWidget.value = updatedTags;
|
node.tagWidget.value = updatedTags;
|
||||||
node.applyTriggerHighlightState?.();
|
node.applyTriggerHighlightState?.();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user