* Translated using Weblate (English (United States)) Currently translated at 100.0% (316 of 316 strings) Translation: Playlet/Playlet Translate-URL: https://hosted.weblate.org/projects/playlet/playlet/en_US/ * Translated using Weblate (German) Currently translated at 100.0% (316 of 316 strings) Translation: Playlet/Playlet Translate-URL: https://hosted.weblate.org/projects/playlet/playlet/de/ * Translated using Weblate (French (Canada)) Currently translated at 98.7% (312 of 316 strings) Translation: Playlet/Playlet Translate-URL: https://hosted.weblate.org/projects/playlet/playlet/fr_CA/ * Fix case * remove "unfinished" attribute * UI Refactor (#394) * Setting category refactor * tweak * Wip navbar * profile icon support * screen offset * Nav bar animation * Flexible navbar * initial focus fix * Fix settings * changelog * comment * Lint fix --------- Co-authored-by: Lacey Anaya <yecakeh263@anawalls.com> Co-authored-by: github-action linter <githubaction@githubaction.com>
31 lines
752 B
Plaintext
31 lines
752 B
Plaintext
import "pkg:/source/utils/FocusManagement.bs"
|
|
import "pkg:/source/utils/Types.bs"
|
|
|
|
function Init()
|
|
m.lastFocusedChild = invalid
|
|
m.top.observeField("focusedChild", FuncName(OnFocusedChildChange))
|
|
end function
|
|
|
|
function OnFocusChange() as void
|
|
if not m.top.focus
|
|
return
|
|
end if
|
|
|
|
focusNode = invalid
|
|
if m.lastFocusedChild <> invalid
|
|
focusNode = m.lastFocusedChild
|
|
else if m.top.getChildCount() > 0
|
|
focusNode = m.top.getChild(m.top.getChildCount() - 1)
|
|
end if
|
|
|
|
if focusNode <> invalid
|
|
NodeSetFocus(focusNode, true)
|
|
end if
|
|
end function
|
|
|
|
function OnFocusedChildChange() as void
|
|
if m.top.focusedChild <> invalid
|
|
m.lastFocusedChild = m.top.focusedChild
|
|
end if
|
|
end function
|