TOCropViewController
TOCropViewController copied to clipboard
Bug - Crop box zooms in unexpectedly when rotating image with locked 3:4 aspect ratio
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
- Create a
CropViewControllerwith an image - Set
aspectRatioLockEnabled = true - Set aspect ratio preset to 3:4 (portrait):
setAspectRatioPreset(CGSize(width: 3, height: 4), animated: false) - Rotate the image 90° using the rotation button
- 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
aspectRatioLockDimensionSwapEnabledmentioned 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.