ZoomableState

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Determines whether the resulting scale and translation of pan and zoom gestures should be automatically applied to by Modifier.zoomable to its content. This can be disabled if your content prefers applying the transformations in a bespoke manner.

Link copied to clipboard

Alignment of the content.

Link copied to clipboard

Single source of truth for your content's aspect ratio. If you're using Modifier.zoomable() with Image() or other composables that also accept ContentScale, they should not be used to avoid any conflicts.

Link copied to clipboard

Transformations that should be applied to Modifier.zoomable's content.

Link copied to clipboard

The visual bounds of the content, calculated by applying the scale and translation of pan and zoom gestures to the value given to ZoomableState.setContentLocation. Useful for drawing decorations around the content or performing hit tests.

Link copied to clipboard
@get:FloatRange(from = 0.0, to = 1.0)
abstract val zoomFraction: Float?

The content's current zoom as a fraction of its min and max allowed zoom factors.

Link copied to clipboard
abstract val zoomSpec: ZoomSpec

The zoom spec passed to rememberZoomableState.

Functions

Link copied to clipboard
abstract suspend fun panBy(offset: Offset, animationSpec: AnimationSpec<Offset> = DefaultPanAnimationSpec)

Animate pan by offset Offset in pixels and suspend until it's finished.

Link copied to clipboard
abstract suspend fun resetZoom(animationSpec: AnimationSpec<Float> = DefaultZoomAnimationSpec)
open suspend fun resetZoom(withAnimation: Boolean)

Reset content to its minimum zoom and zero offset and suspend until it's finished.

Link copied to clipboard
Link copied to clipboard
abstract 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.

Link copied to clipboard
abstract 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.