-
@Stable() public final class ZoomStateA state object that manage scale and offset.
-
-
Method Summary
Modifier and Type Method Description final FloatgetScale()final FloatgetOffsetX()final FloatgetOffsetY()final UnitsetLayoutSize(Size size)Set composable layout size. final UnitsetContentSize(Size size)Set the content size. final <ERROR CLASS>reset()Reset the scale and the offsets. final <ERROR CLASS>changeScale(Float targetScale, Offset position, AnimationSpec<Float> animationSpec)Change the scale with animation. final <ERROR CLASS>centerByContentCoordinate(Offset offset, Float scale, AnimationSpec<Float> animationSpec)Animates the centering of content by modifying the offset and scale based on content coordinates. final <ERROR CLASS>centerByLayoutCoordinate(Offset offset, Float scale, AnimationSpec<Float> animationSpec)Animates the centering of content by modifying the offset and scale based on layout coordinates. -
-
Method Detail
-
getOffsetX
final Float getOffsetX()
-
getOffsetY
final Float getOffsetY()
-
setLayoutSize
final Unit setLayoutSize(Size size)
Set composable layout size.
Basically This function is called from Modifier.zoomable only.
- Parameters:
size- The size of composable layout size.
-
setContentSize
final Unit setContentSize(Size size)
Set the content size.
- Parameters:
size- The content size, for example an image size in pixel.
-
reset
final <ERROR CLASS> reset()
Reset the scale and the offsets.
-
changeScale
final <ERROR CLASS> changeScale(Float targetScale, Offset position, AnimationSpec<Float> animationSpec)
Change the scale with animation.
Zoom in or out to targetScale around the position.
- Parameters:
targetScale- The target scale value.position- Zoom around this point.animationSpec- The animation configuration.
-
centerByContentCoordinate
final <ERROR CLASS> centerByContentCoordinate(Offset offset, Float scale, AnimationSpec<Float> animationSpec)
Animates the centering of content by modifying the offset and scale based on content coordinates.
- Parameters:
offset- The offset to apply for centering the content.scale- The scale to apply for zooming the content.animationSpec- AnimationSpec for centering and scaling.
-
centerByLayoutCoordinate
final <ERROR CLASS> centerByLayoutCoordinate(Offset offset, Float scale, AnimationSpec<Float> animationSpec)
Animates the centering of content by modifying the offset and scale based on layout coordinates.
- Parameters:
offset- The offset to apply for centering the content.scale- The scale to apply for zooming the content.animationSpec- AnimationSpec for centering and scaling.
-
-
-
-