From 82b8521a6cce471b8bbbef4af824286af7045c84 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 12 Oct 2024 20:46:33 +0900 Subject: [PATCH] examples/scroll: normalize the offset Y later This change is effective when the number of items is small. --- examples/scroll/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/scroll/main.go b/examples/scroll/main.go index d6af27297..00889dcd2 100644 --- a/examples/scroll/main.go +++ b/examples/scroll/main.go @@ -135,13 +135,13 @@ func (g *Game) Update() error { func (g *Game) setOffsetY(offsetY int) { g.offsetY = offsetY - if g.offsetY > 0 { - g.offsetY = 0 - } h := g.contentHeight() if g.offsetY < -h+g.contentArea.Dy() { g.offsetY = -h + g.contentArea.Dy() } + if g.offsetY > 0 { + g.offsetY = 0 + } } func (g *Game) contentHeight() int {