Skip to content

Commit

Permalink
OrbitControl: Honor enableRotate in _handleKeyDown.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 authored Nov 12, 2024
1 parent b276fb5 commit e08c3e7
Showing 1 changed file with 41 additions and 9 deletions.
50 changes: 41 additions & 9 deletions examples/jsm/controls/OrbitControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,11 +784,19 @@ class OrbitControls extends Controls {

if ( event.ctrlKey || event.metaKey || event.shiftKey ) {

this._rotateUp( _twoPI * this.rotateSpeed / this.domElement.clientHeight );
if ( this.enableRotate ) {

this._rotateUp( _twoPI * this.rotateSpeed / this.domElement.clientHeight );

}

} else {

this._pan( 0, this.keyPanSpeed );
if ( this.enablePan ) {

this._pan( 0, this.keyPanSpeed );

}

}

Expand All @@ -799,11 +807,19 @@ class OrbitControls extends Controls {

if ( event.ctrlKey || event.metaKey || event.shiftKey ) {

this._rotateUp( - _twoPI * this.rotateSpeed / this.domElement.clientHeight );
if ( this.enableRotate ) {

this._rotateUp( - _twoPI * this.rotateSpeed / this.domElement.clientHeight );

}

} else {

this._pan( 0, - this.keyPanSpeed );
if ( this.enablePan ) {

this._pan( 0, - this.keyPanSpeed );

}

}

Expand All @@ -814,11 +830,19 @@ class OrbitControls extends Controls {

if ( event.ctrlKey || event.metaKey || event.shiftKey ) {

this._rotateLeft( _twoPI * this.rotateSpeed / this.domElement.clientHeight );
if ( this.enableRotate ) {

this._rotateLeft( _twoPI * this.rotateSpeed / this.domElement.clientHeight );

}

} else {

this._pan( this.keyPanSpeed, 0 );
if ( this.enablePan ) {

this._pan( this.keyPanSpeed, 0 );

}

}

Expand All @@ -829,11 +853,19 @@ class OrbitControls extends Controls {

if ( event.ctrlKey || event.metaKey || event.shiftKey ) {

this._rotateLeft( - _twoPI * this.rotateSpeed / this.domElement.clientHeight );
if ( this.enableRotate ) {

this._rotateLeft( - _twoPI * this.rotateSpeed / this.domElement.clientHeight );

}

} else {

this._pan( - this.keyPanSpeed, 0 );
if ( this.enablePan ) {

this._pan( - this.keyPanSpeed, 0 );

}

}

Expand Down Expand Up @@ -1340,7 +1372,7 @@ function onMouseWheel( event ) {

function onKeyDown( event ) {

if ( this.enabled === false || this.enablePan === false ) return;
if ( this.enabled === false ) return;

this._handleKeyDown( event );

Expand Down

0 comments on commit e08c3e7

Please sign in to comment.