|
@@ -21198,10 +21198,10 @@ var WebXRManagedOutputCanvas = /** @class */ (function () {
|
|
|
/**
|
|
|
* Initializes the canvas to be added/removed upon entering/exiting xr
|
|
|
* @param engine the Babylon engine
|
|
|
- * @param onStateChangedObservable the mechanism by which the canvas will be added/removed based on XR state
|
|
|
* @param canvas The canvas to be added/removed (If not specified a full screen canvas will be created)
|
|
|
+ * @param onStateChangedObservable the mechanism by which the canvas will be added/removed based on XR state
|
|
|
*/
|
|
|
- function WebXRManagedOutputCanvas(engine, onStateChangedObservable, canvas) {
|
|
|
+ function WebXRManagedOutputCanvas(engine, canvas, onStateChangedObservable) {
|
|
|
var _this = this;
|
|
|
this._canvas = null;
|
|
|
/**
|
|
@@ -21214,15 +21214,17 @@ var WebXRManagedOutputCanvas = /** @class */ (function () {
|
|
|
canvas.style.cssText = "position:absolute; bottom:0px;right:0px;z-index:10;width:90%;height:100%;background-color: #000000;";
|
|
|
}
|
|
|
this._setManagedOutputCanvas(canvas);
|
|
|
- onStateChangedObservable.add(function (stateInfo) {
|
|
|
- if (stateInfo == _webXRTypes__WEBPACK_IMPORTED_MODULE_0__["WebXRState"].ENTERING_XR) {
|
|
|
- // The canvas is added to the screen before entering XR because currently the xr session must be initialized while the canvas is added render properly
|
|
|
- _this._addCanvas();
|
|
|
- }
|
|
|
- else if (stateInfo == _webXRTypes__WEBPACK_IMPORTED_MODULE_0__["WebXRState"].NOT_IN_XR) {
|
|
|
- _this._removeCanvas();
|
|
|
- }
|
|
|
- });
|
|
|
+ if (onStateChangedObservable) {
|
|
|
+ onStateChangedObservable.add(function (stateInfo) {
|
|
|
+ if (stateInfo == _webXRTypes__WEBPACK_IMPORTED_MODULE_0__["WebXRState"].ENTERING_XR) {
|
|
|
+ // The canvas is added to the screen before entering XR because currently the xr session must be initialized while the canvas is added render properly
|
|
|
+ _this._addCanvas();
|
|
|
+ }
|
|
|
+ else if (stateInfo == _webXRTypes__WEBPACK_IMPORTED_MODULE_0__["WebXRState"].NOT_IN_XR) {
|
|
|
+ _this._removeCanvas();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
/**
|
|
|
* Initializes the xr layer for the session
|
|
@@ -21480,7 +21482,7 @@ var WebXRSessionManager = /** @class */ (function () {
|
|
|
return this._xrNavigator.xr.getWebXRRenderTarget(this.scene.getEngine());
|
|
|
}
|
|
|
else {
|
|
|
- return new _webXRManagedOutputCanvas__WEBPACK_IMPORTED_MODULE_4__["WebXRManagedOutputCanvas"](this.scene.getEngine(), onStateChangedObservable, this.scene.getEngine().getRenderingCanvas());
|
|
|
+ return new _webXRManagedOutputCanvas__WEBPACK_IMPORTED_MODULE_4__["WebXRManagedOutputCanvas"](this.scene.getEngine(), this.scene.getEngine().getRenderingCanvas(), onStateChangedObservable);
|
|
|
}
|
|
|
};
|
|
|
/**
|