Skip to content

Bug - Crop box zooms in unexpectedly when rotating image with locked 3:4 aspect ratio #638

@narangrishab

Description

@narangrishab

Description

When rotating an image in TOCropViewController with a locked 3:4 aspect ratio (aspectRatioLockEnabled = true), the crop box zooms in unexpectedly and selects only a portion of the image instead of maintaining the same view area.

Steps to Reproduce

  1. Create a CropViewController with an image
  2. Set aspectRatioLockEnabled = true
  3. Set aspect ratio preset to 3:4 (portrait): setAspectRatioPreset(CGSize(width: 3, height: 4), animated: false)
  4. Rotate the image 90° using the rotation button
  5. Observe that the crop box zooms in and moves to a different part of the image

Expected Behavior

  • The crop box should maintain its position and zoom level when rotating
  • The image should rotate within the crop box without zooming in
  • The crop area should remain centered on the same portion of the image

Actual Behavior

  • The crop box zooms in significantly after rotation
  • The crop box position shifts to a different part of the image
  • User must manually zoom out and reposition to get back to the desired crop area

Environment

  • TOCropViewController Version: 3.1.1
  • iOS Version: iOS 17.0+
  • Platform: iOS
  • Swift Package Manager: Yes

Additional Context

  • This issue is related to #51
  • The property aspectRatioLockDimensionSwapEnabled mentioned in some documentation does not appear to be available in version 3.1.1
  • This affects use cases where a specific aspect ratio (like 3:4 for wine labels) must be maintained in the final output, regardless of rotation
  • The final cropped image does maintain the correct 3:4 aspect ratio, but the zoom-in behavior during rotation creates a poor user experience

Workaround

Users can manually zoom out and reposition the crop box after rotation, but this is not ideal for UX.

Request

Please provide a way to prevent zoom-in during rotation when aspect ratio is locked, or confirm if aspectRatioLockDimensionSwapEnabled should be available and how to access it in version 3.1.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions