Skip to content

Commit

Permalink
Merge pull request #7406 from shshaw/dev
Browse files Browse the repository at this point in the history
Multitouch fix for TrackballControls
  • Loading branch information
mrdoob committed Oct 22, 2015
2 parents 4e54772 + b5a7e99 commit 69f9617
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions examples/js/controls/TrackballControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ THREE.TrackballControls = function ( object, domElement ) {

case 1:
_movePrev.copy( _moveCurr );
_moveCurr.copy( getMouseOnCircle( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ) );
_moveCurr.copy( getMouseOnCircle( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ) );
break;

case 2:
Expand All @@ -565,9 +565,17 @@ THREE.TrackballControls = function ( object, domElement ) {

switch ( event.touches.length ) {

case 0:
_state = STATE.NONE;
break;

case 1:
_movePrev.copy( _moveCurr );
_moveCurr.copy( getMouseOnCircle( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ) );
_moveCurr.copy( getMouseOnCircle( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ) );
if ( _state !== STATE.TOUCH_ROTATE ) {
_state = STATE.TOUCH_ROTATE;
_movePrev.copy( _moveCurr );
}
break;

case 2:
Expand All @@ -581,7 +589,6 @@ THREE.TrackballControls = function ( object, domElement ) {

}

_state = STATE.NONE;
_this.dispatchEvent( endEvent );

}
Expand Down

0 comments on commit 69f9617

Please sign in to comment.