diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-14 16:30:39 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 15:50:09 +0200 |
| commit | eb10f6f4940ecd09fd7d881fe5e1735ff146f919 (patch) | |
| tree | e293d3685382d32755169fbae75911f47d3fd4bd | |
| parent | 43170592c914e8281870405f00baff75672e1528 (diff) | |
| download | muhqs-game-eb10f6f4940ecd09fd7d881fe5e1735ff146f919.tar.gz muhqs-game-eb10f6f4940ecd09fd7d881fe5e1735ff146f919.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() } |
