Selaa lähdekoodia

Limit zooming

WestLangley 8 vuotta sitten
vanhempi
commit
a1285b36b2

+ 4 - 1
examples/canvas_geometry_panorama.html

@@ -164,7 +164,10 @@
 
 			function onDocumentMouseWheel( event ) {
 
-				camera.fov += event.deltaY * 0.05;
+				var fov = camera.fov + event.deltaY * 0.05;
+
+				camera.fov = THREE.Math.clamp( fov, 10, 75 );
+
 				camera.updateProjectionMatrix();
 
 			}

+ 4 - 1
examples/canvas_geometry_panorama_fisheye.html

@@ -172,7 +172,10 @@
 
 			function onDocumentMouseWheel( event ) {
 
-				camera.fov += event.deltaY * 0.05;
+				var fov = camera.fov + event.deltaY * 0.05;
+
+				camera.fov = THREE.Math.clamp( fov, 10, 75 );
+
 				camera.updateProjectionMatrix();
 
 			}

+ 4 - 1
examples/css3d_panorama.html

@@ -156,7 +156,10 @@
 
 			function onDocumentMouseWheel( event ) {
 
-				camera.fov += event.deltaY * 0.05;
+				var fov = camera.fov + event.deltaY * 0.05;
+
+				camera.fov = THREE.Math.clamp( fov, 10, 75 );
+
 				camera.updateProjectionMatrix();
 
 			}

+ 4 - 1
examples/webgl_materials_cubemap_dynamic2.html

@@ -142,7 +142,10 @@
 
 			function onDocumentMouseWheel( event ) {
 
-				camera.fov += ( event.deltaY * 0.05 );
+				var fov = camera.fov + event.deltaY * 0.05;
+
+				camera.fov = THREE.Math.clamp( fov, 10, 75 );
+
 				camera.updateProjectionMatrix();
 
 			}

+ 3 - 1
examples/webgl_panorama_dualfisheye.html

@@ -98,7 +98,7 @@
 				var texture = new THREE.TextureLoader().load( 'textures/ricoh_theta_s.jpg' );
 				texture.format = THREE.RGBFormat;
 
-				var material   = new THREE.MeshBasicMaterial( { map: texture } );
+				var material = new THREE.MeshBasicMaterial( { map: texture } );
 
 				mesh = new THREE.Mesh( geometry, material );
 				scene.add( mesh );
@@ -163,6 +163,8 @@
 
 				distance += event.deltaY * 0.05;
 
+				distance = THREE.Math.clamp( distance, 400, 1000 );
+
 			}
 
 			function animate() {

+ 4 - 1
examples/webgl_panorama_equirectangular.html

@@ -169,7 +169,10 @@
 
 			function onDocumentMouseWheel( event ) {
 
-				camera.fov += event.deltaY * 0.05;
+				var fov = camera.fov + event.deltaY * 0.05;
+
+				camera.fov = THREE.Math.clamp( fov, 10, 75 );
+
 				camera.updateProjectionMatrix();
 
 			}

+ 2 - 0
examples/webgl_video_panorama_equirectangular.html

@@ -146,6 +146,8 @@
 
 				distance += event.deltaY * 0.05;
 
+				distance = THREE.Math.clamp( distance, 400, 500 );
+
 			}
 
 			function animate() {