浏览代码

From #1454, small edit to TrackballControls.js to zoom properly with an OrthographicCamera

Patrick Fuller 12 年之前
父节点
当前提交
a92c98f478
共有 1 个文件被更改,包括 13 次插入1 次删除
  1. 13 1
      examples/js/controls/TrackballControls.js

+ 13 - 1
examples/js/controls/TrackballControls.js

@@ -194,7 +194,19 @@ THREE.TrackballControls = function ( object, domElement ) {
 
 
 			if ( factor !== 1.0 && factor > 0.0 ) {
 			if ( factor !== 1.0 && factor > 0.0 ) {
 
 
-				_eye.multiplyScalar( factor );
+				if ( this.object instanceof THREE.PerspectiveCamera ) {
+
+					_eye.multiplyScalar( factor );
+
+				} else {
+
+					this.object.left *= factor;
+					this.object.right *= factor;
+					this.object.top *= factor;
+					this.object.bottom *= factor;
+
+					this.object.updateProjectionMatrix();
+				}
 
 
 				if ( _this.staticMoving ) {
 				if ( _this.staticMoving ) {