소스 검색

Editor: Minor scripting tweaks.

Mr.doob 10 년 전
부모
커밋
313d35334f
3개의 변경된 파일14개의 추가작업 그리고 11개의 파일을 삭제
  1. 2 0
      editor/js/Player.js
  2. 1 1
      editor/js/Sidebar.Script.js
  3. 11 10
      editor/js/libs/app.js

+ 2 - 0
editor/js/Player.js

@@ -17,6 +17,8 @@ var Player = function ( editor ) {
 
 	window.addEventListener( 'resize', function () {
 
+		if ( player.dom === undefined ) return;
+
 		player.setSize( container.dom.offsetWidth, container.dom.offsetHeight );
 
 	} );

+ 1 - 1
editor/js/Sidebar.Script.js

@@ -53,7 +53,7 @@ Sidebar.Script = function ( editor ) {
 
 				( function ( object, script ) {
 
-					var name = new UI.Input( script.name ).setWidth( '160px' ).setFontSize( '12px' );
+					var name = new UI.Input( script.name ).setWidth( '150px' ).setFontSize( '12px' );
 					name.onChange( function () {
 
 						script.name = this.getValue();

+ 11 - 10
editor/js/libs/app.js

@@ -13,6 +13,9 @@ var APP = {
 
 		this.dom = undefined;
 
+		this.width = 500;
+		this.height = 500;
+
 		this.load = function ( json ) {
 
 			renderer = new THREE.WebGLRenderer( { antialias: true } );
@@ -65,22 +68,20 @@ var APP = {
 
 		};
 
-		this.setCamera = function ( newCamera ) {
-
-			if ( camera !== undefined ) {
+		this.setCamera = function ( value ) {
 
-				newCamera.aspect = camera.aspect;
-				newCamera.updateProjectionMatrix();
-
-			}
-
-			camera = newCamera;
+			camera = value;
+			camera.aspect = this.width / this.height;
+			camera.updateProjectionMatrix();
 
 		};
 
 		this.setSize = function ( width, height ) {
 
-			camera.aspect = width / height;
+			this.width = width;
+			this.height = height;
+
+			camera.aspect = this.width / this.height;
 			camera.updateProjectionMatrix();
 
 			renderer.setSize( width, height );