handleTouchMoveRotate method

dynamic handleTouchMoveRotate(
  1. dynamic event
)

Implementation

handleTouchMoveRotate(event) {
  if (pointers.length == 1) {
    rotateEnd.set(event.pageX, event.pageY);
  } else {
    var position = getSecondPointerPosition(event);

    var x = 0.5 * (event.pageX + position.x);
    var y = 0.5 * (event.pageY + position.y);

    rotateEnd.set(x, y);
  }

  rotateDelta.subVectors(rotateEnd, rotateStart).multiplyScalar(scope.rotateSpeed);

  var element = scope.domElement;

  rotateLeft(2 * Math.pi * rotateDelta.x / element.clientHeight); // yes, height

  rotateUp(2 * Math.pi * rotateDelta.y / element.clientHeight);

  rotateStart.copy(rotateEnd);
}