aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuuxel <6596629+Juuxel@users.noreply.github.com>2020-05-08 20:47:53 +0300
committerJuuxel <6596629+Juuxel@users.noreply.github.com>2020-05-08 20:47:53 +0300
commitcca884e8beb6e0f92c09b2d238b65d26a4b1887f (patch)
tree164539d3ae4af17381ba5e52f82bb240387285cc
parent5f415d444efd70fb5747395fe913ace3d89e33cb (diff)
downloadLibGui-cca884e8beb6e0f92c09b2d238b65d26a4b1887f.tar.gz
LibGui-cca884e8beb6e0f92c09b2d238b65d26a4b1887f.tar.bz2
LibGui-cca884e8beb6e0f92c09b2d238b65d26a4b1887f.zip
Fix right-facing horizontal sliders (default)
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java2
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java2
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WSlider.java2
3 files changed, 3 insertions, 3 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 7a2ccec..d864b3b 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
@@ -72,7 +72,7 @@ public abstract class WAbstractSlider extends WWidget {
this.max = max;
this.axis = axis;
this.value = min;
- this.direction = (axis == Axis.HORIZONTAL) ? Direction.RIGHT : Direction.UP;
+ this.direction = (axis == Axis.HORIZONTAL) ? Direction.LEFT : Direction.UP;
}
/**
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java
index 2ff9f68..77e51ce 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java
@@ -164,7 +164,7 @@ public class WLabeledSlider extends WAbstractSlider {
int aWidth = axis == Axis.HORIZONTAL ? width : height;
int aHeight = axis == Axis.HORIZONTAL ? height : width;
int rotMouseX = axis == Axis.HORIZONTAL
- ? (direction == Direction.RIGHT ? width - mouseX : mouseX)
+ ? (direction == Direction.LEFT ? width - mouseX : mouseX)
: (direction == Direction.UP ? height - mouseY : mouseY);
int rotMouseY = axis == Axis.HORIZONTAL ? mouseY : mouseX;
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WSlider.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WSlider.java
index 630f23a..5934997 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WSlider.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WSlider.java
@@ -72,7 +72,7 @@ public class WSlider extends WAbstractSlider {
ScreenDrawing.texturedRect(trackX, y + height, TRACK_WIDTH, 1, texture, 16*px, 2*px, 22*px, 3*px, 0xFFFFFFFF);
} else {
int trackY = y + height / 2 - TRACK_WIDTH / 2;
- thumbX = direction == Direction.RIGHT
+ thumbX = direction == Direction.LEFT
? (width - THUMB_SIZE) + 1 - (int) (coordToValueRatio * (value - min))
: Math.round(coordToValueRatio * (value - min));
thumbY = height / 2 - THUMB_SIZE / 2;