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() }