Use round instead of cast to get better slider feeling

This commit is contained in:
yugecin 2016-12-11 18:58:01 +01:00
parent 42335b2024
commit 55453c5d26

View File

@ -468,7 +468,7 @@ public class OptionsOverlay {
private void updateSliderOption(int mouseX, int mouseY) {
int min = selectedOption.getMinValue();
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));
}