mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-04-19 10:53:29 +00:00
Fix annoying float issue causing the value to be rounded to above the max.
This commit is contained in:
parent
072e3bd2b5
commit
d64e217427
@ -307,7 +307,9 @@ export const ComfyWidgets = {
|
|||||||
return { widget: node.addWidget(widgetType, inputName, val,
|
return { widget: node.addWidget(widgetType, inputName, val,
|
||||||
function (v) {
|
function (v) {
|
||||||
if (config.round) {
|
if (config.round) {
|
||||||
this.value = Math.round(v/config.round)*config.round;
|
this.value = Math.round((v + Number.EPSILON)/config.round)*config.round;
|
||||||
|
if (this.value > config.max) this.value = config.max;
|
||||||
|
if (this.value < config.min) this.value = config.min;
|
||||||
} else {
|
} else {
|
||||||
this.value = v;
|
this.value = v;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user