aboutsummaryrefslogtreecommitdiff
path: root/go/client
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-07-22 16:16:13 -0400
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:57:28 +0200
commit785c53142cf17e3b1488b01f51ee9868e6f41416 (patch)
tree65d0abd44e73b45170d5e0470698190782249e1e /go/client
parent39600819ddda75248828c0e2fd8aa988fd72d0a2 (diff)
downloadmuhqs-game-785c53142cf17e3b1488b01f51ee9868e6f41416.tar.gz
muhqs-game-785c53142cf17e3b1488b01f51ee9868e6f41416.zip
present reset button on top of prompt
Diffstat (limited to 'go/client')
-rw-r--r--go/client/game.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/go/client/game.go b/go/client/game.go
index 19677ea5..5718371b 100644
--- a/go/client/game.go
+++ b/go/client/game.go
@@ -96,7 +96,7 @@ func newGame(app *app, gameState game.State) *Game {
g.resetButton = ui.NewRoundSimpleButton(
10,
- g.Height/2+DEFAULT_BUTTON_HEIGHT/2,
+ g.Height/2,
DEFAULT_BUTTON_HEIGHT,
"X",
func(*ui.SimpleButton) {
@@ -395,10 +395,13 @@ func (g *Game) declareAction(a game.Action) {
g.stateBar.ForceRedraw()
}
-// show a widget by adding it to the collection
+// show ensures a widget is visible by adding it to the collection or moving it to the last position.
func (g *Game) show(w ui.Widget) {
- if g.FindWidget(w) == -1 {
+ idx := g.FindWidget(w)
+ if idx == -1 {
g.AddWidget(w)
+ } else {
+ g.MoveIdxToLast(idx)
}
}