diff options
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java | 6 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java index 00dbd9f..adbfb8d 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java @@ -23,7 +23,7 @@ public class ConfigSlider extends BasicOption { this.min = min; this.max = max; this.step = step; - inputField = new NumberInputField(84, 24, 0, min, max, step); + inputField = new NumberInputField(84, 24, 0, min, max, step == 0 ? 1 : step); } @Override @@ -35,11 +35,11 @@ public class ConfigSlider extends BasicOption { if (dragging) { xCoordinate = (int) MathUtils.clamp(InputUtils.mouseX(), x + 352, x + 864); value = MathUtils.map(xCoordinate, x + 352, x + 864, min, max); - } else if (inputField.isToggled()) { + } else if (inputField.isToggled() || inputField.arrowsClicked()) { value = inputField.getCurrentValue(); xCoordinate = (int) MathUtils.map(value, min, max, x + 352, x + 864); } - if (dragging && InputUtils.isClicked() || inputField.isToggled()) { + if (dragging && InputUtils.isClicked() || inputField.isToggled() || inputField.arrowsClicked()) { dragging = false; if (step > 0) { xCoordinate = getStepCoordinate(xCoordinate, x); diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java index 1eefe74..5475a55 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java @@ -117,4 +117,8 @@ public class NumberInputField extends TextInputField { public void setMin(float min) { this.min = min; } + + public boolean arrowsClicked() { + return upArrow.isClicked() || downArrow.isClicked(); + } } |