natario1 / ZoomLayout

2D zoom and pan behavior for View hierarchies, images, video streams, and much more, written in Kotlin for Android.
https://natario1.github.io/ZoomLayout
Apache License 2.0
1.05k stars 147 forks source link

How to zoom to 1 but have it zoom to the center? #231

Open waterdrake opened 1 year ago

waterdrake commented 1 year ago

Currently, I use this to zoom out to full screen:

ZoomSurfaceView.zoomSurfaceView.zoomTo(1, true)

But it does not center the view when I do that, it just zooms out and if you were panning, it just zooms out to where the center point of your pan was.

Is there a way to zoom to 1 and also have it zoom to the center?

markusressel commented 1 year ago

I don't think there is an API for that atm. You would have to manually calculate the target position and use the moveTo() method.

waterdrake commented 1 year ago

So use zoomImageView.moveTo(zoom, x, y, true);?

markusressel commented 1 year ago

Yes. See: https://natario1.github.io/ZoomLayout/docs/pan-apis