Use round instead of cast to get better slider feeling
This commit is contained in:
parent
42335b2024
commit
55453c5d26
|
@ -468,7 +468,7 @@ public class OptionsOverlay {
|
||||||
private void updateSliderOption(int mouseX, int mouseY) {
|
private void updateSliderOption(int mouseX, int mouseY) {
|
||||||
int min = selectedOption.getMinValue();
|
int min = selectedOption.getMinValue();
|
||||||
int max = selectedOption.getMaxValue();
|
int max = selectedOption.getMaxValue();
|
||||||
int value = min + (int) ((float) (max - min) * (mouseX - sliderOptionStartX) / (sliderOptionLength));
|
int value = min + Math.round((float) (max - min) * (mouseX - sliderOptionStartX) / (sliderOptionLength));
|
||||||
selectedOption.setValue(Utils.clamp(value, min, max));
|
selectedOption.setValue(Utils.clamp(value, min, max));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user