JanGorman / Agrume

🍋 A lemony fresh iOS image viewer written in Swift.
MIT License
807 stars 121 forks source link

Allow configuring dismissal physics behavior #285

Closed alexstaravoitau closed 3 years ago

alexstaravoitau commented 3 years ago

Hi @JanGorman, I was going to use Agrume in one of my projects, but realised I needed a tad more configurable dismissal behavior (more specifically, I wanted to disable rotation, change push magnitude and restrict panning to Y axis only). Not sure if you would like these changes in the upstream repo — feel free to amend or decline as you see fit. 🙃

In a nutshell, this provides an API to configure flick-to-dismiss physics. I've tried to make it easy to extend, should you ever feel need to make more parameters configurable. Please mind that I had to rename a couple of enum cases in the public API in order to mark them as deprecated. I understand this complicates APIs a bit, so if you feel like this is an overkill, don't hesitate to request changes or simply decline.

Finally, I think I fixed an issue in the factor(forView:) function — it produced inconsistent physics effects in portrait and landscape, which was very obvious on iPads (unless this behavior was there for a reason).

JanGorman commented 3 years ago

Thanks a lot for opening the PR! I'll review and give it a try in the coming days 🙏

JanGorman commented 3 years ago

Took a while – I checked out your branch and played around with the additions 👍

I think the naming change is fine. Thanks for going the extra mile to mark the old ones as deprecated instead of removing them outright

alexstaravoitau commented 3 years ago

Great news — thanks @JanGorman, and now I can point SPM back to your repo instead of my fork. 😅