22
33[ ![ ] ( https://jitpack.io/v/SmartToolFactory/Compose-Image.svg )] ( https://jitpack.io/#SmartToolFactory/Compose-Image )
44
5-
6-
75Collection of Images, Modifiers, utility functions for Jetpack Compose to expand
86and enrich displaying, manipulating, scaling, resizing, zooming, and
97getting cropped ` ImageBitmap ` based on selection area, before/after image to with handle to
@@ -13,7 +11,6 @@ https://user-images.githubusercontent.com/35650605/179715223-ba681886-6032-461f-
1311
1412https://user-images.githubusercontent.com/35650605/185785993-58aee8fb-8f27-4664-9ebe-5cde04b5a04e.mp4
1513
16-
1714## Gradle Setup
1815
1916To get a Git project into your build:
@@ -221,10 +218,6 @@ fun MorphLayout(
221218
222219## Zoom
223220
224-
225-
226-
227-
228221Zoom feature provides zooming in or out Image, or Composables with animations and
229222getting data about current transform or image Using Callbacks.
230223
@@ -398,7 +391,7 @@ fun Modifier.enhancedZoom(
398391 developer to define zoom on double tap gesture
399392* ** enabled** lambda can be used selectively enable or disable pan and intercepting with scroll,
400393 drag or lists or pagers using current zoom, pan or rotation values
401- * ** onGestureStart callback to to notify gesture has started and return current [ EnhancedZoomData]
394+ * ** onGestureStart** callback to to notify gesture has started and return current [ EnhancedZoomData]
402395 of this modifier
403396* ** onGesture** callback to notify about ongoing gesture and return current [ EnhancedZoomData] of
404397 this modifier
@@ -433,7 +426,7 @@ fun Modifier.enhancedZoom(
433426
434427* ** initialZoom** zoom set initially
435428* ** minZoom** minimum zoom value
436- * ** maxZoom maximum zoom value
429+ * ** maxZoom** maximum zoom value
437430* ** fling** when set to true dragging pointer builds up velocity. When last pointer leaves
438431 Composable a movement invoked against friction till velocity drops below to threshold
439432* ** moveToBounds** when set to true if image zoom is lower than initial zoom or panned out of image
@@ -455,7 +448,7 @@ is up but continues motion agains friction.
455448` moveToBound ` is true image moves to bounds when moved out of bounds. When
456449` fling ` is set to true image moves until velocity drops below threshold.
457450
458- ```
451+ ``` kotlin
459452@Composable
460453fun EnhancedZoomableImage (
461454 modifier : Modifier = Modifier ,
@@ -520,10 +513,10 @@ bounds with an animation or option to have fling gesture when user removes from
520513velocity is higher than threshold to have smooth touch effect.
521514
522515Difference between ` Modifier.enhancedZoom() ` and ` Modifier.animatedZoom() ` is enhanced zoom
523- uses Bitmap dimensions and returns a callback that returns [ EnhandedZoomData ] that contains
516+ uses Bitmap dimensions and returns a callback that returns [ EnhancedZoomData ] that contains
524517visible image area which is suitable for crop while ` Modifier.animatedZoom() ` requires
525518dimensions of Composable to have valid pan limiting behavior. More suitable for zooming
526- Composables while enhanced zoom is more suitable for iamge zooming.
519+ Composables while enhanced zoom is more suitable for image zooming.
527520
528521``` kotlin
529522fun Modifier.animatedZoom (
@@ -554,6 +547,23 @@ configuration to allow changing pan, zoom, and rotation.
554547Allows to change zoom, pan, translate, or get current state by calling methods on this object. To be
555548hosted and passed to [ Modifier.animatedZoom] .
556549
550+ ``` kotlin
551+ @Composable
552+ fun rememberAnimatedZoomState (
553+ contentSize : DpSize = DpSize .Zero ,
554+ initialZoom : Float = 1f,
555+ minZoom : Float = 1f,
556+ maxZoom : Float = 5f,
557+ fling : Boolean = true,
558+ moveToBounds : Boolean = false,
559+ zoomable : Boolean = true,
560+ pannable : Boolean = true,
561+ rotatable : Boolean = false,
562+ limitPan : Boolean = true,
563+ key1 : Any? = Unit
564+ )
565+ ```
566+
557567#### Parameters
558568
559569* ** contentSize** when the content that will be zoomed is not parent pass child size to bound
@@ -571,3 +581,48 @@ hosted and passed to [Modifier.animatedZoom].
571581* ** rotatable** when set to true rotation is enabled
572582* ** limitPan** limits pan to bounds of parent Composable. Using this flag prevents creating empty
573583 space on sides or edges of parent
584+
585+ ### AnimatedZoomLayout
586+
587+ Layout that can zoom, rotate, pan its content with fling and moving back to bounds animation.
588+
589+ ``` kotlin
590+ @Composable
591+ fun AnimatedZoomLayout (
592+ modifier : Modifier = Modifier ,
593+ clip : Boolean = true,
594+ initialZoom : Float = 1f,
595+ minZoom : Float = 1f,
596+ maxZoom : Float = 3f,
597+ fling : Boolean = true,
598+ moveToBounds : Boolean = false,
599+ zoomable : Boolean = true,
600+ pannable : Boolean = true,
601+ rotatable : Boolean = false,
602+ limitPan : Boolean = true,
603+ enabled : (Float , Offset , Float ) -> Boolean = DefaultEnabled ,
604+ zoomOnDoubleTap : (ZoomLevel ) -> Float = DefaultOnDoubleTap ,
605+ content : @Composable () -> Unit
606+ )
607+ ```
608+
609+ #### Parameters
610+
611+ * ** clip** when set to true clips to parent bounds. Anything outside parent bounds is not
612+ * drawn
613+ * ** minZoom** minimum zoom value
614+ * ** maxZoom** maximum zoom value
615+ * ** fling** when set to true dragging pointer builds up velocity. When last pointer leaves
616+ Composable a movement invoked against friction till velocity drops below to threshold
617+ * ** moveToBounds** when set to true if image zoom is lower than initial zoom or panned out of image
618+ boundaries moves back to bounds with animation.
619+ * ** zoomable** when set to true zoom is enabled
620+ * ** pannable** when set to true pan is enabled
621+ * ** rotatable** when set to true rotation is enabled
622+ * ** limitPan** limits pan to bounds of parent Composable. Using this flag prevents creating empty
623+ space on sides or edges of parent
624+ * ** zoomOnDoubleTap** lambda that returns current [ ZoomLevel] and based on current level enables
625+ developer to define zoom on double tap gesture
626+ * ** enabled** lambda can be used selectively enable or disable pan and intercepting with scroll,
627+ drag or lists or pagers using current zoom, pan or rotation values
628+
0 commit comments