Created
May 23, 2023 12:24
-
-
Save V-Abhilash-1999/3bea7471094f7c70d1ac42b05f694a93 to your computer and use it in GitHub Desktop.
Emitting Click and Drag Actions in interaction source
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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