diff options
author | xander <xander@isxander.dev> | 2022-09-01 22:09:34 +0100 |
---|---|---|
committer | xander <xander@isxander.dev> | 2022-09-01 22:09:34 +0100 |
commit | cff8d5bad318d133ab1089524619fc15f3b15b6f (patch) | |
tree | 44b16fa745a87974ccee2a91c6e6959fce30e9a7 /src/main | |
parent | 8aeaf4b0507e8862c92645efd246df186e902b80 (diff) | |
download | YetAnotherConfigLib-cff8d5bad318d133ab1089524619fc15f3b15b6f.tar.gz YetAnotherConfigLib-cff8d5bad318d133ab1089524619fc15f3b15b6f.tar.bz2 YetAnotherConfigLib-cff8d5bad318d133ab1089524619fc15f3b15b6f.zip |
clamp rounded slider value because precision
Diffstat (limited to 'src/main')
-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(); } |