I have a `pointerInput` modifier on `Box` and `poi...
# compose
s
I have a
pointerInput
modifier on
Box
and
pointerInteropFilter
on its children. However, the
pointerInteropFilter
modifiers on the children do not receive events because of the
pointerInput
on the parent. When I remove the parent
pointerInput
, the
pointerInteropFilter
modifiers on children work fine. I'm creating a draggable, rotatable, and resizable composable with controls at the corner (see image). How can I fix this? Code in thread
Copy code
Box(
    modifier = Modifier
        ...
        .pointerInput(...)
        ...
) {
    content()

    Control(
        modifier = Modifier
            .align(Alignment.TopStart)
            .offset(...)
            .pointerInteropFilter(...),
        ...
    )

    Control(
        modifier = Modifier
            .align(Alignment.TopEnd)
            .offset(...)
            .pointerInteropFilter(...),
        ...
    )

    ...
}
a
I'm curious, why are you using
pointerInteropFilter
at all as opposed to
pointerInput
?
s
I'm migrating from the view system so I had the code for handling events
I used the
RequestDisallowInterceptTouchEvent
and now it works but only when the pointer is inside the parent (inside the border). Hopefully this is how the
RequestDisallowInterceptTouchEvent
is used?
Copy code
val requestDisallowInterceptTouchEvent = remember { RequestDisallowInterceptTouchEvent() }
pointerInteropFilter(
    requestDisallowInterceptTouchEvent = requestDisallowInterceptTouchEvent
) { e ->
    requestDisallowInterceptTouchEvent.invoke(true)
    ...

    true
}
pointerInput
does the same (only detects events inside the parent)
281 Views