0
0
mirror of https://github.com/Wurst-Imperium/Wurst7.git synced 2024-09-20 01:12:13 +02:00

Remove trailing ".0" in decimal slider values

This commit is contained in:
Alexander01998 2024-05-20 15:46:17 +02:00
parent 4823747f80
commit 8406313de2

View File

@ -303,8 +303,10 @@ public class SliderSetting extends Setting implements SliderLock
{
public static final ValueDisplay INTEGER = v -> (int)v + "";
public static final ValueDisplay DECIMAL =
v -> Math.round(v * 1e6) / 1e6 + "";
public static final ValueDisplay DECIMAL = v -> {
String s = Math.round(v * 1e6) / 1e6 + "";
return s.endsWith(".0") ? s.substring(0, s.length() - 2) : s;
};
public static final ValueDisplay PERCENTAGE =
v -> (int)(Math.round(v * 1e8) / 1e6) + "%";