Scene Stack

Scenes allow for complex behavior. A default root scene is created when a UI's Main template is instantiated. Additional scenes can be created using a Scene Node.

Managing the Scene Stack#

When the show impulse on a Scene Node is triggered the node's referenced template is instantiated as a new root. This new root, or scene, is placed on a logical stack. By default, it will draw above all scenes below it, although this can be overridden with the layer property. A scene can be removed by triggering the hide impulse on the same Scene Node that show was triggered. The scene node's referenced template can also remove the scene it's the root of by triggering the removeSelf impulse on a Scene Stack Node. When a scene is removed all scene's above it on the stack, that is scenes that were shown after this one was created, will be removed as well.

Focus Scope#

Each scene can optionally have a view focused independently of all other scenes. Key event are dispatched to the top-most scene with a focused view. If nothing blocks or captures an event in the scene it will be dispatched to the next scene on the stack.

In the pictured desk phone example UI, there are two scenes that both have focus. The text input view is focused and maintains the cursor position and selection information. When a keypad button is pressed, the dark gray character selection scene is opened, giving the user an opportunity to select the character they wish to insert.

Both scenes are focused simultaneously, but the character selection scene is on top and captures all key events, preventing them from reaching the editable text view.