diff options
author | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2020-01-19 11:54:56 +0200 |
---|---|---|
committer | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2020-01-19 11:54:56 +0200 |
commit | b2a2ea44eadc4a6b6fc1aed1a311ed25c156aa86 (patch) | |
tree | 4210e9fbf3b395b1f9087f38bb5a28dae8268663 /src/main/java/io | |
parent | a57bf30b5a955b88fcfdcdb9ffbab8ae8dee64b2 (diff) | |
download | LibGui-b2a2ea44eadc4a6b6fc1aed1a311ed25c156aa86.tar.gz LibGui-b2a2ea44eadc4a6b6fc1aed1a311ed25c156aa86.tar.bz2 LibGui-b2a2ea44eadc4a6b6fc1aed1a311ed25c156aa86.zip |
Clamp values to the new range in WAbstractSlider.set[Min/Max]Value
Closes #17.
Diffstat (limited to 'src/main/java/io')
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java index 7079256..a086b3a 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java @@ -220,10 +220,18 @@ public abstract class WAbstractSlider extends WWidget { public void setMinValue(int min) { this.min = min; + if (this.value < min) { + this.value = min; + onValueChanged(this.value); + } } public void setMaxValue(int max) { this.max = max; + if (this.value > max) { + this.value = max; + onValueChanged(this.value); + } } public Axis getAxis() { |