onRotateMove method

void onRotateMove()

Implementation

void onRotateMove() {
  if (enabled && enableRotate) {
    setCenter(
        (_touchCurrent[0].clientX + _touchCurrent[1].clientX) / 2,
        (_touchCurrent[0].clientY + _touchCurrent[1].clientY) / 2);
    dynamic rotationPoint;

    if (_state != State2.zRotate) {
      updateTbState(State2.zRotate, true);
      _startFingerRotation = _currentFingerRotation;
    }

    //_currentFingerRotation = event.rotation;
    _currentFingerRotation = getAngle(_touchCurrent[1], _touchCurrent[0]) + getAngle(_touchStart[1], _touchStart[0]);

    if (!enablePan) {
      rotationPoint =
          Vector3().setFromMatrixPosition(_gizmoMatrixState);
    } else {
      _v3_2.setFromMatrixPosition(_gizmoMatrixState);
      rotationPoint = unprojectOnTbPlane(camera, _center.x, _center.y)
          .applyQuaternion(camera.quaternion)
          .scale(1 / camera.zoom)
          .add(_v3_2);
    }

    final amount = MathUtils.deg2rad *
        (_startFingerRotation - _currentFingerRotation);

    applyTransformMatrix(zRotate(rotationPoint, amount));
    dispatchEvent(_changeEvent);
  }
}