Skip to content

[Feature request] Add flag to prevent crop aspect ratio inversion on image rotation #655

@maRci002

Description

@maRci002

Platforms

Android, iOS, Web, Windows, macOS, Linux

Description

Currently, when a fixed crop aspect ratio is set (e.g., 16/9), rotating the image causes the aspect ratio to invert (becoming 9/16). This behavior can be unintuitive and undesirable in scenarios where the developer wants to enforce a strict aspect ratio regardless of rotation.

For example:

  • Set crop aspect ratio to 16/9.
  • Rotate the image by 90°.
  • The crop area flips to 9/16 automatically.

There is no configuration flag in CropRotateEditorConfigs to disable this inversion behavior.

inverted.aspect.ratio.mp4

Proposed Solution

Introduce a new configuration flag in CropRotateEditorConfigs (e.g., lockAspectRatioOrientation: true) that ensures the aspect ratio remains fixed in the defined orientation, regardless of rotation.

When this flag is enabled:

  • A 16/9 aspect ratio should stay 16/9, even after 90° rotations.
  • Similarly, 9/16 should remain 9/16.

Additionally, this would remove the need for unnecessary swap logic when handling flips, for example:

flipX: transform.is90DegRotated ? transform.flipY : transform.flipX,
flipY: transform.is90DegRotated ? transform.flipX : transform.flipY,

If aspect ratio orientation is locked, there should be no need to swap flipX and flipY in such cases.

Why

  • Predictability: Developers often expect the crop ratio to remain exactly as defined, independent of rotation.
  • User experience: End users may be confused when their intended 16/9 crop suddenly switches to portrait orientation after rotation.
  • Simplified implementation: Avoids extra logic for handling flipX/flipY swapping and reduces edge-case complexity.
  • Flexibility: Developers can still allow the current behavior by leaving the flag disabled (backward compatibility).
  • Alignment with future features: Issue [Feature request] Add Skewing Support to Image Transformations #525 requests free-angle rotation. In such cases, preserving the original aspect ratio becomes even more important to avoid unexpected inversions.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions