From 67b5ff16d4b97859330a4715965d63363faf0d2c Mon Sep 17 00:00:00 2001
From: NN <124319186+N-Nels0n@users.noreply.github.com>
Date: Sun, 26 Feb 2023 15:10:41 -0500
Subject: [PATCH] Fixed scuffed window scrolling animation

---
 .../lambda/client/gui/rgui/windows/ListWindow.kt    | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/main/kotlin/com/lambda/client/gui/rgui/windows/ListWindow.kt b/src/main/kotlin/com/lambda/client/gui/rgui/windows/ListWindow.kt
index 6917c5444..f3d3a1e3b 100644
--- a/src/main/kotlin/com/lambda/client/gui/rgui/windows/ListWindow.kt
+++ b/src/main/kotlin/com/lambda/client/gui/rgui/windows/ListWindow.kt
@@ -131,13 +131,16 @@ open class ListWindow(
         val maxScrollProgress = lastVisible?.let { max(it.posY + it.height + ClickGUI.verticalMargin + ClickGUI.resizeBar - height, 0.01f) }
             ?: draggableHeight
 
-        scrollProgress = (scrollProgress + scrollSpeed)
-        scrollSpeed *= 0.5f
+        var newProgress = scrollProgress + scrollSpeed
 
         if (!ClickGUI.scrollRubberband) {
-            scrollProgress = scrollProgress.coerceIn(.0f, maxScrollProgress)
-            prevScrollProgress = prevScrollProgress.coerceIn(.0f, maxScrollProgress)
-        } else if (scrollTimer.tick(100L, false)) {
+            newProgress = newProgress.coerceIn(0.0f, maxScrollProgress)
+        }
+
+        scrollProgress = newProgress
+        scrollSpeed *= 0.5f
+
+        if (scrollTimer.tick(100L, false)) {
             if (scrollProgress < 0) {
                 scrollSpeed = scrollProgress * -ClickGUI.scrollRubberbandSpeed
             } else if (scrollProgress > maxScrollProgress) {