tmphey
12/19/2023, 9:56 AM@Composable
private fun TestCanvas() {
var offset by remember { mutableStateOf(Offset.Zero) }
Box(
modifier = Modifier.fillMaxSize()
.border(1.dp, Color.Green)
.pointerInput(Unit) {
detectDragGestures { change, dragAmount ->
change.consume()
offset += dragAmount
}
}
) {
Box(modifier = Modifier
.size(100.dp)
.graphicsLayer {
translationX = -offset.x
translationY = -offset.y
}
.border(1.dp, Color.Blue)
) {
Text(
text = "Text inside the blue box with offset",
fontSize = 12.sp,
modifier = Modifier
.offset(x = 150.dp, y = 150.dp)
)
}
}
}
Basically, what it does, it offsets a container on drag to implement infinite scrolling in any direction.
It works perfectly fine on android but it stops rendering everything inside the container on desktop (and wasm too, iOS hasn't been checked it) when container leaves the screen (see attached video).
I wonder, is it a bug on Android, multiplatform or I'm doing something wrong?tmphey
12/19/2023, 10:06 AMtmphey
12/19/2023, 10:09 AMAlexander Maryanovsky
12/19/2023, 12:09 PM