Class: UiViewStack
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:200
A stack of UI views.
UI views are registered with the stack and can be opened and closed within the stack as pages or popups. The stack has two layers: a main layer and an overlay layer. At any given time, the main layer contains one view opened as a page and zero or more views opened as popups, while the overlay layer contains zero or more views opened as popups. Views opened in the overlay layer always sit on top of views opened in the main layer. The open page is always located at the bottom of the main layer. The view stack keeps track of individual history states as views are opened and supports reverting to previous history states.
The view stack handles routing of UI interaction events to the appropriate open views in the stack. Additionally, bezel rotary knob label states requested by open views are processed and synthesized into a single knob label state based on which views have priority to handle the knob interaction events.
Implements
Constructors
Constructor
new UiViewStack(
uiService
):UiViewStack
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:243
Creates a new instance of UiViewStack.
Parameters
Parameter | Type | Description |
---|---|---|
uiService | UiService | The UI service controlling this view stack. |
Returns
UiViewStack
Properties
activeView
readonly
activeView:Subscribable
<RenderedViewEntry
<UiView
<UiViewProps
>>>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:225
This view stack's currently active view.
knobLabelState
readonly
knobLabelState:SubscribableMap
<UiKnobId
,string
> &Subscribable
<UiKnobRequestedLabelState
>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:235
This view stack's requested bezel rotary knob label state.
openPage
readonly
openPage:Subscribable
<RenderedViewEntry
<UiView
<UiViewProps
>>>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:229
This view stack's currently open page.
Methods
attachToContainer()
attachToContainer(
container
):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:329
Attaches this view stack to a container.
Parameters
Parameter | Type | Description |
---|---|---|
container | UiViewStackContainer | The container to which to attach. |
Returns
void
Throws
Error if this view stack has already been attached to a container.
changePageTo()
changePageTo<
T
>(key
):RenderedUiViewEntry
<T
>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:632
Opens a view as a page and changes the current page to the opened view. This will close the current page and any open popups.
Type Parameters
Type Parameter | Default type |
---|---|
T extends UiView <UiViewProps > | UiView <UiViewProps > |
Parameters
Parameter | Type | Description |
---|---|---|
key | string | The key of the view to open. |
Returns
The entry of the opened view.
Throws
Error if this view stack is not attached to a container, there is no view registered under the specified key, or the view to open is already open.
closeAllOverlayViews()
closeAllOverlayViews(
skipPopupCloseAnimation
):RenderedUiViewEntry
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:926
Returns to the most recent history state of this view stack in which the overlay layer contains no open views.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
skipPopupCloseAnimation | boolean | false | Whether to skip playing the close animations for popups. Defaults to false . |
Returns
The active view entry in this stack after the operation is complete.
Throws
Error if this view stack is not attached to a container.
goBack()
goBack():
RenderedUiViewEntry
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:840
Returns to the most recent previous history state of this view stack. If there is no previous history state to which to return, then this method does nothing.
Returns
The active view entry in this stack after the operation is complete.
Throws
Error if this view stack is not attached to a container.
goBackTo()
goBackTo(
selector
):RenderedUiViewEntry
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:899
Attempts to return to a previous history state of this view stack.
Parameters
Parameter | Type | Description |
---|---|---|
selector | (steps , stackPeeker ) => boolean | A function which selects the history state to which to return. The function is called once for each history state in order of increasing age and takes two arguments: the number of steps from the present state to the selected state and a function which allows one to peek into the selected state's view stack. The function should return true if the operation should return to the selected state and false otherwise. If the function returns false for every selected state, then the operation is aborted. |
Returns
The active view entry in this stack after the operation is complete.
goBackToEmptyPage()
goBackToEmptyPage(
skipPopupCloseAnimation
):RenderedUiViewEntry
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:1033
Returns to the history state of this view stack in which only the empty page is open.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
skipPopupCloseAnimation | boolean | false | Whether to skip playing the close animations for popups. Defaults to false . |
Returns
The active view entry in this stack after the operation is complete.
Throws
Error if this view stack is not attached to a container.
goBackToPage()
goBackToPage(
skipPopupCloseAnimation
):RenderedUiViewEntry
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:961
Returns to the most recent history state of this view stack in which the active view is the open page. If the current active view is the open page, then this method does nothing.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
skipPopupCloseAnimation | boolean | false | Whether to skip playing the close animations for popups. Defaults to false . |
Returns
The active view entry in this stack after the operation is complete.
Throws
Error if this view stack is not attached to a container.
isAwake()
isAwake():
boolean
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:292
Checks whether this view stack is awake.
Returns
boolean
Whether this view stack is awake.
onUiInteractionEvent()
onUiInteractionEvent(
event
):boolean
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:489
Handles a UiInteractionEvent.
Parameters
Parameter | Type | Description |
---|---|---|
event | UiInteractionEvent | The event to handle. |
Returns
boolean
Whether the event was handled.
Implementation of
UiInteractionHandler
.onUiInteractionEvent
openPopup()
openPopup<
T
>(layer
,key
,options?
):RenderedUiViewEntry
<T
>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:660
Opens a view as a popup. The opened view will be brought to the top of its view stack layer.
Type Parameters
Type Parameter | Default type |
---|---|
T extends UiView <UiViewProps > | UiView <UiViewProps > |
Parameters
Parameter | Type | Description |
---|---|---|
layer | UiViewStackLayer | The view stack layer in which to open the view. |
key | string | The key of the view to open. |
options? | Readonly <UiPopupOpenOptions > | Options describing how to open the popup. If not defined, then the popup will default to type 'normal' and with a background occlusion type of 'darken' . |
Returns
The entry of the opened view.
Throws
Error if this view stack is not attached to a container, there is no view registered under the specified key, or the view to open is already open.
registerView()
registerView(
layer
,lifecyclePolicy
,key
,factory
):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:401
Registers a view (page or popup) with this view stack. Once a view is registered, it may be opened by referencing its key.
Parameters
Parameter | Type | Description |
---|---|---|
layer | UiViewStackLayer | The view stack layer to which to assign the view. |
lifecyclePolicy | UiViewLifecyclePolicy | The lifecycle policy to apply to the view. |
key | string | The key to register the view under. |
factory | (uiService , containerRef ) => VNode | A function which renders the view. |
Returns
void
Throws
Error if the specified key is invalid.
resetViewAnimations()
resetViewAnimations():
void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:1090
Resets the open and closing animations of all views in this view stack. Closed views will immediately be hidden and open views will immediately become visible at their final positions.
Returns
void
sleep()
sleep():
void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:461
Puts this view stack to sleep.
Returns
void
update()
update(
time
):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:473
Updates this view stack. Has no effect if this view stack is asleep.
Parameters
Parameter | Type | Description |
---|---|---|
time | number | The current real (operating system) time, as a Javascript timestamp. |
Returns
void
visitHistory()
visitHistory(
visitor
):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:569
Visits each history state of this view stack.
Parameters
Parameter | Type | Description |
---|---|---|
visitor | (steps , stackPeeker ) => boolean | A function which will visit each history state. The function is called once for each history state in order of increasing age (beginning with the present state) and takes two arguments: the number of steps from the present state to the selected state and a function which allows one to peek into the selected state's view stack. The function should return true if visitation should continue and false if visitation should stop. |
Returns
void
wake()
wake():
void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiViewStack.tsx:450
Wakes this view stack.
Returns
void