diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-14 16:30:39 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-01-27 16:43:49 +0100 |
| commit | 05de94b9d97079ca9a7b23e011516f55056472b3 (patch) | |
| tree | b2a38eddcc3513cf4db99e06aefbe96f7c0952fe | |
| parent | 2d83ae0035fdb88f8073d4b35a88d764dbbd58bf (diff) | |
| download | muhqs-game-05de94b9d97079ca9a7b23e011516f55056472b3.tar.gz muhqs-game-05de94b9d97079ca9a7b23e011516f55056472b3.zip | |
only scroll to the maxima
| -rw-r--r-- | go/ui/cardGrid.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/go/ui/cardGrid.go b/go/ui/cardGrid.go index 9ed92aa4..59e25f2c 100644 --- a/go/ui/cardGrid.go +++ b/go/ui/cardGrid.go @@ -179,5 +179,14 @@ func (w *CardGrid) Scroll(x, y int) { w.yOffset = 0 } + gridBounds := w.grid.Bounds() + if w.xOffset < -gridBounds.Dx()+w.Width { + w.xOffset = -gridBounds.Dx() + w.Width + } + + if w.yOffset < -gridBounds.Dy()+w.Height { + w.yOffset = -gridBounds.Dy() + w.Height + } + w.ForceRedraw() } |
