Removed a bunch of redundant draw calls

Most were related to a but with the keynav api
This commit is contained in:
2023-02-09 01:30:14 -05:00
parent ce20b7d02c
commit 16a0e76145
5 changed files with 37 additions and 20 deletions

View File

@@ -37,9 +37,14 @@ func (core *FocusableCore) Focused () (focused bool) {
// Focus focuses this element, if its parent element grants the request.
func (core *FocusableCore) Focus () {
if !core.enabled { return }
if !core.enabled || core.focused { return }
if core.onFocusRequest != nil {
core.onFocusRequest()
if core.onFocusRequest() {
core.focused = true
if core.drawFocusChange != nil {
core.drawFocusChange()
}
}
}
}
@@ -55,9 +60,11 @@ func (core *FocusableCore) HandleFocus (
if core.focused && direction != input.KeynavDirectionNeutral {
return false
}
core.focused = true
if core.drawFocusChange != nil { core.drawFocusChange() }
if core.focused == false {
core.focused = true
if core.drawFocusChange != nil { core.drawFocusChange() }
}
return true
}