Hello! :wave: I updated to compose 1.3.1 from 1.0....
# compose
m
Hello! 👋 I updated to compose 1.3.1 from 1.0.5 and suddenly my very basic signature component stopped working. It has to do with with
Copy code
pointerInteropFilter
But not sure why, maybe someone has a few pointers. 🧵
Snippet:
Copy code
@ExperimentalComposeUiApi
@Composable
fun DrawingCanvas(
    paths: MutableList<Path>
) {
    val currentPath = paths.last()
    val movePath = remember { mutableStateOf<Offset?>(null) }

    Canvas(
        modifier = Modifier
            .fillMaxSize()
            .clipToBounds()
            .pointerInteropFilter { event ->
                when (event.action) {
                    MotionEvent.ACTION_DOWN -> {
                        currentPath.moveTo(event.x, event.y)
                    }
                    MotionEvent.ACTION_MOVE -> {
                        movePath.value = Offset(event.x, event.y)
                    }
                    else -> {
                        movePath.value = null
                    }
                }
                true
            }
    ) {
        movePath.value?.let { offset ->
            currentPath.lineTo(offset.x, offset.y)
            drawPath(
                path = currentPath,
                color = Color.Black,
                style = Stroke(5f)
            )
        }
        paths.forEach {
            drawPath(
                path = it,
                color = Color.Black,
                style = Stroke(5f)
            )
        }
    }
}
Update: It seems that passing and calling requestDisallowInterceptTouchEvent fixes it:
Copy code
Canvas(
        modifier = Modifier
            .fillMaxSize()
            .clipToBounds()
            .pointerInteropFilter(
                requestDisallowInterceptTouchEvent = onDisallowIntercept
            ) { event ->
                onDisallowIntercept(true)

                when (event.action) {
                    MotionEvent.ACTION_DOWN -> {
                        currentPath.moveTo(event.x, event.y)
                    }
                    MotionEvent.ACTION_MOVE -> {
                        movePath.value = Offset(event.x, event.y)
                    }
                    else -> {
                        movePath.value = null
                    }
                }
                true
            }
    )