소스 검색

Merge pull request #17060 from WestLangley/dev-panning_damping

OrbitControls: Normalize panning speed when damping is used
WestLangley 6 년 전
부모
커밋
750c504a2d
2개의 변경된 파일20개의 추가작업 그리고 2개의 파일을 삭제
  1. 10 1
      examples/js/controls/OrbitControls.js
  2. 10 1
      examples/jsm/controls/OrbitControls.js

+ 10 - 1
examples/js/controls/OrbitControls.js

@@ -182,7 +182,16 @@ THREE.OrbitControls = function ( object, domElement ) {
 			spherical.radius = Math.max( scope.minDistance, Math.min( scope.maxDistance, spherical.radius ) );
 
 			// move target to panned location
-			scope.target.add( panOffset );
+
+			if ( scope.enableDamping === true ) {
+
+				scope.target.addScaledVector( panOffset, scope.dampingFactor );
+
+			} else {
+
+				scope.target.add( panOffset );
+
+			}
 
 			offset.setFromSpherical( spherical );
 

+ 10 - 1
examples/jsm/controls/OrbitControls.js

@@ -192,7 +192,16 @@ var OrbitControls = function ( object, domElement ) {
 			spherical.radius = Math.max( scope.minDistance, Math.min( scope.maxDistance, spherical.radius ) );
 
 			// move target to panned location
-			scope.target.add( panOffset );
+
+			if ( scope.enableDamping === true ) {
+
+				scope.target.addScaledVector( panOffset, scope.dampingFactor );
+
+			} else {
+
+				scope.target.add( panOffset );
+
+			}
 
 			offset.setFromSpherical( spherical );