panCamera method

dynamic panCamera()

Implementation

panCamera() {
  mouseChange.copy(_panEnd).sub(_panStart);

  if (mouseChange.lengthSq() != 0) {
    if (scope.object is OrthographicCamera) {
      var scaleX = (scope.object.right - scope.object.left) / scope.object.zoom / scope.domElement.clientWidth;
      var scaleY = (scope.object.top - scope.object.bottom) / scope.object.zoom / scope.domElement.clientWidth;

      mouseChange.x *= scaleX;
      mouseChange.y *= scaleY;
    }

    mouseChange.multiplyScalar(_eye.length() * scope.panSpeed);

    pan.copy(_eye).cross(scope.object.up).setLength(mouseChange.x);
    pan.add(objectUp.copy(scope.object.up).setLength(mouseChange.y));

    scope.object.position.add(pan);
    scope.target.add(pan);

    if (scope.staticMoving) {
      _panStart.copy(_panEnd);
    } else {
      _panStart.add(mouseChange.subVectors(_panEnd, _panStart).multiplyScalar(scope.dynamicDampingFactor));
    }
  }
}