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:
parent
4823747f80
commit
8406313de2
@ -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) + "%";
|
||||
|
Loading…
Reference in New Issue
Block a user