lvnkmn / Zoomy

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

Centering the image on the tap #87

Open MadGeorge opened 3 months ago

MadGeorge commented 3 months ago

Hello. With a basic setup actionOnTapImageView: Action.zoomToFit presents the zoomed image at the point of the original image. Is it possible to anchor it to the center of the screen when the user taps the original image?

Screenshot 2024-06-11 at 17 10 08

The Setup I'm currently using:

addZoombehavior(
        for: testView.headerView.imageView,
        in: parent?.view ?? view,
        settings: .backgroundEnabledSettings
            .with(zoomCancelingThreshold: 1)
            .with(actionOnTapBackgroundView: Action.dismissOverlay)
            .with(actionOnTapImageView: Action.zoomToFit)
            .with(defaultAnimators: CustomAnimators())
)
lvnkmn commented 3 months ago

Hi George,

I think what you're trying to achieve is possible. But I hope you don't mind I won't dive into the code now.

I honestly don't know by heart & you may need to add a new event as I'm not sure if the tap background image is the correct one.

What may also help, is to zoom within a larger container than you currently do.

Kind regards, Mennno

MadGeorge commented 3 months ago

Hello. Thanks for the response. I will try your suggestions.