From ff9d53f7bcf8719578a6b87ec697fa6957bd209c Mon Sep 17 00:00:00 2001
From: Juuxel <kasperi.kauppi@gmail.com>
Date: Tue, 27 Aug 2019 21:28:46 +0300
Subject: Some slider cleanup

---
 src/main/java/io/github/cottonmc/cotton/gui/widget/WSlider.java | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

(limited to 'src/main')

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);
 		}
 	}
-- 
cgit