Zoom State
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.
Parameters
max Scale
The maximum scale of the content.
content Size
Size of content (i.e. image size.) If Zero, the composable layout size will be used as content size.
velocity Decay
The decay animation spec for fling behaviour.
Constructors
Link copied to clipboard
constructor(@FloatRange(from = 1.0 ) maxScale: Float = 5.0f, contentSize: Size = Size.Zero, velocityDecay: DecayAnimationSpec<Float> = exponentialDecay())
Properties
Functions
Link copied to clipboard
suspend fun centerByContentCoordinate(offset: Offset, scale: Float = 3.0f, animationSpec: AnimationSpec<Float> = tween(700))
Animates the centering of content by modifying the offset and scale based on content coordinates.
Link copied to clipboard
suspend fun centerByLayoutCoordinate(offset: Offset, scale: Float = 3.0f, animationSpec: AnimationSpec<Float> = tween(700))
Animates the centering of content by modifying the offset and scale based on layout coordinates.
Link copied to clipboard
suspend fun changeScale(targetScale: Float, position: Offset, animationSpec: AnimationSpec<Float> = spring()): Job
Change the scale with animation.
Link copied to clipboard
Set the content size.
Link copied to clipboard
Set composable layout size.
Link copied to clipboard
suspend fun ZoomState.toggleScale(targetScale: Float, position: Offset, animationSpec: AnimationSpec<Float> = spring())
Toggle the scale between targetScale and 1.0f.