Procházet zdrojové kódy

Examples: Add window resize event for webgl_geometry_extrude_shapes.html (#31324)

林炳权 před 9 měsíci
rodič
revize
c13b6c4e63
1 změnil soubory, kde provedl 13 přidání a 0 odebrání
  1. 13 0
      examples/webgl_geometry_extrude_shapes.html

+ 13 - 0
examples/webgl_geometry_extrude_shapes.html

@@ -177,6 +177,19 @@
 
 
 				scene.add( mesh3 );
 				scene.add( mesh3 );
 
 
+				//
+
+				window.addEventListener( 'resize', onWindowResize );
+
+			}
+
+			function onWindowResize() {
+
+				camera.aspect = window.innerWidth / window.innerHeight;
+				camera.updateProjectionMatrix();
+
+				renderer.setSize( window.innerWidth, window.innerHeight );
+
 			}
 			}
 
 
 			function animate() {
 			function animate() {

粤ICP备19079148号