Closed cdf1982 closed 11 months ago
Thank you for considering this.
Turns out that
.frame(maxWidth: .infinity, maxHeight: .infinity)
.edgesIgnoringSafeArea(.all)
wasn't really necessary.
With today's 693992f commit I don't think the behavior should break for existing Users: the ZStack would use the default .clear color, but if it's still a breaking change I could wrap the implementation in a check of outOfBoundsColor, leaving the original code unchanged when it's clear.
Hi! I have just committed your suggested implementation, thank you for your patience.
There is a slight difference in behavior when the Zoomable modifier is used on a View that is the destination of a NavigationStack: with this approach, it's necessary to also add a .background() modifier to such view to avoid a different color behind the Navigation Bar, but it's not a problem.
Hi!
Yours is by far the cleanest implementation online, thank you!
I've taken the liberty to add an optional outOfBoundsColor parameter to allow customisation of the "background" color when the View is zoomed with negative scale or id dragged out of bounds.
This is achieved by wrapping the content in a ZStack with infinite frame and no safe area edges.
I've also updated the readme both to provide an example of this addition and to specify supported platforms and that not only Views of type Image are supported.
Hope everything is okay and that this is an addition you're interested for your project.