Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotate left/right don't work as expected #7

Open
jasongerbes opened this issue Sep 25, 2024 · 0 comments
Open

Rotate left/right don't work as expected #7

jasongerbes opened this issue Sep 25, 2024 · 0 comments

Comments

@jasongerbes
Copy link

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°.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant