|
@@ -2,6 +2,7 @@ import { UIPanel, UIRow } from './libs/ui.js';
|
|
|
|
|
|
function MenubarView( editor ) {
|
|
|
|
|
|
+ const signals = editor.signals;
|
|
|
const strings = editor.strings;
|
|
|
|
|
|
const container = new UIPanel();
|
|
@@ -48,50 +49,58 @@ function MenubarView( editor ) {
|
|
|
} );
|
|
|
options.add( option );
|
|
|
|
|
|
- // VR (Work in progress)
|
|
|
+ // XR (Work in progress)
|
|
|
|
|
|
if ( 'xr' in navigator ) {
|
|
|
|
|
|
- navigator.xr.isSessionSupported( 'immersive-ar' )
|
|
|
- .then( function ( supported ) {
|
|
|
+ if ( 'offerSession' in navigator.xr ) {
|
|
|
|
|
|
- if ( supported ) {
|
|
|
+ signals.offerXR.dispatch( 'immersive-ar' );
|
|
|
|
|
|
- const option = new UIRow();
|
|
|
- option.setClass( 'option' );
|
|
|
- option.setTextContent( 'AR' );
|
|
|
- option.onClick( function () {
|
|
|
+ } else {
|
|
|
|
|
|
- editor.signals.enterXR.dispatch( 'immersive-ar' );
|
|
|
+ navigator.xr.isSessionSupported( 'immersive-ar' )
|
|
|
+ .then( function ( supported ) {
|
|
|
|
|
|
- } );
|
|
|
- options.add( option );
|
|
|
+ if ( supported ) {
|
|
|
|
|
|
- } else {
|
|
|
+ const option = new UIRow();
|
|
|
+ option.setClass( 'option' );
|
|
|
+ option.setTextContent( 'AR' );
|
|
|
+ option.onClick( function () {
|
|
|
|
|
|
- navigator.xr.isSessionSupported( 'immersive-vr' )
|
|
|
- .then( function ( supported ) {
|
|
|
+ signals.enterXR.dispatch( 'immersive-ar' );
|
|
|
|
|
|
- if ( supported ) {
|
|
|
+ } );
|
|
|
+ options.add( option );
|
|
|
|
|
|
- const option = new UIRow();
|
|
|
- option.setClass( 'option' );
|
|
|
- option.setTextContent( 'VR' );
|
|
|
- option.onClick( function () {
|
|
|
+ } else {
|
|
|
|
|
|
- editor.signals.enterXR.dispatch( 'immersive-vr' );
|
|
|
+ navigator.xr.isSessionSupported( 'immersive-vr' )
|
|
|
+ .then( function ( supported ) {
|
|
|
|
|
|
- } );
|
|
|
- options.add( option );
|
|
|
+ if ( supported ) {
|
|
|
|
|
|
- }
|
|
|
+ const option = new UIRow();
|
|
|
+ option.setClass( 'option' );
|
|
|
+ option.setTextContent( 'VR' );
|
|
|
+ option.onClick( function () {
|
|
|
|
|
|
- } );
|
|
|
+ signals.enterXR.dispatch( 'immersive-vr' );
|
|
|
+
|
|
|
+ } );
|
|
|
+ options.add( option );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ } );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
} );
|
|
|
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
return container;
|