aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-07-04 12:19:15 -0400
committerFlorian Fischer <florian.fischer@muhq.space>2025-07-06 11:49:19 -0400
commit8d3e8065ecc5dd5aeb4233a15c72613f373689ad (patch)
treec8f05f9e9c8ae325d0a9e18eb81110cff6394c16
parent292df3582ca35bffc1c9d2254a433586cc41120e (diff)
downloadmuhqs-game-8d3e8065ecc5dd5aeb4233a15c72613f373689ad.tar.gz
muhqs-game-8d3e8065ecc5dd5aeb4233a15c72613f373689ad.zip
switch focus on tap or click
-rw-r--r--go/ui/collection.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/go/ui/collection.go b/go/ui/collection.go
index dfd5fbb5..f60f5f3b 100644
--- a/go/ui/collection.go
+++ b/go/ui/collection.go
@@ -168,7 +168,9 @@ func (c *Collection) Update() error {
w.Click(ev.X, ev.Y)
ConsumeInput(i)
}
- // TODO: switch focus
+ if w.IsFocusable() && (ev.Kind != Click || ev.Ctx.(ClickCtx).Btn == ebiten.MouseButtonLeft) {
+ c.switchFocus(w)
+ }
case Scroll, Pan:
if w.IsScrollable() {
s := ev.Ctx.(DistanceCtx)