OrthographicTrackballControls problems

so I tried to use OrthographicTrackballControls and found these problems:

  1. it does not reset zoom
  2. it uses outdated top-left-bottom-right properties

my current patch against 1 and 2 looks like this:

	this.reset = function () {

		_state = STATE.NONE;
		_prevState = STATE.NONE;

		_this.target.copy( _this.target0 );
		_this.object.position.copy( _this.position0 );
		_this.object.up.copy( _this.up0 );

		_eye.subVectors( _this.object.position, _this.target );

		_this.handleResize();

		_this.object.left = _this.left0;
		_this.object.right = _this.right0;
		_this.object.top = _this.top0;
		_this.object.bottom = _this.bottom0;

		_this.object.zoom = _this.zoom0 || 1;
		_this.object.updateProjectionMatrix();

		_this.object.lookAt( _this.target );

		_this.dispatchEvent( changeEvent );

		_changed = false;

	};
  1. mouse wheel zoom is broken in every possible way – does not account for browser delta sensitivity, the check blocking certain zoom factors (probably in attempt to stop jumps ?) makes no sense and blocks legit zooming attempts.

currently using this replacement code:

			var deltaY = _zoomEnd.y - _zoomStart.y;
			if (deltaY != 0) {
				var factor = 1 + 4e-2 * ((deltaY > 0) ? _this.zoomSpeed : -_this.zoomSpeed);
				_this.object.zoom = Math.max( 1e-3, _this.object.zoom / factor );


				if ( _this.staticMoving ) {

					_zoomStart.copy( _zoomEnd );

				} else {

					_zoomStart.y += ( _zoomEnd.y - _zoomStart.y ) * this.dynamicDampingFactor;

				}

				_changed = true;
			}

would be nice to see some clean fixes here.

Author: Fantashit

1 thought on “OrthographicTrackballControls problems

Comments are closed.