zoomCamera method

dynamic zoomCamera()

Implementation

zoomCamera() {
  var factor;

  if (_state == STATE.TOUCH_ZOOM_PAN) {
    factor = _touchZoomDistanceStart / _touchZoomDistanceEnd;
    _touchZoomDistanceStart = _touchZoomDistanceEnd;

    if (scope.object is PerspectiveCamera) {
      _eye.multiplyScalar(factor);
    } else if (scope.object is OrthographicCamera) {
      scope.object.zoom /= factor;
      scope.object.updateProjectionMatrix();
    } else {
      print('THREE.TrackballControls: Unsupported camera type');
    }
  } else {
    factor = 1.0 + (_zoomEnd.y - _zoomStart.y) * scope.zoomSpeed;

    if (factor != 1.0 && factor > 0.0) {
      if (scope.object is PerspectiveCamera) {
        _eye.multiplyScalar(factor);
      } else if (scope.object is OrthographicCamera) {
        scope.object.zoom /= factor;
        scope.object.updateProjectionMatrix();
      } else {
        print('THREE.TrackballControls: Unsupported camera type');
      }
    }

    if (scope.staticMoving) {
      _zoomStart.copy(_zoomEnd);
    } else {
      _zoomStart.y += (_zoomEnd.y - _zoomStart.y) * this.dynamicDampingFactor;
    }
  }
}