Package 

Class ZoomState


  • @Stable() 
    public final class ZoomState
    
                        

    A state object that manage scale and offset.

    • Constructor Summary

      Constructors 
      Constructor Description
      ZoomState(Float maxScale, Size contentSize, DecayAnimationSpec<Float> velocityDecay)
    • Method Summary

      Modifier and Type Method Description
      final Float getScale()
      final Float getOffsetX()
      final Float getOffsetY()
      final Unit setLayoutSize(Size size) Set composable layout size.
      final Unit setContentSize(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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ZoomState

        ZoomState(Float maxScale, Size contentSize, DecayAnimationSpec<Float> velocityDecay)
        Parameters:
        maxScale - The maximum scale of the content.
        contentSize - Size of content (i.e.
        velocityDecay - The decay animation spec for fling behaviour.
    • Method Detail

      • 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.