Vivek Sharma
01/01/2022, 11:32 AMModifier.pointerInput(Unit) {
detectTransformGestures { centroid, pan, zoom, rotation ->
offset += pan
scale *= zoom
}
}
I am zooming the image and I need to know when the zoom drag is ended like we removed the fingers?
Further info 👇Vivek Sharma
01/01/2022, 12:38 PMdetectTransformGestures , I can't control onDragEnd: () -> Unit , there is no such paramVivek Sharma
01/01/2022, 12:38 PMdetectDragGestures , I have onDragEnd: () -> Unit , But I can't control zooming , only I can control panning/draggingAlbert Chang
01/01/2022, 5:47 PMMichael Paus
01/01/2022, 6:55 PMVivek Sharma
01/02/2022, 6:15 AMAlbert Chang
01/02/2022, 10:41 AMdetect*Gestures functions. Nothing counterintuitive.Vivek Sharma
01/02/2022, 11:06 AMModifier.pointerInput(Unit) {
detectTransformGestures { centroid, pan, zoom, rotation ->
offset += pan
scale *= zoom
}
detectDragGestures {
// used onDragEnd() something here
}
}
But this thing didn't work and only the lambda fun used first was working onlyVivek Sharma
01/02/2022, 11:08 AMAlbert Chang
01/02/2022, 12:06 PMcoroutineScope and launch as shown here. If you are familiar with coroutines, there’s nothing special here.Michael Paus
01/02/2022, 12:19 PMModifier
.pointerInput(Unit) {
detectTransformGestures { centroid, pan, zoom, rotation ->
offset += pan
scale *= zoom
}
}
.pointerInput(Unit) {
detectDragGestures {
// used onDragEnd() something here
}
}
But this won’t change anything here because detectTransformGestures and detectDragGestures are mutually exclusive.Vivek Sharma
01/02/2022, 12:28 PMAlbert Chang
01/02/2022, 12:33 PMModifier.transformable() instead of detectTransformGestures.Vivek Sharma
01/02/2022, 1:36 PMonDragEnd something like that in Modifier.transformable() ?Albert Chang
01/02/2022, 5:08 PMAlbert Chang
01/04/2022, 6:54 AMPointerInputScope is valid as documented here.
More than oneAlso see design note here.can run concurrently in the sameawaitPointerEventScopeby usingPointerInputScope. `block`s are dispatched to in the order in which they were installed.kotlinx.coroutines.launch
Michael Paus
01/04/2022, 10:45 AM