Skip to content

Commit 214b2aa

Browse files
committed
[qml] ExpressionTextField: Don't round up floating numbers
If the `ExpressionTextField` is meant for an integer (`isInt = true`), then the value of the expression should be an integer, meaning rounding may need to be applied. However, for floating numbers, we do not want to lose some precision, so the value should never be rounded or set to a fixed number of decimal digits.
1 parent 5b70888 commit 214b2aa

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

meshroom/ui/qml/Utils/ExpressionTextField.qml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ TextField {
3636
if (_err == false) {
3737
if (isInt)
3838
_res = Math.round(_res)
39-
else
40-
_res = _res.toFixed(decimals)
4139
return _res
4240
} else {
4341
console.error("Error: Expression", _text, "is invalid")
@@ -80,7 +78,7 @@ TextField {
8078
if (isInt)
8179
root.text = Number(evaluatedValue).toFixed(0)
8280
else
83-
root.text = Number(evaluatedValue).toFixed(decimals)
81+
root.text = Number(evaluatedValue)
8482
}
8583
}
8684
}
@@ -93,7 +91,7 @@ TextField {
9391
if (isInt)
9492
root.text = Number(evaluatedValue).toFixed(0)
9593
else
96-
root.text = Number(evaluatedValue).toFixed(decimals)
94+
root.text = Number(evaluatedValue)
9795
}
9896
}
9997
}

0 commit comments

Comments
 (0)