Class: UiFocusController
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiFocusController.ts:11
A controller for setting focus on UI components.
Implements
Constructors
Constructor
new UiFocusController(
validKnobIds?
):UiFocusController
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiFocusController.ts:40
Creates a new instance of UiFocusController. The controller is initialized to the inactive state.
Parameters
Parameter | Type | Description |
---|---|---|
validKnobIds? | Iterable <UiKnobId > | The IDs of the valid bezel rotary knobs that can be used to change the component focused by the new controller. If not defined, then knobs cannot be used to change the component focused by the controller. |
Returns
UiFocusController
Properties
focusedComponent
readonly
focusedComponent:Subscribable
<null
|UiFocusableComponent
>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiFocusController.ts:22
The component currently focused by this controller, or null
if there is no such component.
knobLabelState
readonly
knobLabelState:SubscribableMap
<UiKnobId
,string
>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiFocusController.ts:26
The bezel rotary knob label state requested by this controller.
registeredComponents
readonly
registeredComponents: readonlyUiFocusableComponent
[]
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiFocusController.ts:16
The components registered with this controller.
Methods
clearRecentFocus()
clearRecentFocus():
void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiFocusController.ts:233
Clears this controller's memory of the most recently focused component. Has no effect if a component is currently focused.
Returns
void
deregister()
deregister(
component
):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiFocusController.ts:64
Deregisters a component with this controller. Once deregistered, the component can no longer be focused by this controller.
Parameters
Parameter | Type | Description |
---|---|---|
component | UiFocusableComponent | The component to deregister. |
Returns
void
destroy()
destroy():
void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiFocusController.ts:315
Destroys this controller.
Returns
void
focusFirst()
focusFirst(
direction
):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiFocusController.ts:176
Attempts to change focus to the first registered focusable component.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
direction | UiFocusDirection | UiFocusDirection.Unspecified | The direction from which to set focus on the component. Defaults to UiFocusDirection.Unspecified. |
Returns
void
focusLast()
focusLast(
direction
):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiFocusController.ts:190
Attempts to change focus to the last registered focusable component.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
direction | UiFocusDirection | UiFocusDirection.Unspecified | The direction from which to set focus on the component. Defaults to UiFocusDirection.Unspecified. |
Returns
void
focusNext()
focusNext():
void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiFocusController.ts:204
Attempts to change focus to the next registered focusable component after the currently focused component. If there is no currently focused component, then attempts to focus the registered focusable component with the smallest index.
Returns
void
focusPrevious()
focusPrevious():
void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiFocusController.ts:213
Attempts to change focus to the previous registered focusable component before the currently focused component. If there is no currently focused component, then attempts to focus the registered focusable component with the largest index.
Returns
void
focusRecent()
focusRecent():
void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiFocusController.ts:221
Attempts to change focus to the most recently focused component. Has no effect if a component is currently focused or if there is no most recently focused component.
Returns
void
onUiInteractionEvent()
onUiInteractionEvent(
event
):boolean
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiFocusController.ts:242
Handles a UiInteractionEvent.
Parameters
Parameter | Type | Description |
---|---|---|
event | UiInteractionEvent | The event to handle. |
Returns
boolean
Whether the event was handled.
Implementation of
UiInteractionHandler
.onUiInteractionEvent
register()
register(
component
):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiFocusController.ts:50
Registers a component with this controller. Once registered, the component can be focused by this controller.
Parameters
Parameter | Type | Description |
---|---|---|
component | UiFocusableComponent | The component to register. |
Returns
void
removeFocus()
removeFocus(
component?
):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiFocusController.ts:158
Removes focus from a focused component.
Parameters
Parameter | Type | Description |
---|---|---|
component? | UiFocusableComponent | The component from which to remove focus. Defaults to the component currently focused by this controller. |
Returns
void
setActive()
setActive(
active
):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiFocusController.ts:89
Sets whether this controller is active. This controller can only set focus on components when it is active. If this controller is deactivated, then any component focused by this controller will immediately lose focus.
Parameters
Parameter | Type | Description |
---|---|---|
active | boolean | Whether to activate this controller. |
Returns
void
setFocus()
setFocus(
component
,direction
):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiFocusController.ts:118
Sets focus on a registered component. If this controller is not active, then this method does nothing.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
component | UiFocusableComponent | undefined | The component on which to set focus. If the component is not registered with this controller, then focus will not be set. |
direction | UiFocusDirection | UiFocusDirection.Unspecified | The direction from which to set focus on the component. Defaults to UiFocusDirection.Unspecified. |
Returns
void
setFocusIndex()
setFocusIndex(
index
,direction
):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiFocusController.ts:133
Sets focus on a registered component by index. If this controller is not active, then this method does nothing.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
index | number | undefined | The index of the component on which to set focus. If the index is out of bounds, then focus will not be set. |
direction | UiFocusDirection | UiFocusDirection.Unspecified | The direction from which to set focus on the component. Defaults to UiFocusDirection.Unspecified. |
Returns
void