aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-02-14 16:30:39 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:50:09 +0200
commiteb10f6f4940ecd09fd7d881fe5e1735ff146f919 (patch)
treee293d3685382d32755169fbae75911f47d3fd4bd
parent43170592c914e8281870405f00baff75672e1528 (diff)
downloadmuhqs-game-eb10f6f4940ecd09fd7d881fe5e1735ff146f919.tar.gz
muhqs-game-eb10f6f4940ecd09fd7d881fe5e1735ff146f919.zip
only scroll to the maxima
-rw-r--r--go/ui/cardGrid.go9
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()
}