Hello! How do I handle click event without consumi...
# compose-desktop
Hello! How do I handle click event without consuming them? Say that you have a
with a such modifier to intercept the clicks and do stuff, but I want the
of the box to also receive the clicks!
@Igor Demin :3
There is no a high-level modifier for that (clickable or onClick). But you can add
to the Box and react to events, without consuming them (
is called by clickable or onClick, for example)
I had a similar one, here: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1677561456829879 The closest I got was Modifier.nestedScroll(connection, dispatcher) but still, the parent event dispatching worked when the Parent composable is a Pager but not when it is a NavigationDrawer. Perhaps we need a modifier similar Android Modifier.pointerInteropFilter, it gives you the chance to get the event stream and participate/not-participate in the consumption by returning true/false in the dispatching function/lambda.
Using Modifier.pointerInput and not consuming the event, did not work for me. Perhaps a bug 🪲🤔
I think you’d need to use the Initial input pass to do this, not the default Main. Initial is top-down, Main is bottom-up.
first time I heard of it. Could you point out some documentation in regards Zach. I am consuming Main apparently, because I noticed my events gets passed to the inner most composable.
Thanks Zach, I was able to achieve what I want it. Using a combination of
Copy code
forEachGesture {
    awaitPointerEventScope {
         val eventDown = awaitFirstDown(requireUnconsumed = true)
          do {

              val event: PointerEvent = awaitPointerEvent(PointerEventPass.Main)
          } while (event.changes.any { it.pressed })
ephemient had given me some directions in another thread. I understand the touch API better now. Bellow is a video of what I was describing.