Keyboard controls activate on key down instead of key up

This commit is contained in:
Sasha Koshka 2024-08-16 15:31:48 -04:00
parent 43ec7a0311
commit 114cbb346d
3 changed files with 3 additions and 3 deletions

View File

@ -90,12 +90,12 @@ func (this *Button) applyLayout () {
func (this *Button) handleKeyDown (key input.Key, numberPad bool) bool { func (this *Button) handleKeyDown (key input.Key, numberPad bool) bool {
if key != input.KeyEnter && key != input.Key(' ') { return false } if key != input.KeyEnter && key != input.Key(' ') { return false }
this.on.click.Broadcast()
return true return true
} }
func (this *Button) handleKeyUp (key input.Key, numberPad bool) bool { func (this *Button) handleKeyUp (key input.Key, numberPad bool) bool {
if key != input.KeyEnter && key != input.Key(' ') { return false } if key != input.KeyEnter && key != input.Key(' ') { return false }
this.on.click.Broadcast()
return true return true
} }

View File

@ -92,12 +92,12 @@ func (this *Dropdown) showMenu () {
func (this *Dropdown) handleKeyDown (key input.Key, numberPad bool) bool { func (this *Dropdown) handleKeyDown (key input.Key, numberPad bool) bool {
if key != input.KeyEnter && key != input.Key(' ') { return false } if key != input.KeyEnter && key != input.Key(' ') { return false }
this.showMenu()
return true return true
} }
func (this *Dropdown) handleKeyUp (key input.Key, numberPad bool) bool { func (this *Dropdown) handleKeyUp (key input.Key, numberPad bool) bool {
if key != input.KeyEnter && key != input.Key(' ') { return false } if key != input.KeyEnter && key != input.Key(' ') { return false }
this.showMenu()
return true return true
} }

View File

@ -172,12 +172,12 @@ func (this *Swatch) userSetValue (value color.Color) {
func (this *Swatch) handleKeyDown (key input.Key, numberPad bool) bool { func (this *Swatch) handleKeyDown (key input.Key, numberPad bool) bool {
if key != input.KeyEnter && key != input.Key(' ') { return false } if key != input.KeyEnter && key != input.Key(' ') { return false }
this.Choose()
return true return true
} }
func (this *Swatch) handleKeyUp (key input.Key, numberPad bool) bool { func (this *Swatch) handleKeyUp (key input.Key, numberPad bool) bool {
if key != input.KeyEnter && key != input.Key(' ') { return false } if key != input.KeyEnter && key != input.Key(' ') { return false }
this.Choose()
return true return true
} }