Skip to content

Commit

Permalink
Fix annoying float issue causing the value to be rounded to above the…
Browse files Browse the repository at this point in the history
… max.
  • Loading branch information
comfyanonymous committed Apr 17, 2024
1 parent 072e3bd commit d64e217
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion web/scripts/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,9 @@ export const ComfyWidgets = {
return { widget: node.addWidget(widgetType, inputName, val,
function (v) {
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 {
this.value = v;
}
Expand Down

0 comments on commit d64e217

Please sign in to comment.