zoomBy

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

Zooms in or out around centroid by a ratio of zoomFactor relative to the current size, and suspends until it's finished.

Parameters

zoomFactor

Ratio by which to zoom relative to the current size. For example, a zoomFactor of 3.0 will triple the current zoom level, while 0.9 will reduce it by 10%.

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 zoomBy(zoomFactor: Float, focal: ZoomFocalPoint, animationSpec: AnimationSpec<Float> = DefaultZoomAnimationSpec)

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

Parameters

zoomFactor

Ratio by which to zoom relative to the current size. For example, a zoomFactor of 3.0 will triple the current zoom level, while 0.9 will reduce it by 10%.

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 zoomBy(zoomFactor: Float, centroid: SpatialOffset, animationSpec: AnimationSpec<Float> = DefaultZoomAnimationSpec)

Deprecated

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

Replace with

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