guoyingtao / Mantis

An iOS Image cropping library, which mimics the Photo App written in Swift.
MIT License
926 stars 184 forks source link

Mac catalyst set initial crop aspect ratio problem #215

Closed behrangnm closed 2 years ago

behrangnm commented 2 years ago

I'm having a hard time initiating a cropViewController with a non-default aspect ratio in mac Catalyst. Let's say I initiate my cropViewController with an image and want to show the default crop aspect ratio as 16/9

let cropViewController = Mantis.cropViewController(image: myImage) cropViewController.config.presetFixedRatioType = .alwaysUsingOnePresetFixedRatio(ratio: 16.0/9.0)

When I present the above cropViewController, for a split second the aspect ratio is set to 16/9 but then the crop box expands to cover the full image without me touching anything. This behavior is not present in the iOS app.

Has anyone seen this behavior?

guoyingtao commented 2 years ago

@behrangnm Thanks for the feedback. Could you provide more information like your macOS version and your Xcode version? I did a test but didn't reproduce it on my MacBook Pro (macOS 12.6, Xcode Version 13.3.1 (13E500a))

https://user-images.githubusercontent.com/26723384/196868150-ef61a71e-8f71-46da-b6c2-b17b59e54192.mov

behrangnm commented 2 years ago

Thanks for getting back to me quickly. I checked your sample example against my code and I was missing the following in my setup of the cropViewController: cropViewController.modalPresentationStyle = .fullScreen So if you remove that from your test code, you will seeing the bouncing of the crop frame. I guess I had to read the "Basics" of how to set it up in the read.me file :) Anyway, problem solved on my part but maybe it would be a good idea to automatically set the presentation style to fullscreen on ios 13+ / mac catalyst

guoyingtao commented 2 years ago

Just released Mantis 2.3.0 which automatically sets the presentation style to fullscreen on ios 13+ / mac catalyst