guoyingtao / Mantis

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

add free cropView ratio to selectable modes #249

Closed nikitaBohatyrovExitek closed 1 year ago

nikitaBohatyrovExitek commented 1 year ago

Hello. Thank you very much for the great library. I've been trying to find the way to use free mode of crop view resizing inside Mantis, this option already exists in mantis on load of ViewController, but that would be great to add feature of selection and using such ratio crop mode by choice, thank you in advance, I really appreciate your library, it's amazing!)

guoyingtao commented 1 year ago

@nikitaBohatyrovExitek Just to confirm if what you want is to add a new setting property to enable/disable free crop ratio in Mantis.Config?

nikitaBohatyrovExitek commented 1 year ago

it wood be great to enable free crop ratio the same way we select crop ratio through the func CropViewController.didSelectRatio, or make it possible to enable free crop ratio in Mantis.Config on update of CropViewController!)

guoyingtao commented 1 year ago

Hi @nikitaBohatyrovExitek CropViewController.didSelectRatio is designed for fixed ratios so I think you can change some settings in Config to enable/disable free ratio.

There are two ways to disable free crop ratio currently by setting presetFixedRatioType in Config

  1. set presetFixedRatioType to alwaysUsingOnePresetFixedRatio
  2. set presetFixedRatioType to canUseMultiplePresetFixedRatio with a defaultRatio which is greater than 0 (This one has some bugs, I already fixed it in the master branch but hasn't made a new release yet. If you want to have a test, use the master branch instead of the latest release 2.4.0)

if using canUseMultiplePresetFixedRatio(defaultRatio: 0), then free ratio is used. (This is actually the current default setting in Mantis.Config)

guoyingtao commented 1 year ago

@nikitaBohatyrovExitek I released Mantis 2.5.0. Please check if it works for your case. Thanks!

guoyingtao commented 1 year ago

Since no response for this issue for a long time, I close this issue for now.