aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle2
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WSlider.java9
2 files changed, 3 insertions, 8 deletions
diff --git a/build.gradle b/build.gradle
index ad484fd..c453a51 100644
--- a/build.gradle
+++ b/build.gradle
@@ -150,4 +150,4 @@ artifactory {
} else {
println "Cannot configure artifactory; please define ext.artifactoryUsername and ext.artifactoryPassword before running artifactoryPublish"
}
-}
+} \ No newline at end of file
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 e308b14..7de2deb 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
@@ -43,10 +43,6 @@ public class WSlider extends WWidget {
@Nullable
private BackgroundPainter backgroundPainter = null;
- // Used for visuals and detecting dragging after the user starts dragging
- // on top of the slider, but then moves the mouse out but still within the widget's boundary.
-// private boolean dragging = false;
-
public WSlider(int min, int max, Axis axis) {
if (max <= min)
throw new IllegalArgumentException("Minimum value must be smaller than the maximum!");
@@ -96,10 +92,9 @@ public class WSlider extends WWidget {
@Override
public void onMouseDrag(int x, int y, int button) {
if (isFocused()) {
- //dragging = true;
int pos = (axis == Axis.VERTICAL ? (height - y) : x) - THUMB_SIZE / 2;
- int futureValue = min + (int) (valueToCoordRatio * pos);
- value = MathHelper.clamp(futureValue, min, max);
+ int rawValue = min + (int) (valueToCoordRatio * pos);
+ value = MathHelper.clamp(rawValue, min, max);
if (valueChangeListener != null) valueChangeListener.accept(value);
}
}