Pārlūkot izejas kodu

Editor: Added Menubar.Play.

Mr.doob 11 gadi atpakaļ
vecāks
revīzija
e3d6bde9d7
4 mainītis faili ar 27 papildinājumiem un 21 dzēšanām
  1. 1 0
      editor/index.html
  2. 1 21
      editor/js/Menubar.File.js
  3. 24 0
      editor/js/Menubar.Play.js
  4. 1 0
      editor/js/Menubar.js

+ 1 - 0
editor/index.html

@@ -52,6 +52,7 @@
 		<script src="js/Menubar.File.js"></script>
 		<script src="js/Menubar.Edit.js"></script>
 		<script src="js/Menubar.Add.js"></script>
+		<script src="js/Menubar.Play.js"></script>
 		<script src="js/Menubar.View.js"></script>
 		<script src="js/Menubar.Help.js"></script>
 		<script src="js/Sidebar.js"></script>

+ 1 - 21
editor/js/Menubar.File.js

@@ -182,12 +182,10 @@ Menubar.File = function ( editor ) {
 	} );
 	options.add( option );
 
-	//
+	/*
 
 	options.add( new UI.HorizontalRule() );
 
-	/*
-
 	// Test
 
 	var option = new UI.Panel();
@@ -202,24 +200,6 @@ Menubar.File = function ( editor ) {
 	options.add( option );
 	*/
 
-	// Publish
-
-	var option = new UI.Panel();
-	option.setClass( 'option' );
-	option.setTextContent( 'Publish' );
-	option.onClick( function () {
-
-		var preview = new Player( editor.scene.toJSON() );
-		preview.setSize( 800, 600 );
-		preview.play();
-
-		var popup = window.open( '', 'preview', 'width=800,height=600' );
-		popup.document.body.style.margin = 0;
-		popup.document.body.appendChild( preview.dom );
-
-	} );
-	options.add( option );
-
 
 	//
 

+ 24 - 0
editor/js/Menubar.Play.js

@@ -0,0 +1,24 @@
+Menubar.Play = function ( editor ) {
+
+	var container = new UI.Panel();
+	container.setClass( 'menu' );
+
+	var title = new UI.Panel();
+	title.setClass( 'title' );
+	title.setTextContent( 'Play' );
+	title.onClick( function () {
+
+		var player = new Player( editor.scene.toJSON() );
+		player.setSize( 800, 600 );
+		player.play();
+
+		var popup = window.open( '', 'preview', 'width=800,height=600' );
+		popup.document.body.style.margin = 0;
+		popup.document.body.appendChild( player.dom );
+
+	} );
+	container.add( title );
+
+	return container;
+
+};

+ 1 - 0
editor/js/Menubar.js

@@ -5,6 +5,7 @@ var Menubar = function ( editor ) {
 	container.add( new Menubar.File( editor ) );
 	container.add( new Menubar.Edit( editor ) );
 	container.add( new Menubar.Add( editor ) );
+	container.add( new Menubar.Play( editor ) );
 	container.add( new Menubar.View( editor ) );
 	container.add( new Menubar.Help( editor ) );