okaybroda / ImageZoom

An Android library that makes any view to be zoomable.
GNU General Public License v3.0
120 stars 25 forks source link

zoom from touch coordinates not from center #3

Closed jiteshrana closed 7 years ago

jiteshrana commented 7 years ago

Hello, This is not a issue but I am trying to achieve the functionality like zooming image from its touch coordinates. can you help me through it ? updateZoomableViewMargins(newCenter[0] - twoPointCenter[0] + originalXY[0], newCenter[1] - twoPointCenter[1] + originalXY[1]); I tried a lot to tweaking above code segment but couldn't get success.

okaybroda commented 7 years ago

If I understand what you mean, is it related to the pivot of the zoom? If you want it to be at the exact center of the image, the twoPointCenter variable should be set to midpoint of the view at the beginning of the zoom.

jiteshrana commented 7 years ago

Thanks for your reply. but, I need to zoom image (from pinch point) not from center. currently, it is zooming from center.

jiteshrana commented 7 years ago

Thank you for your hint. I have worked on it and after some code tweaking I got the result what i want in zooming image. Thanks once again.. 👍

okaybroda commented 7 years ago

Glad you got it. Would you mind making a contribution? It would help me and also anyone else using this project.

Cheers!

jiteshrana commented 7 years ago

Sure, would like to.. I have done so. Its not perfect but its similar to what i want.

Cheers!

okaybroda commented 7 years ago

Awesome! Could you send a pull request?

jiteshrana commented 7 years ago

Done.