Hey folks! I'm working on a compose app with infin...
# compose-desktop
t
Hey folks! I'm working on a compose app with infinite canvas and discovered a strange thing. Here is the code:
Copy code
@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?
Note: Even tho items are not visible they still exist, clicks work, etc
a
Yeah, it’s a known issue, unfortunately.
❤️ 1
100 Views