diff options
Diffstat (limited to 'src/main/java/dev/isxander/yacl')
-rw-r--r-- | src/main/java/dev/isxander/yacl/gui/controllers/slider/SliderControllerElement.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main/java/dev/isxander/yacl/gui/controllers/slider/SliderControllerElement.java b/src/main/java/dev/isxander/yacl/gui/controllers/slider/SliderControllerElement.java index a7dec64..104140d 100644 --- a/src/main/java/dev/isxander/yacl/gui/controllers/slider/SliderControllerElement.java +++ b/src/main/java/dev/isxander/yacl/gui/controllers/slider/SliderControllerElement.java @@ -95,7 +95,7 @@ public class SliderControllerElement extends ControllerWidget<ISliderController< private void setValueFromMouse(double mouseX) { double value = (mouseX - sliderBounds.x()) / sliderBounds.width() * control.range(); - double roundedValue = min + (interval * Math.round(value / interval)); + double roundedValue = MathHelper.clamp(min + (interval * Math.round(value / interval)), min, max); // extremely imprecise, requires clamping control.setPendingValue(roundedValue); calculateInterpolation(); } |