Skip to content

Instantly share code, notes, and snippets.

@V-Abhilash-1999
Created May 23, 2023 12:24
Show Gist options
  • Save V-Abhilash-1999/3bea7471094f7c70d1ac42b05f694a93 to your computer and use it in GitHub Desktop.
Save V-Abhilash-1999/3bea7471094f7c70d1ac42b05f694a93 to your computer and use it in GitHub Desktop.
Emitting Click and Drag Actions in interaction source
private fun Modifier.emitDragGesture(
interactionSource: MutableInteractionSource
): Modifier = composed {
val scope = rememberCoroutineScope()
pointerInput(Unit) {
detectDragGestures { input, _ ->
scope.launch {
interactionSource.emit(PressInteraction.Press(input.position))
}
}
}.clickable(interactionSource, null) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment