Răsfoiți Sursa

Editor/App: Fixed setSize() and better dispose().

Mr.doob 9 ani în urmă
părinte
comite
10e71fe671
1 a modificat fișierele cu 15 adăugiri și 3 ștergeri
  1. 15 3
      editor/js/libs/app.js

+ 15 - 3
editor/js/libs/app.js

@@ -154,10 +154,18 @@ var APP = {
 			this.width = width;
 			this.height = height;
 
-			camera.aspect = this.width / this.height;
-			camera.updateProjectionMatrix();
+			if ( camera ) {
+
+				camera.aspect = this.width / this.height;
+				camera.updateProjectionMatrix();
+
+			}
 
-			renderer.setSize( width, height );
+			if ( renderer ) {
+
+				renderer.setSize( width, height );
+
+			}
 
 		};
 
@@ -249,6 +257,10 @@ var APP = {
 
 			renderer.dispose();
 
+			camera = undefined;
+			scene = undefined;
+			renderer = undefined;
+
 		};
 
 		//