Fix clip preview crop

This commit is contained in:
tarsin committed 2023-03-17 20:01:42 +08:00
1 parent 7742b2c570
commit ecd39f5435
1 file changed
+6 -1
@@ -70,7 +70,12 @@ fun EhAsyncPreview(
onState = {
if (it is AsyncImagePainter.State.Success) {
it.result.drawable.run {
if ((intrinsicWidth.toFloat() / intrinsicHeight) in 0.5..0.8 && model.offsetX == Int.MIN_VALUE) {
if (intrinsicWidth.toFloat() / intrinsicHeight in 0.5..0.8) {
if (contentScale == ContentScale.Fit) contentScale = ContentScale.Crop
}
}
model.run {
if (clipWidth.toFloat() / clipHeight in 0.5..0.8) {
if (contentScale == ContentScale.Fit) contentScale = ContentScale.Crop
}
}