mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-05-06 08:26:45 -03:00
Merge pull request #921 from 1756141021/fix/drag-strength-notify-setValue
fix: commit dragged strength through options.setValue at drag end
This commit is contained in:
@@ -232,9 +232,13 @@ export function initDrag(
|
|||||||
onDragEnd();
|
onDragEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now do the re-render after drag is complete
|
// Commit final value through options.setValue so external observers are notified.
|
||||||
if (renderFunction) {
|
// During drag, handleStrengthDrag mutates widgetValue in-place (updateWidget=false),
|
||||||
renderFunction(widget.value, widget);
|
// bypassing widget.value setter and options.setValue entirely. This assignment
|
||||||
|
// flushes the in-place mutation through the setter so any setValue wrappers fire.
|
||||||
|
widget.value = widget.value;
|
||||||
|
if (typeof widget.callback === 'function') {
|
||||||
|
widget.callback(widget.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -349,8 +353,12 @@ export function initHeaderDrag(headerEl, widget, renderFunction) {
|
|||||||
document.body.classList.remove('lm-lora-strength-dragging');
|
document.body.classList.remove('lm-lora-strength-dragging');
|
||||||
|
|
||||||
// Only re-render if we actually dragged
|
// Only re-render if we actually dragged
|
||||||
if (wasDragging && renderFunction) {
|
if (wasDragging) {
|
||||||
renderFunction(widget.value, widget);
|
// Commit final value through options.setValue so external observers are notified.
|
||||||
|
widget.value = widget.value;
|
||||||
|
if (typeof widget.callback === 'function') {
|
||||||
|
widget.callback(widget.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user