You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @param contentDescription text for accessibility see [Image] for further info
24
24
* @param onSwipeLeft Optional function to run when user swipes from right to left - does nothing by default
25
25
* @param onSwipeRight Optional function to run when user swipes from left to right - does nothing by default
26
-
* @param dragGestureMode A function with a [ZoomableState] scope that returns a boolean value to enable/disable dragging gestures (swiping and panning). Returns `true` by default. *Note*: For some use cases it may be required that only panning is possible. Use `{!notTransformed}` in that case
26
+
* @param dragGestureMode A function with a [ZoomableState] scope that returns a [DragGestureMode] value that signals which drag gesture should currently be active. By default panning is enabled when zoomed, else swipe gestures are enabled.
27
27
* @param onDoubleTap Optional function to run when user double taps. Zooms in by 2x when scale is currently 1 and zooms out to scale = 1 when zoomed in when null (default)
28
28
*/
29
29
@Composable
@@ -60,7 +60,7 @@ public fun ZoomableImage(
60
60
* @param contentDescription text for accessibility see [Image] for further info
61
61
* @param onSwipeLeft Optional function to run when user swipes from right to left - does nothing by default
62
62
* @param onSwipeRight Optional function to run when user swipes from left to right - does nothing by default
63
-
* @param dragGestureMode A function with a [ZoomableState] scope that returns a boolean value to enable/disable dragging gestures (swiping and panning). Returns `true` by default. *Note*: For some use cases it may be required that only panning is possible. Use `{!notTransformed}` in that case
63
+
* @param dragGestureMode A function with a [ZoomableState] scope that returns a [DragGestureMode] value that signals which drag gesture should currently be active. By default panning is enabled when zoomed, else swipe gestures are enabled.
64
64
* @param onDoubleTap Optional function to run when user double taps. Zooms in by 2x when scale is currently 1 and zooms out to scale = 1 when zoomed in when null (default)
65
65
*/
66
66
@Composable
@@ -101,7 +101,7 @@ public fun ZoomableImage(
101
101
* @param contentDescription text for accessibility see [Image] for further info
102
102
* @param onSwipeLeft Optional function to run when user swipes from right to left - does nothing by default
103
103
* @param onSwipeRight Optional function to run when user swipes from left to right - does nothing by default
104
-
* @param dragGestureMode A function with a [ZoomableState] scope that returns a boolean value to enable/disable dragging gestures (swiping and panning). Returns `true` by default. *Note*: For some use cases it may be required that only panning is possible. Use `{!notTransformed}` in that case
104
+
* @param dragGestureMode A function with a [ZoomableState] scope that returns a [DragGestureMode] value that signals which drag gesture should currently be active. By default panning is enabled when zoomed, else swipe gestures are enabled.
105
105
* @param onDoubleTap Optional function to run when user double taps. Zooms in by 2x when scale is currently 1 and zooms out to scale = 1 when zoomed in when null (default)
Copy file name to clipboardExpand all lines: zoomables/src/main/kotlin/de/mr_pine/zoomables/ZoomableState.kt
+6-5Lines changed: 6 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,8 @@ private const val zoomedThreshold = 1.0E-3f
23
23
* An implementation of [TransformableState] containing the values for the current [scale], [offset] and [rotation]. It's normally obtained using [rememberTransformableState]
24
24
* Other than [TransformableState] obtained by [rememberTransformableState], [ZoomableState] exposes [scale], [offset] and [rotation]
25
25
*
26
+
* As
27
+
*
26
28
* @param scale [MutableState]<[Float]> of the scale this state is initialized with
27
29
* @param offset [MutableState]<[Offset]> of the offset this state is initialized with
28
30
* @param rotation [MutableState]<[Float]> in degrees of the rotation this state is initialized with
@@ -34,7 +36,8 @@ private const val zoomedThreshold = 1.0E-3f
34
36
* @property scale The current scale as [MutableState]<[Float]>
35
37
* @property offset The current offset as [MutableState]<[Offset]>
36
38
* @property rotation The current rotation in degrees as [MutableState]<[Float]>
37
-
* @property notTransformed `true` if [scale] is `1`, [offset] is [Offset.Zero] and [rotation] is `0`
39
+
* @property transformed `false` if [scale] is `1`, [offset] is [Offset.Zero] and [rotation] is `0`
40
+
* @property zoomed Whether the content is zoomed (in or out)
38
41
*/
39
42
publicclassZoomableState(
40
43
publicvarscale:MutableState<Float>,
@@ -47,10 +50,8 @@ public class ZoomableState(
47
50
publicval zoomed:Boolean
48
51
get() = scale.value in (1- zoomedThreshold)..(1+ zoomedThreshold)
Copy file name to clipboardExpand all lines: zoomables/src/main/kotlin/de/mr_pine/zoomables/Zoomables.kt
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ import kotlin.math.*
37
37
*
38
38
* @param coroutineScope used for smooth asynchronous zoom/pan/rotation animations
39
39
* @param zoomableState Contains the current transform states - obtained via [rememberZoomableState]
40
-
* @param dragGestureMode A function with a [ZoomableState] scope that returns a boolean value to enable/disable dragging gestures (swiping and panning). Returns `true` by default. *Note*: For some use cases it may be required that only panning is possible. Use `{!notTransformed}` in that case
40
+
* @param dragGestureMode A function with a [ZoomableState] scope that returns a [DragGestureMode] value that signals which drag gesture should currently be active. By default panning is enabled when zoomed, else swipe gestures are enabled.
41
41
* @param onSwipeLeft Optional function to run when user swipes from right to left - does nothing by default
42
42
* @param onSwipeRight Optional function to run when user swipes from left to right - does nothing by default
43
43
* @param minimumSwipeDistance Minimum distance the user has to travel on the screen for it to count as swiping
0 commit comments