Mark
03/08/2024, 5:02 AMModalNavigationDrawer with gesturesEnabled = true. I noticed that when the Scaffold content is something like HorziontalPager the open drawer gesture doesn’t work, with the pager seeming taking priority. This is good. However, when the scaffold content contains my custom composable where the user can draw strokes (I use Modifier.pointerInteropFilter for this), then the drawer gestures take priority and so no strokes can be drawn. My current workaround is to explicitly disable drawer gestures when that composable is visible. But is there a better way perhaps involving priority with which pointer events are consumed?Albert Chang
03/08/2024, 1:25 PMrequestDisallowInterceptTouchEvent parameter. You should invoke the lambda if you don’t want pointer input to be stolen by parent, same as in the view world.Mark
03/08/2024, 2:32 PMRequestDisallowInterceptTouchEvent() to pointerInteropFilter and the documentation says “you can later call it” but when should it be called?Albert Chang
03/08/2024, 3:01 PMMark
03/09/2024, 2:38 AMACTION_DOWN here? Seems weird though seems to work!
val requestDisallowInterceptTouchEvent = remember { RequestDisallowInterceptTouchEvent() }
modifier = Modifier
.pointerInteropFilter(
requestDisallowInterceptTouchEvent = requestDisallowInterceptTouchEvent,
) { event ->
val offset = Offset(event.x, event.y)
when (event.action) {
MotionEvent.ACTION_DOWN -> {
requestDisallowInterceptTouchEvent(true)
onStartStroke(offset)
}
MotionEvent.ACTION_MOVE -> onPushPoint(offset)
MotionEvent.ACTION_UP -> onFinishStroke(offset)
}
true
}Albert Chang
03/09/2024, 3:55 AMMark
03/09/2024, 5:59 AMrequestDisallowInterceptTouchEvent(false) in ACTION_UPAlbert Chang
03/09/2024, 6:00 AM