We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modifier.wrapContentSize()
ZoomableImage() does not correctly measure images when Modifier.wrapContentSize() is used.
ZoomableImage()
Image()
Image( modifier = Modifier.wrapContentSize(), painter = assetPainter("cat_1920.jpg"), contentDescription = null, contentScale = ContentScale.Crop, alignment = Alignment.BottomCenter, )
ZoomableImage( modifier = Modifier.wrapContentSize(), image = ZoomableImageSource.asset("cat_1920.jpg"), contentDescription = null, contentScale = ContentScale.Crop, alignment = Alignment.BottomCenter, )
@Composable internal fun ZoomableImageSource.Companion.asset(assetName: String): ZoomableImageSource { val painter = assetPainter(assetName) return remember(painter) { object : ZoomableImageSource { @Composable override fun resolve(canvasSize: Flow<Size>): ResolveResult { return ResolveResult( delegate = ZoomableImageSource.PainterDelegate(painter) ) } } } } @Composable private fun assetPainter(assetName: String): Painter { val context = LocalContext.current return remember(assetName) { context.assets.open(assetName).use { stream -> BitmapPainter(BitmapFactory.decodeStream(stream).asImageBitmap()) } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
ZoomableImage()
does not correctly measure images whenModifier.wrapContentSize()
is used.Image()
ZoomableImage()
The text was updated successfully, but these errors were encountered: