UIManager

UIManager

The UIManager is a ViewService with the public name "UIManager". It manages the widget user interface. Do not instantiate the UIManager directly. Instead, add the UIManager as a view service in the ViewRoot. You should also add the InputManager, since the UIManager depends upon InputManager events.

The UIManager republishes pointer events that don't interact with any control widgets. Sometimes you may want to have a 2D UI that floats above a 3D scene, and let the user click on both. By subscribing to the republished events from the UIManager, you'll only get the clicks that actually fall in the 3D scene. For example:

this.subscribe("input", "pointerDown", this.onPointerDown); // Handle any pointerDown event anywhere in the window
this.subsribe("ui", "pointerDown", this.onPointerDown); // Handle only pointerDown events that are not handled by widgets

Extends

  • ViewService

Members

# root :CanvasWidget

The UIManager creates a single root CanvasWidget that fills the entire application window Other widgets that you create should be added as children to this root widget.

Type:
Example:
const ui = this.service("UIManager");
const myWidget = new Widget({parent: ui.root});