Reset text scrolling at the wrap boundary

This commit is contained in:
maze committed 2026-10-29 17:30:04 +01:00
1 parent e887fdba8e
commit bc2460caf1
1 file changed
+2 -2
+2 -2
View File
@@ -135,9 +135,9 @@ func (w *Text) Refresh(ctx app.Context) bool {
scrollRequired := textWidth > bounds.Dx() scrollRequired := textWidth > bounds.Dx()
if scrollRequired && w.scrollDir != 0 && now.Sub(w.scrollLast) >= w.scrollRate { if scrollRequired && w.scrollDir != 0 && now.Sub(w.scrollLast) >= w.scrollRate {
w.scroll.X += w.scrollDir w.scroll.X += w.scrollDir
if w.scroll.X > (textWidth + w.scrollGap) { if w.scroll.X >= (textWidth + w.scrollGap) {
w.scroll.X = 0 w.scroll.X = 0
} else if w.scroll.X < -(textWidth + w.scrollGap) { } else if w.scroll.X <= -(textWidth + w.scrollGap) {
w.scroll.X = 0 w.scroll.X = 0
} }
w.scrollLast = now w.scrollLast = now