DuDigital / react-native-zoomable-view

A view component for react-native with pinch to zoom, tap to move and double tap to zoom capability.
MIT License
243 stars 113 forks source link

Calculate initial zoom #32

Closed JonathanReisCom closed 3 years ago

JonathanReisCom commented 4 years ago

Hello people.

How do I get the initial zoom to fit my screen size?

Example: My image is width 1080 (myimage.width) My screen is width 375 (windowdimension.width ) And the scale is 3 (windowdimension.scale)

The calculation I'm doing is this:

const windowdimension = Dimensions.get('window'); const zoom = myimage.width / windowdimension.width / windowdimension.scale; What returns 0.96

But it does not fit perfectly on the screen, it is much larger, if I check using the log and go down, the ideal scale should be 0.59, could someone help me?

592da commented 4 years ago

any solutions?

592da commented 4 years ago

@JonathanReisCom did you find a good solution? thanks!

JonathanReisCom commented 4 years ago

No, sorry.

SimonErich commented 3 years ago

Can you please provide an example, that I can build on from and check the problem? You can use the following as a starting point: https://github.com/DuDigital/react-native-zoomable-view-example

SimonErich commented 3 years ago

Closed for being stale.