mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-10 13:32:36 +08:00
Add manual precision override
This commit is contained in:
parent
80dfeb089b
commit
2e317657ca
@ -584,6 +584,18 @@ export class ComfyUI {
|
|||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.settings.addSetting({
|
||||||
|
id: "Comfy.FloatRoundingPrecision",
|
||||||
|
name: "Decimal places [0 = auto] (requires page reload).",
|
||||||
|
type: "slider",
|
||||||
|
attrs: {
|
||||||
|
min: 0,
|
||||||
|
max: 6,
|
||||||
|
step: 1,
|
||||||
|
},
|
||||||
|
defaultValue: 0,
|
||||||
|
});
|
||||||
|
|
||||||
const fileInput = $el("input", {
|
const fileInput = $el("input", {
|
||||||
id: "comfy-file-input",
|
id: "comfy-file-input",
|
||||||
type: "file",
|
type: "file",
|
||||||
|
|||||||
@ -12,7 +12,10 @@ function getNumberDefaults(inputData, defaultStep, app) {
|
|||||||
// when using the old behavior, it defaults to 3 decimal places
|
// when using the old behavior, it defaults to 3 decimal places
|
||||||
let precision = 3;
|
let precision = 3;
|
||||||
let round = 0.001;
|
let round = 0.001;
|
||||||
if (!app.ui.settings.getSettingValue("Comfy.DisableFloatRounding")) {
|
if (app.ui.settings.getSettingValue("Comfy.FloatRoundingPrecision") > 0) {
|
||||||
|
precision = app.ui.settings.getSettingValue("Comfy.FloatRoundingPrecision");
|
||||||
|
round = Math.round(1000000*Math.pow(0.1,precision))/1000000;
|
||||||
|
} else if (!app.ui.settings.getSettingValue("Comfy.DisableFloatRounding")) {
|
||||||
// display the the smallest number of decimal places such that changes of size step are visible.
|
// display the the smallest number of decimal places such that changes of size step are visible.
|
||||||
precision = Math.max(-Math.floor(Math.log10(step)),0);
|
precision = Math.max(-Math.floor(Math.log10(step)),0);
|
||||||
// round the value to those decimal places shown.
|
// round the value to those decimal places shown.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user