-
Notifications
You must be signed in to change notification settings - Fork 46
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
How to read current scale level? #70
Comments
@sasweb Currently, I could add a new property to the In the meantime, if you need the cumulative, clamped scale, you can achieve this by using an animated scale value. Pass this value down to the ImageZoom or Zoomable component, which will handle the cumulative scaling within the defined limits. You can see an example of this in action here: ExpoImageZoomTab |
Thank you for the quick response. So I think I can add a local state in my component and simply update it Edit: similar for the translate x and y. Would be really helpful to have a state with the offset on the x and y axis compared to the initial state. |
@sasweb For scaling, you can use something like this: savedScale = clamp(savedScale * newScale, minScale, maxScale); As for translation, it’s a bit more complex because there are two types involved:
I could look into adding this to the |
Yes, I was also thinking about |
onPinchEnd
provides ascale
value as also requested in #48.I was expecting
scale
to represent the current zoom factor.For example: if an image with dimensions 400X300 is zoomed in to 800x600 scale should be
2
. If the max scale is set to 5 the scale can never be more than 5. Same for the minimum scale which needs to be at least 1.After experimenting I found out that this is not the case. I get pretty random scale values which even don't represent my actual zoom action. For example if I zoom in twice, the scale value may drop with the second zoom in. Also, the value is often below 1 and above 5 which should never happen.
So I was wondering how to read the vale and how to get the zoom factor I described.
Thank you!
The text was updated successfully, but these errors were encountered: