jvziyaoyao / scale

🖼 An image viewer for Jetpack Compose with transition animations and support for large images. 😄 一款基于Jetpack Compose开发的图片浏览库,支持过渡变换和超大图片的显示。
https://jvziyaoyao.github.io/scale
Apache License 2.0
115 stars 6 forks source link

Flashing when loading the image using zoomableview #39

Closed Zeng1998 closed 1 month ago

Zeng1998 commented 2 months ago

I see obvious flashing when open the dialog. The image is initially stretched to "fillmaxsize" and then instantly shrink to the appropriate size.

When I use asyncimage instead of image, the flashing disappears, but the zoom in/out operation is not possible.

BasicAlertDialog(
            modifier = Modifier.fillMaxSize(),
            properties = DialogProperties(usePlatformDefaultWidth = false),
            onDismissRequest = { isGalleryMode = false }
        ) {
            Box(modifier = Modifier.fillMaxSize()) {
                ZoomableView(
                    modifier = Modifier
                        .padding(16.dp)
                        .fillMaxSize(),
                    state = state,
                ) {
                    AsyncImage(
                        modifier = Modifier
                            .fillMaxSize()
                            .rotate(rotation),
                        model = imageItems[currentImageIndex],
                        contentDescription = null,
                    )
//                    Image(
//                        modifier = Modifier
//                            .fillMaxSize()
//                            .rotate(rotation),
//                        painter = painter,
//                        contentDescription = null
//                    )
                }
    }
}

https://github.com/user-attachments/assets/34e757cf-6cbc-4a0d-afed-66fffd2e51ef

Zeng1998 commented 2 months ago

I realize that it seems to be caused by the Image's contentScale (ContentScale.Fit) .

jvziyaoyao commented 2 months ago

I realize that it seems to be caused by the Image's contentScale (ContentScale.Fit) .

Have you resolved this issue yet?