From 55453c5d260b97d9f9b1a7fbcb800ff812b906b2 Mon Sep 17 00:00:00 2001 From: yugecin Date: Sun, 11 Dec 2016 18:58:01 +0100 Subject: [PATCH] Use round instead of cast to get better slider feeling --- src/yugecin/opsudance/ui/OptionsOverlay.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yugecin/opsudance/ui/OptionsOverlay.java b/src/yugecin/opsudance/ui/OptionsOverlay.java index 4b184056..4f9659ed 100644 --- a/src/yugecin/opsudance/ui/OptionsOverlay.java +++ b/src/yugecin/opsudance/ui/OptionsOverlay.java @@ -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)); }