aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dev/isxander/yacl/gui/controllers/slider
diff options
context:
space:
mode:
authorxander <xander@isxander.dev>2022-09-01 14:10:08 +0100
committerxander <xander@isxander.dev>2022-09-01 14:10:08 +0100
commit627c45bd6cfa7cce9e048d7681029c812a45f1cc (patch)
tree2c1931b9586b021c1e3d54db7bb1a01d6b644bff /src/main/java/dev/isxander/yacl/gui/controllers/slider
parent21728802a4ee2b65a32b626140ff01bf59a456c6 (diff)
downloadYetAnotherConfigLib-627c45bd6cfa7cce9e048d7681029c812a45f1cc.tar.gz
YetAnotherConfigLib-627c45bd6cfa7cce9e048d7681029c812a45f1cc.tar.bz2
YetAnotherConfigLib-627c45bd6cfa7cce9e048d7681029c812a45f1cc.zip
category tooltips
fix slider scrolling
Diffstat (limited to 'src/main/java/dev/isxander/yacl/gui/controllers/slider')
-rw-r--r--src/main/java/dev/isxander/yacl/gui/controllers/slider/SliderControllerElement.java8
1 files changed, 6 insertions, 2 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 5c5e20e..a7dec64 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
@@ -29,8 +29,6 @@ public class SliderControllerElement extends ControllerWidget<ISliderController<
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
super.render(matrices, mouseX, mouseY, delta);
- if (sliderBounds == null)
- sliderBounds = Dimension.ofInt(dim.xLimit() - getXPadding() - getThumbWidth() / 2 - dim.width() / 3, dim.centerY() - 4, dim.width() / 3, 8);
calculateInterpolation();
}
@@ -111,6 +109,12 @@ public class SliderControllerElement extends ControllerWidget<ISliderController<
interpolation = (float) ((control.pendingValue() - control.min()) * 1 / control.range());
}
+ @Override
+ public void setDimension(Dimension<Integer> dim) {
+ super.setDimension(dim);
+ sliderBounds = Dimension.ofInt(dim.xLimit() - getXPadding() - getThumbWidth() / 2 - dim.width() / 3, dim.centerY() - 4, dim.width() / 3, 8);
+ }
+
private int getThumbX() {
return (int) (sliderBounds.x() + sliderBounds.width() * interpolation);
}