mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 07:05:43 -03:00
Add sync functionality for clipStrength when collapsed in Loras widget. https://github.com/willmiao/ComfyUI-Lora-Manager/issues/176
This commit is contained in:
@@ -399,6 +399,8 @@ export function addLorasWidget(node, name, opts, callback) {
|
|||||||
lorasData[loraIndex].clipStrength = newStrength;
|
lorasData[loraIndex].clipStrength = newStrength;
|
||||||
} else {
|
} else {
|
||||||
lorasData[loraIndex].strength = newStrength;
|
lorasData[loraIndex].strength = newStrength;
|
||||||
|
// Sync clipStrength if collapsed
|
||||||
|
syncClipStrengthIfCollapsed(lorasData[loraIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the widget value
|
// Update the widget value
|
||||||
@@ -844,6 +846,8 @@ export function addLorasWidget(node, name, opts, callback) {
|
|||||||
|
|
||||||
if (loraIndex >= 0) {
|
if (loraIndex >= 0) {
|
||||||
lorasData[loraIndex].strength = (parseFloat(lorasData[loraIndex].strength) - 0.05).toFixed(2);
|
lorasData[loraIndex].strength = (parseFloat(lorasData[loraIndex].strength) - 0.05).toFixed(2);
|
||||||
|
// Sync clipStrength if collapsed
|
||||||
|
syncClipStrengthIfCollapsed(lorasData[loraIndex]);
|
||||||
|
|
||||||
const newValue = formatLoraValue(lorasData);
|
const newValue = formatLoraValue(lorasData);
|
||||||
widget.value = newValue;
|
widget.value = newValue;
|
||||||
@@ -906,6 +910,8 @@ export function addLorasWidget(node, name, opts, callback) {
|
|||||||
|
|
||||||
if (loraIndex >= 0) {
|
if (loraIndex >= 0) {
|
||||||
lorasData[loraIndex].strength = newValue.toFixed(2);
|
lorasData[loraIndex].strength = newValue.toFixed(2);
|
||||||
|
// Sync clipStrength if collapsed
|
||||||
|
syncClipStrengthIfCollapsed(lorasData[loraIndex]);
|
||||||
|
|
||||||
// Update value and trigger callback
|
// Update value and trigger callback
|
||||||
const newLorasValue = formatLoraValue(lorasData);
|
const newLorasValue = formatLoraValue(lorasData);
|
||||||
@@ -928,6 +934,8 @@ export function addLorasWidget(node, name, opts, callback) {
|
|||||||
|
|
||||||
if (loraIndex >= 0) {
|
if (loraIndex >= 0) {
|
||||||
lorasData[loraIndex].strength = (parseFloat(lorasData[loraIndex].strength) + 0.05).toFixed(2);
|
lorasData[loraIndex].strength = (parseFloat(lorasData[loraIndex].strength) + 0.05).toFixed(2);
|
||||||
|
// Sync clipStrength if collapsed
|
||||||
|
syncClipStrengthIfCollapsed(lorasData[loraIndex]);
|
||||||
|
|
||||||
const newValue = formatLoraValue(lorasData);
|
const newValue = formatLoraValue(lorasData);
|
||||||
widget.value = newValue;
|
widget.value = newValue;
|
||||||
@@ -1285,3 +1293,12 @@ const shouldShowClipEntry = (loraData) => {
|
|||||||
// Otherwise use the legacy logic - if values differ, it should be expanded
|
// Otherwise use the legacy logic - if values differ, it should be expanded
|
||||||
return Number(loraData.strength) !== Number(loraData.clipStrength);
|
return Number(loraData.strength) !== Number(loraData.clipStrength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Helper function to sync clipStrength with strength when collapsed
|
||||||
|
const syncClipStrengthIfCollapsed = (loraData) => {
|
||||||
|
// If not expanded (collapsed), sync clipStrength with strength
|
||||||
|
if (loraData.hasOwnProperty('expanded') && !loraData.expanded) {
|
||||||
|
loraData.clipStrength = loraData.strength;
|
||||||
|
}
|
||||||
|
return loraData;
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user