I need to detect touch events and change some state with respect to up and down motion events. The next code (see the thread) works well with simple taps, but if I tap with 3 fingers, it adds only "Down" event, but no "Up". What could be the problem? Do I need to use something else besides
pointerInteropFilter
?
✅ 1
Denis
12/30/2020, 10:47 PM
Copy code
var log by remember { mutableStateOf(listOf<String>()) }
Surface(
color = MaterialTheme.colors.background,
modifier = Modifier.fillMaxSize().pointerInteropFilter {
when (it.action) {
MotionEvent.ACTION_DOWN -> log = log + "Down"
MotionEvent.ACTION_UP -> log = log + "Up"
MotionEvent.ACTION_MOVE -> log = log + "Move"
else -> false
}
true
}
) { Column { for (l in log.takeLast(20)) Text(l) } }