Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support to remove disable over-zoom effect #101

Closed
MHShetty opened this issue Sep 1, 2024 · 6 comments
Closed

Support to remove disable over-zoom effect #101

MHShetty opened this issue Sep 1, 2024 · 6 comments

Comments

@MHShetty
Copy link

MHShetty commented Sep 1, 2024

Is there any way we could remove the over zoom effect (i.e. disabling the ability to zoom out more than the image dimensions)?

@MHShetty MHShetty changed the title Support to remove over zoom effect Support to remove disable over-zoom effect Sep 1, 2024
@saket
Copy link
Owner

saket commented Sep 1, 2024

Not at the moment. The ZoomSpec#preventOverOrUnderZoom setting might sound like it controls this behavior, but it actually manages the rubber banding effect. I'm considering changing it to an enum to support this.

@RadoslawGorczyca
Copy link

This is what I meant in my issue

@MHShetty
Copy link
Author

MHShetty commented Sep 2, 2024

Not at the moment. The ZoomSpec#preventOverOrUnderZoom setting might sound like it controls this behavior, but it actually manages the rubber banding effect.

Ah yes that's right, I tried passing a ZoomSpec to rememberZoomableState with preventOverOrUnderZoom parameter set to true, but that doesn't seem to help with this.

I'm considering changing it to an enum to support this.

Perfect sounds great!

Thanks a lot for developing and maintaining this great and super-helpful library!

@saket
Copy link
Owner

saket commented Sep 14, 2024

@MHShetty What's your usecase btw?

@MHShetty
Copy link
Author

It's mainly to just have the overzoom and under zoom effect disabled while showing images in the gallery of our camera app. Our previous XML code didn't have the fancy zoom effect so we are trying to have something similar in our new compose code.

@saket
Copy link
Owner

saket commented Jan 1, 2025

I just added a new API, OverzoomEffect to make this customizable:

interface OverzoomEffect {
companion object {
/**
* Applies a rubber banding effect to zoom gestures when content is zoomed beyond
* its limit as a form of visual feedback that the content can't be zoomed any further.
*/
val RubberBanding: OverzoomEffect = RubberBandingOverzoomEffect
/**
* Does not limit over/under zooms in any manner. Content will zoom in a free-form
* manner even when it goes beyond its limit (until the gesture is released).
*/
val NoLimits: OverzoomEffect = NoLimitsOverzoomEffect
}
}

If anyone's interested in contributing a OverzoomEffect.Disabled, I'd be happy to review the PR!

@saket saket closed this as completed in 965503b Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants