Skip to main content

Class: UiFocusController

A controller for setting focus on UI components.

Implements

Constructors

constructor

new UiFocusController(validKnobIds?): UiFocusController

Creates a new instance of UiFocusController. The controller is initialized to the inactive state.

Parameters

NameTypeDescription
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

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiFocusController.ts:40

Properties

focusedComponent

Readonly focusedComponent: Subscribable<null | UiFocusableComponent>

The component currently focused by this controller, or null if there is no such component.

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiFocusController.ts:22


knobLabelState

Readonly knobLabelState: SubscribableMap<UiKnobId, string>

The bezel rotary knob label state requested by this controller.

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiFocusController.ts:26


registeredComponents

Readonly registeredComponents: readonly UiFocusableComponent[]

The components registered with this controller.

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiFocusController.ts:16

Methods

clearRecentFocus

clearRecentFocus(): void

Clears this controller's memory of the most recently focused component. Has no effect if a component is currently focused.

Returns

void

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiFocusController.ts:233


deregister

deregister(component): void

Deregisters a component with this controller. Once deregistered, the component can no longer be focused by this controller.

Parameters

NameTypeDescription
componentUiFocusableComponentThe component to deregister.

Returns

void

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiFocusController.ts:64


destroy

destroy(): void

Destroys this controller.

Returns

void

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiFocusController.ts:315


focusFirst

focusFirst(direction?): void

Attempts to change focus to the first registered focusable component.

Parameters

NameTypeDefault valueDescription
directionUiFocusDirectionUiFocusDirection.UnspecifiedThe direction from which to set focus on the component. Defaults to UiFocusDirection.Unspecified.

Returns

void

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiFocusController.ts:176


focusLast

focusLast(direction?): void

Attempts to change focus to the last registered focusable component.

Parameters

NameTypeDefault valueDescription
directionUiFocusDirectionUiFocusDirection.UnspecifiedThe direction from which to set focus on the component. Defaults to UiFocusDirection.Unspecified.

Returns

void

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiFocusController.ts:190


focusNext

focusNext(): void

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

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiFocusController.ts:204


focusPrevious

focusPrevious(): void

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

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiFocusController.ts:213


focusRecent

focusRecent(): void

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

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiFocusController.ts:221


onUiInteractionEvent

onUiInteractionEvent(event): boolean

Handles a UiInteractionEvent.

Parameters

NameTypeDescription
eventUiInteractionEventThe event to handle.

Returns

boolean

Whether the event was handled.

Implementation of

UiInteractionHandler.onUiInteractionEvent

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiFocusController.ts:242


register

register(component): void

Registers a component with this controller. Once registered, the component can be focused by this controller.

Parameters

NameTypeDescription
componentUiFocusableComponentThe component to register.

Returns

void

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiFocusController.ts:50


removeFocus

removeFocus(component?): void

Removes focus from a focused component.

Parameters

NameTypeDescription
component?UiFocusableComponentThe component from which to remove focus. Defaults to the component currently focused by this controller.

Returns

void

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiFocusController.ts:158


setActive

setActive(active): void

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

NameTypeDescription
activebooleanWhether to activate this controller.

Returns

void

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiFocusController.ts:89


setFocus

setFocus(component, direction?): void

Sets focus on a registered component. If this controller is not active, then this method does nothing.

Parameters

NameTypeDefault valueDescription
componentUiFocusableComponentundefinedThe component on which to set focus. If the component is not registered with this controller, then focus will not be set.
directionUiFocusDirectionUiFocusDirection.UnspecifiedThe direction from which to set focus on the component. Defaults to UiFocusDirection.Unspecified.

Returns

void

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiFocusController.ts:118


setFocusIndex

setFocusIndex(index, direction?): void

Sets focus on a registered component by index. If this controller is not active, then this method does nothing.

Parameters

NameTypeDefault valueDescription
indexnumberundefinedThe index of the component on which to set focus. If the index is out of bounds, then focus will not be set.
directionUiFocusDirectionUiFocusDirection.UnspecifiedThe direction from which to set focus on the component. Defaults to UiFocusDirection.Unspecified.

Returns

void

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiFocusController.ts:133