Properly rounding numbers for display - fix for negative numbers (#10355)

This commit is contained in:
Cardillan
2024-11-30 16:09:15 +01:00
committed by GitHub
parent a3110fde21
commit 18955d6604
2 changed files with 5 additions and 5 deletions

View File

@@ -188,7 +188,7 @@ public class LogicDialog extends BaseDialog{
Label label = out.add("").style(Styles.outlineLabel).padLeft(4).padRight(4).width(140f).wrap().get();
label.update(() -> {
if(counter[0] < 0 || (counter[0] += Time.delta) >= period){
String text = s.isobj ? PrintI.toString(s.objval) : Math.abs(s.numval - (long)(s.numval+0.5)) < 0.00001 ? (long)(s.numval+0.5) + "" : s.numval + "";
String text = s.isobj ? PrintI.toString(s.objval) : Math.abs(s.numval - Math.round(s.numval)) < 0.00001 ? Math.round(s.numval) + "" : s.numval + "";
if(!label.textEquals(text)){
label.setText(text);
if(counter[0] >= 0f){