Michael Bichlmeier
01/13/2022, 9:25 AMAlbert Chang
01/13/2022, 12:21 PMMichael Bichlmeier
01/13/2022, 1:52 PM@Composable
fun ZoomableImageWithOverlay() {
// this one should handle the overlay visibility
var isOverlayVisible by remember { mutableStateOf(true) }
val state = rememberZoomableState(
minScale = 0.8f,
maxScale = 6f,
overZoomConfig = OverZoomConfig(1f, 4f)
)
//
Box(modifier = Modifier
.fillMaxSize()
.pointerInput(Unit) {
detectTapGestures(onTap = { isOverlayVisible = !isOverlayVisible })
}
) {
Zoomable(
state = state,
enabled = true,
dismissGestureEnabled = false,
) {
Image(
painter = rememberImagePainter(data = "<https://picsum.photos/1200/1800>"),
contentDescription = null,
modifier = Modifier.fillMaxSize()
)
}
AnimatedVisibility(visible = isOverlayVisible) {
Text(text = "Here is my overlay stuff")
}
}
}
Do you have an idea what I’m doing wrong?
No matter what I do, either the whole Layout consumes alle touch events or only the Zoomable receives them.Albert Chang
01/28/2022, 12:11 PMMichael Bichlmeier
02/01/2022, 1:19 PMAlbert Chang
02/01/2022, 2:01 PM