Skip to content

Commit

Permalink
fix: TOUCH_***_OFFSET did not move the offset
Browse files Browse the repository at this point in the history
  • Loading branch information
yomotsu committed Sep 20, 2020
1 parent f4d90b1 commit e316370
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/CameraControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -533,11 +533,6 @@ export class CameraControls extends EventDispatcher {
const deltaY = lastDragPosition.y - _v2.y;

lastDragPosition.copy( _v2 );
const dragToOffset =
this._state === ACTION.TOUCH_DOLLY_OFFSET ||
this._state === ACTION.TOUCH_ZOOM_OFFSET ||
this._state === ACTION.OFFSET ||
this._state === ACTION.TOUCH_OFFSET;

switch ( this._state ) {

Expand Down Expand Up @@ -588,7 +583,14 @@ export class CameraControls extends EventDispatcher {
this._state === ACTION.TOUCH_ZOOM_TRUCK
) {

truckInternal( deltaX, deltaY, dragToOffset );
truckInternal( deltaX, deltaY, false );

} else if (
this._state === ACTION.TOUCH_DOLLY_OFFSET ||
this._state === ACTION.TOUCH_ZOOM_OFFSET
) {

truckInternal( deltaX, deltaY, true );

}

Expand All @@ -597,11 +599,17 @@ export class CameraControls extends EventDispatcher {
}

case ACTION.TRUCK:
case ACTION.TOUCH_TRUCK:
case ACTION.TOUCH_TRUCK: {

truckInternal( deltaX, deltaY, false );
break;

}

case ACTION.OFFSET:
case ACTION.TOUCH_OFFSET: {

truckInternal( deltaX, deltaY, dragToOffset );
truckInternal( deltaX, deltaY, true );
break;

}
Expand Down

0 comments on commit e316370

Please sign in to comment.