react-mobile-cropper icon indicating copy to clipboard operation
react-mobile-cropper copied to clipboard

Rotate left/right don't work as expected

Open jasongerbes opened this issue 1 year ago • 0 comments

In the iOS photos app and Telegram app, the rotate button will always rotate the image by 90°, regardless of whether the user has previously adjusted the rotation via the slider.

However, the rotate left/right buttons in react-mobile-cropper will only rotate by 90° if the rotation slider is set to exactly 0°.

Reproduction steps

  1. Set the rotation slider to -20°.
  2. Press the 'rotate left' button.

Current behaviour

The rotation slider is reset to 0° and the image rotation is 'snapped' to -90°.

Expected behaviour

The rotation slider should still be set to -20° and the image should be rotated to -110°.

Additional context

This appears to be intentional behaviour, based on the rotateLeft and rotateRight functions in Navigation.tsx.

Changing these functions to always rotate by 90° introduces a new issue where the useLayoutEffect miscalculates the new adjustmentAngle if the rotation slider is set to exactly -45° or 45°.

jasongerbes avatar Sep 25 '24 03:09 jasongerbes