1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- import { UIPanel, UIRow } from './libs/ui.js';
- function MenubarView( editor ) {
- var strings = editor.strings;
- var container = new UIPanel();
- container.setClass( 'menu' );
- var title = new UIPanel();
- title.setClass( 'title' );
- title.setTextContent( strings.getKey( 'menubar/view' ) );
- container.add( title );
- var options = new UIPanel();
- options.setClass( 'options' );
- container.add( options );
- // Fullscreen
- var option = new UIRow();
- option.setClass( 'option' );
- option.setTextContent( strings.getKey( 'menubar/view/fullscreen' ) );
- option.onClick( function () {
- if ( document.fullscreenElement === null ) {
- document.documentElement.requestFullscreen();
- } else if ( document.exitFullscreen ) {
- document.exitFullscreen();
- }
- // Safari
- if ( document.webkitFullscreenElement === null ) {
- document.documentElement.webkitRequestFullscreen();
- } else if ( document.webkitExitFullscreen ) {
- document.webkitExitFullscreen();
- }
- } );
- options.add( option );
- // VR (Work in progress)
- if ( 'xr' in navigator ) {
- navigator.xr.isSessionSupported( 'immersive-vr' )
- .then( function ( supported ) {
- if ( supported ) {
- var option = new UIRow();
- option.setClass( 'option' );
- option.setTextContent( 'VR' );
- option.onClick( function () {
- editor.signals.toggleVR.dispatch();
- } );
- options.add( option );
- }
- } );
- }
- return container;
- }
- export { MenubarView };
|