From d5dc2d81bd7632978adcc9ed9faa512890b731ef Mon Sep 17 00:00:00 2001 From: cottongin Date: Wed, 18 Mar 2026 05:18:53 -0400 Subject: [PATCH] fix: scroll only until text exits screen Was scrolling an extra container-width of invisible distance after the text had already left the screen, adding ~11s of dead time. Now scrolls to -textWidthPx (text just off-screen) instead of -(textWidthPx + containerWidthPx). Made-with: Cursor --- .../radio247/ui/screens/nowplaying/NowPlayingScreen.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/xyz/cottongin/radio247/ui/screens/nowplaying/NowPlayingScreen.kt b/app/src/main/java/xyz/cottongin/radio247/ui/screens/nowplaying/NowPlayingScreen.kt index 35db5ed..3a46140 100644 --- a/app/src/main/java/xyz/cottongin/radio247/ui/screens/nowplaying/NowPlayingScreen.kt +++ b/app/src/main/java/xyz/cottongin/radio247/ui/screens/nowplaying/NowPlayingScreen.kt @@ -473,8 +473,7 @@ private fun TickerText( if (overflowPx > 0f) { key(text) { val velocityPxPerMs = with(density) { velocityDpPerSecond.dp.toPx() } / 1000f - val totalScrollPx = textWidthPx + containerWidthPx - val scrollMs = (totalScrollPx / velocityPxPerMs).toInt() + val scrollMs = (textWidthPx / velocityPxPerMs).toInt() val offset = remember { Animatable(0f) } val alpha = remember { Animatable(0f) } @@ -487,7 +486,7 @@ private fun TickerText( while (true) { offset.animateTo( - -totalScrollPx, + -textWidthPx, tween(scrollMs, easing = LinearEasing) ) offset.snapTo(0f)