onPinchMove method

dynamic onPinchMove()

Implementation

onPinchMove() {
  if (enabled && enableZoom) {
    setCenter((_touchCurrent[0].clientX + _touchCurrent[1].clientX) / 2,
        (_touchCurrent[0].clientY + _touchCurrent[1].clientY) / 2);
    var minDistance = 12; //minimum distance between fingers (in css pixels)

    if (_state != State2.scale) {
      _startFingerDistance = _currentFingerDistance;
      updateTbState(State2.scale, true);
    }

    _currentFingerDistance =
        Math.max(calculatePointersDistance(_touchCurrent[0], _touchCurrent[1]), minDistance * _devPxRatio);
    var amount = _currentFingerDistance / _startFingerDistance;

    var scalePoint;

    if (!enablePan) {
      scalePoint = _gizmos.position;
    } else {
      if (camera is OrthographicCamera) {
        scalePoint = unprojectOnTbPlane(camera, _center.x, _center.y, domElement)
            .applyQuaternion(camera.quaternion)
            .multiplyScalar(1 / camera.zoom)
            .add(_gizmos.position);
      } else if (camera is PerspectiveCamera) {
        scalePoint = unprojectOnTbPlane(camera, _center.x, _center.y, domElement)
            .applyQuaternion(camera.quaternion)
            .add(_gizmos.position);
      }
    }

    applyTransformMatrix(scale(amount, scalePoint));
    dispatchEvent(_changeEvent);
  }
}