Skip to content

Commit 7cbb5d3

Browse files
add offset to onDoubleTap of CropModifier
1 parent 45a4918 commit 7cbb5d3

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

cropper/src/main/java/com/smarttoolfactory/cropper/CropModifier.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import androidx.compose.runtime.*
55
import androidx.compose.ui.Modifier
66
import androidx.compose.ui.composed
77
import androidx.compose.ui.draw.clipToBounds
8+
import androidx.compose.ui.geometry.Offset
89
import androidx.compose.ui.geometry.Rect
910
import androidx.compose.ui.graphics.graphicsLayer
1011
import androidx.compose.ui.input.pointer.pointerInput
@@ -92,11 +93,14 @@ fun Modifier.crop(
9293

9394
val tapModifier = Modifier.pointerInput(*keys) {
9495
detectTapGestures(
95-
onDoubleTap = {
96+
onDoubleTap = { offset: Offset ->
9697
coroutineScope.launch {
9798
zoomLevel = getNextZoomLevel(zoomLevel)
9899
val newZoom = zoomOnDoubleTap(zoomLevel)
99-
cropState.onDoubleTap(zoom = newZoom) {
100+
cropState.onDoubleTap(
101+
offset = offset,
102+
zoom = newZoom
103+
) {
100104
onGestureEnd?.invoke(cropState.cropData)
101105
}
102106
}

0 commit comments

Comments
 (0)