Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions examples/jsm/controls/OrbitControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ class OrbitControls extends Controls {
} else {

const position = this._getSecondPointerPosition( event );

if ( position === null ) return;
const x = 0.5 * ( event.pageX + position.x );
const y = 0.5 * ( event.pageY + position.y );

Expand All @@ -1219,7 +1219,7 @@ class OrbitControls extends Controls {
} else {

const position = this._getSecondPointerPosition( event );

if ( position === null ) return;
const x = 0.5 * ( event.pageX + position.x );
const y = 0.5 * ( event.pageY + position.y );

Expand All @@ -1232,7 +1232,7 @@ class OrbitControls extends Controls {
_handleTouchStartDolly( event ) {

const position = this._getSecondPointerPosition( event );

if ( position === null ) return;
const dx = event.pageX - position.x;
const dy = event.pageY - position.y;

Expand Down Expand Up @@ -1267,7 +1267,7 @@ class OrbitControls extends Controls {
} else {

const position = this._getSecondPointerPosition( event );

if ( position === null ) return;
const x = 0.5 * ( event.pageX + position.x );
const y = 0.5 * ( event.pageY + position.y );

Expand Down Expand Up @@ -1296,7 +1296,7 @@ class OrbitControls extends Controls {
} else {

const position = this._getSecondPointerPosition( event );

if ( position === null ) return;
const x = 0.5 * ( event.pageX + position.x );
const y = 0.5 * ( event.pageY + position.y );

Expand All @@ -1315,7 +1315,7 @@ class OrbitControls extends Controls {
_handleTouchMoveDolly( event ) {

const position = this._getSecondPointerPosition( event );

if ( position === null ) return;
const dx = event.pageX - position.x;
const dy = event.pageY - position.y;

Expand Down Expand Up @@ -1406,9 +1406,11 @@ class OrbitControls extends Controls {

_getSecondPointerPosition( event ) {

if ( this._pointers.length < 2 ) return null;

const pointerId = ( event.pointerId === this._pointers[ 0 ] ) ? this._pointers[ 1 ] : this._pointers[ 0 ];

return this._pointerPositions[ pointerId ];
return this._pointerPositions[ pointerId ] || null;

}

Expand Down