mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-23 09:22:01 +01:00
examples/scroll: normalize the offset Y later
This change is effective when the number of items is small.
This commit is contained in:
parent
c784e88dfe
commit
82b8521a6c
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user