rotate90 method

void rotate90()

Rotate the image 90° counter-clockwise (one quarter turn). imageTransform snaps so callers / tests / gestures see the new rotation immediately; the visible rotation eases over kAnimation.

The turn is around crop.center, not the image centre: pan is remapped so the content in the crop stays put and rotates, the same pivot flipHorizontal uses for the mirror. A quarter turn can uncover a non-square crop; the data state then snaps to the nearest covering transform so the animation lands on a valid state.

Implementation

void rotate90() {
  _settleAnimator.cancel();
  captureRotationFloor();
  final preRender = _renderTransform.clone();
  _suppressMirror = true;
  imageTransform.update(
    _coveredAt(
      imageTransform.rotateZ - math.degrees2Radians * 90,
      scaleFloor: imageTransform.totalScale,
    ),
  );
  _suppressMirror = false;
  _renderAnimator.cancel();
  _renderTransform.update(preRender);
  _spin(imageTransform.clone()).unawaited();
}