Three.js: OrthographicTrackballControls problems

Created on 19 Jul 2017  路  1Comment  路  Source: mrdoob/three.js

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;

    };

3) 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.

Bug

Most helpful comment

OrthographicTrackballControls has been removed, see #17500

The reported issues should be fixed in TrackballControls.

>All comments

OrthographicTrackballControls has been removed, see #17500

The reported issues should be fixed in TrackballControls.

Was this page helpful?
0 / 5 - 0 ratings