DOM Overlay provides the ability to use DOM elements as an overlay in a WebXR AR session. It
requires that the root DOM element is provided for session start. That way, input source select
events are first tested against DOM Elements and then propagated down to the XR Session. If this
propagation is not desirable, use the
beforexrselect event on a DOM element and the
preventDefault function to stop propagation.
app.xr.domOverlay.root = element;
app.xr.start(camera, pc.XRTYPE_AR, pc.XRSPACE_LOCALFLOOR);
True if DOM Overlay is available.
The DOM element to be used as the root for DOM Overlay.
State of the DOM Overlay, which defines how the root DOM element is rendered.
True if DOM Overlay is supported.
True if DOM Overlay is available. It can only be available if it is supported, during a valid WebXR session and if a valid root element is provided.
The DOM element to be used as the root for DOM Overlay. Can be changed only outside of an active WebXR session.
app.xr.domOverlay.root = element; app.xr.start(camera, pc.XRTYPE_AR, pc.XRSPACE_LOCALFLOOR);
State of the DOM Overlay, which defines how the root DOM element is rendered. Possible options:
- screen: Screen - indicates that the DOM element is covering whole physical screen, matching XR viewports.
- floating: Floating - indicates that the underlying platform renders the DOM element as floating in space, which can move during the WebXR session or allow the application to move the element.
- head-locked: Head Locked - indicates that the DOM element follows the user's head movement consistently, appearing similar to a helmet heads-up display.