aboutsummaryrefslogtreecommitdiff
path: root/go/ui
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/ui
parent39600819ddda75248828c0e2fd8aa988fd72d0a2 (diff)
downloadmuhqs-game-785c53142cf17e3b1488b01f51ee9868e6f41416.tar.gz
muhqs-game-785c53142cf17e3b1488b01f51ee9868e6f41416.zip
present reset button on top of prompt
Diffstat (limited to 'go/ui')
-rw-r--r--go/ui/collection.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/go/ui/collection.go b/go/ui/collection.go
index f60f5f3b..d4c2cd69 100644
--- a/go/ui/collection.go
+++ b/go/ui/collection.go
@@ -50,6 +50,16 @@ func (c *Collection) AddWidget(w Widget) {
if slices.Contains(c.widgets, w) {
log.Panicf("Double insertion of %v", w)
}
+ log.Println("add", w)
+ c.widgets = append(c.widgets, w)
+}
+
+// MoveIdxToLast shifts the widget at index idx to the last position.
+func (c *Collection) MoveIdxToLast(idx int) {
+ w := c.widgets[idx]
+ after := c.widgets[idx+1:]
+ c.widgets = c.widgets[:idx]
+ c.widgets = append(c.widgets, after...)
c.widgets = append(c.widgets, w)
}