diff --git a/web/comfyui/loras_widget.js b/web/comfyui/loras_widget.js index 05283348..f411d3b5 100644 --- a/web/comfyui/loras_widget.js +++ b/web/comfyui/loras_widget.js @@ -399,6 +399,8 @@ export function addLorasWidget(node, name, opts, callback) { lorasData[loraIndex].clipStrength = newStrength; } else { lorasData[loraIndex].strength = newStrength; + // Sync clipStrength if collapsed + syncClipStrengthIfCollapsed(lorasData[loraIndex]); } // Update the widget value @@ -844,6 +846,8 @@ export function addLorasWidget(node, name, opts, callback) { if (loraIndex >= 0) { lorasData[loraIndex].strength = (parseFloat(lorasData[loraIndex].strength) - 0.05).toFixed(2); + // Sync clipStrength if collapsed + syncClipStrengthIfCollapsed(lorasData[loraIndex]); const newValue = formatLoraValue(lorasData); widget.value = newValue; @@ -906,6 +910,8 @@ export function addLorasWidget(node, name, opts, callback) { if (loraIndex >= 0) { lorasData[loraIndex].strength = newValue.toFixed(2); + // Sync clipStrength if collapsed + syncClipStrengthIfCollapsed(lorasData[loraIndex]); // Update value and trigger callback const newLorasValue = formatLoraValue(lorasData); @@ -928,6 +934,8 @@ export function addLorasWidget(node, name, opts, callback) { if (loraIndex >= 0) { lorasData[loraIndex].strength = (parseFloat(lorasData[loraIndex].strength) + 0.05).toFixed(2); + // Sync clipStrength if collapsed + syncClipStrengthIfCollapsed(lorasData[loraIndex]); const newValue = formatLoraValue(lorasData); widget.value = newValue; @@ -1284,4 +1292,13 @@ const shouldShowClipEntry = (loraData) => { } // Otherwise use the legacy logic - if values differ, it should be expanded return Number(loraData.strength) !== Number(loraData.clipStrength); -} \ No newline at end of file +} + +// 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; +}; \ No newline at end of file