فهرست منبع

Change formatting for TransformControl zoom fix

Vladimir Jigouline 5 سال پیش
والد
کامیت
7757590f3c
2فایلهای تغییر یافته به همراه4 افزوده شده و 10 حذف شده
  1. 2 5
      examples/js/controls/TransformControls.js
  2. 2 5
      examples/jsm/controls/TransformControls.js

+ 2 - 5
examples/js/controls/TransformControls.js

@@ -1165,11 +1165,8 @@ THREE.TransformControlsGizmo = function () {
 			handle.rotation.set( 0, 0, 0 );
 			handle.position.copy( this.worldPosition );
 
-			var eyeDistance = this.worldPosition.distanceTo( this.cameraPosition );
-			// Orthographic camera zoom doesn't depend on eyeDistance, but on camera zoom factor.
-			if (this.camera.type == "OrthographicCamera") {
-				eyeDistance = 1000 / this.camera.zoom;
-			}
+			var eyeDistance = this.camera.isOrthographicCamera ? 1000 / this.camera.zoom : 
+				this.worldPosition.distanceTo( this.cameraPosition );			
 			handle.scale.set( 1, 1, 1 ).multiplyScalar( eyeDistance * this.size / 7 );
 
 			// TODO: simplify helpers and consider decoupling from gizmo

+ 2 - 5
examples/jsm/controls/TransformControls.js

@@ -1188,11 +1188,8 @@ var TransformControlsGizmo = function () {
 			handle.rotation.set( 0, 0, 0 );
 			handle.position.copy( this.worldPosition );
 
-			var eyeDistance = this.worldPosition.distanceTo( this.cameraPosition );
-			// Orthographic camera zoom doesn't depend on eyeDistance, but on camera zoom factor.
-			if (this.camera.type == "OrthographicCamera") {
-				eyeDistance = 1000 / this.camera.zoom;
-			}
+			var eyeDistance = this.camera.isOrthographicCamera ? 1000 / this.camera.zoom : 
+				this.worldPosition.distanceTo( this.cameraPosition );			
 			handle.scale.set( 1, 1, 1 ).multiplyScalar( eyeDistance * this.size / 7 );
 
 			// TODO: simplify helpers and consider decoupling from gizmo