From 8469962c90b2f93519580d3cfd1cc53fa7e60d63 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Sat, 24 Aug 2024 14:32:19 -0400 Subject: [PATCH] Use key/button functions for menu --- menu.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/menu.go b/menu.go index 2da29b9..fe58d04 100644 --- a/menu.go +++ b/menu.go @@ -92,20 +92,20 @@ func (this *Menu) newTearLine () tomo.Object { tearLine.SetRole(tomo.R("objects", "TearLine")) tearLine.SetFocusable(true) tearLine.OnKeyDown(func (key input.Key, numberPad bool) bool { - if key != input.KeyEnter && key != input.Key(' ') { return false } + if !isClickingKey(key) { return false } return true }) tearLine.OnKeyUp(func (key input.Key, numberPad bool) bool { - if key != input.KeyEnter && key != input.Key(' ') { return false } + if !isClickingKey(key) { return false } this.TearOff() return true }) tearLine.OnButtonDown(func (button input.Button) bool { - if button != input.ButtonLeft { return false } + if !isClickingButton(button) { return false } return true }) tearLine.OnButtonUp(func (button input.Button) bool { - if button != input.ButtonLeft { return false } + if !isClickingButton(button) { return false } if tearLine.Window().MousePosition().In(tearLine.Bounds()) { this.TearOff() }