Skip to content

Commit 7b505a3

Browse files
authored
Fixed scuffed window scrolling animation (#503)
1 parent b363942 commit 7b505a3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/main/kotlin/com/lambda/client/gui/rgui/windows/ListWindow.kt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,16 @@ open class ListWindow(
131131
val maxScrollProgress = lastVisible?.let { max(it.posY + it.height + ClickGUI.verticalMargin + ClickGUI.resizeBar - height, 0.01f) }
132132
?: draggableHeight
133133

134-
scrollProgress = (scrollProgress + scrollSpeed)
135-
scrollSpeed *= 0.5f
134+
var newProgress = scrollProgress + scrollSpeed
136135

137136
if (!ClickGUI.scrollRubberband) {
138-
scrollProgress = scrollProgress.coerceIn(.0f, maxScrollProgress)
139-
prevScrollProgress = prevScrollProgress.coerceIn(.0f, maxScrollProgress)
140-
} else if (scrollTimer.tick(100L, false)) {
137+
newProgress = newProgress.coerceIn(0.0f, maxScrollProgress)
138+
}
139+
140+
scrollProgress = newProgress
141+
scrollSpeed *= 0.5f
142+
143+
if (scrollTimer.tick(100L, false)) {
141144
if (scrollProgress < 0) {
142145
scrollSpeed = scrollProgress * -ClickGUI.scrollRubberbandSpeed
143146
} else if (scrollProgress > maxScrollProgress) {

0 commit comments

Comments
 (0)