zoomTo

open suspend fun zoomTo(zoomFactor: Float, centroid: Offset = Offset.Unspecified, animationSpec: AnimationSpec<Float> = DefaultZoomAnimationSpec)

Zooms in or out around centroid to achieve a final zoom level specified by zoomFactor, and suspends until it's finished.

Parameters

zoomFactor

Target zoom level for the content relative to its original size. For example, a zoomFactor of 2f will set the content's zoom level to two times its original size. This value is internally coerced between the zoom limits described by ZoomSpec.

centroid

Focal point for this zoom, in the viewport's coordinate space. Defaults to the center of the viewport. This behaves the same as using ZoomFocalPoint.zoomAround with the given centroid. To specify a point in content coordinates, use the ZoomFocalPoint overload instead.

animationSpec

The animation spec to use or SnapSpec for no animation.


abstract suspend fun zoomTo(zoomFactor: Float, focal: ZoomFocalPoint, animationSpec: AnimationSpec<Float> = DefaultZoomAnimationSpec)

Zooms in or out to the specified zoomFactor, using focal to determine how the zoom should be anchored, and suspends until the animation (if any) is finished.

Parameters

zoomFactor

Target zoom level for the content relative to its original size. For example, a zoomFactor of 2.0 will set the content's zoom level to two times its original size. This value is internally coerced between the zoom limits described by ZoomSpec.

focal

Focal point for this zoom. See ZoomFocalPoint for more information.

animationSpec

The animation spec to use or SnapSpec for no animation.


open suspend fun zoomTo(zoomFactor: Float, centroid: SpatialOffset, animationSpec: AnimationSpec<Float> = DefaultZoomAnimationSpec)

Deprecated

Replaced by zoomTo() with the 'focal' parameter.

Replace with

import me.saket.telephoto.zoomable.ZoomFocalPoint
zoomTo(zoomFactor, ZoomFocalPoint.zoomAround(centroid))