Selaa lähdekoodia

Editor: Added Menubar/View/Fullscreen

Mr.doob 4 vuotta sitten
vanhempi
commit
1a0367060d
2 muutettua tiedostoa jossa 25 lisäystä ja 3 poistoa
  1. 23 3
      editor/js/Menubar.View.js
  2. 2 0
      editor/js/Menubar.js

+ 23 - 3
editor/js/Menubar.View.js

@@ -14,14 +14,34 @@ function MenubarView( editor ) {
 	options.setClass( 'options' );
 	container.add( options );
 
-	// VR mode
+	// Fullscreen
 
 	var option = new UIRow();
 	option.setClass( 'option' );
-	option.setTextContent( 'VR mode' );
+	option.setTextContent( 'Fullscreen' );
 	option.onClick( function () {
 
-		editor.signals.enterVR.dispatch();
+		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 );

+ 2 - 0
editor/js/Menubar.js

@@ -4,6 +4,7 @@ import { MenubarAdd } from './Menubar.Add.js';
 import { MenubarEdit } from './Menubar.Edit.js';
 import { MenubarFile } from './Menubar.File.js';
 import { MenubarExamples } from './Menubar.Examples.js';
+import { MenubarView } from './Menubar.View.js';
 import { MenubarHelp } from './Menubar.Help.js';
 import { MenubarPlay } from './Menubar.Play.js';
 import { MenubarStatus } from './Menubar.Status.js';
@@ -18,6 +19,7 @@ function Menubar( editor ) {
 	container.add( new MenubarAdd( editor ) );
 	container.add( new MenubarPlay( editor ) );
 	container.add( new MenubarExamples( editor ) );
+	container.add( new MenubarView( editor ) );
 	container.add( new MenubarHelp( editor ) );
 
 	container.add( new MenubarStatus( editor ) );