Package-level declarations

Types

Link copied to clipboard

ScrollGesturePropagation defines when Modifier.zoomable propagates scroll gestures to the parent composable element.

Link copied to clipboard
class ZoomState(@FloatRange(from = 1.0) maxScale: Float = 5.0f, contentSize: Size = Size.Zero, velocityDecay: DecayAnimationSpec<Float> = exponentialDecay())

A state object that manage scale and offset.

Functions

Link copied to clipboard
fun rememberZoomState(@FloatRange(from = 1.0) maxScale: Float = 5.0f, contentSize: Size = Size.Zero, velocityDecay: DecayAnimationSpec<Float> = exponentialDecay()): ZoomState

Creates a ZoomState that is remembered across compositions.

Link copied to clipboard
suspend fun ZoomState.toggleScale(targetScale: Float, position: Offset, animationSpec: AnimationSpec<Float> = spring())

Toggle the scale between targetScale and 1.0f.

Link copied to clipboard
fun Modifier.zoomable(zoomState: ZoomState, zoomEnabled: Boolean = true, enableOneFingerZoom: Boolean = true, scrollGesturePropagation: ScrollGesturePropagation = ScrollGesturePropagation.ContentEdge, onTap: (position: Offset) -> Unit = {}, onDoubleTap: suspend (position: Offset) -> Unit = { position -> if (zoomEnabled) zoomState.toggleScale(2.5f, position) }): Modifier

Modifier function that make the content zoomable.