lvnkmn / Zoomy

Adds seamless scrollView and instagram like zooming to UIImageViews in any view hierarchy.
MIT License
206 stars 25 forks source link

Minimum Zoom Scale #77

Closed jnwagstaff closed 3 years ago

jnwagstaff commented 3 years ago

It'd be nice to have a minimum zoom scale

lvnkmn commented 3 years ago

Hi @jnwagstaff!

Thanks for filing the issue and sorry for keeping you waiting, I had some issues with the notifications.

Can you tell me how you'd expect minimum zoom scale to behave? With a bit of luck it should be easy to implement for you.

Kind regards

lvnkmn commented 3 years ago

Hi @jnwagstaff.

I've had a look into this and concluded that a minimum zoom scale should be relatively easy to implement. However I still would like to know how you'd expect it to behave.

Currently there is already a minimum zoom scale which defaults to the scale the image is in before it's zoomed. Since zoomy mimics the "bounce" behaviour of UIScrollViews during zooming, the image can be zoomed out just a little bit more.

I could implement a hard zooming limit so that there's no bouncing effect (as an option) and allowing the minimum zoom scale to be set in the settings.

Looking forward to hear your thought about this and implementing this should be pretty fun.

lvnkmn commented 3 years ago

Ok, I've thought a little more about this and came to the conclusion that keeping the bounce/rubberband behaviour is the best way to go. Mostly because this is how it works in scrollViews and therefore it can't be disabled when the scrollView comes into play.

I've implemented the minimumZoomScale which can be used as follows: addZoombehavior(for: imageView, settings: Settings().with(minimumZoomScale: 0.001))