Skip to content

Commit

Permalink
fix for (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
T8RIN committed Mar 23, 2023
1 parent 85e5aab commit 8f18f8f
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,19 @@ class CompareViewModel : ViewModel() {
}
}
_rotation.value = 0f
_bitmapData.value = bmp1 to bmp2
_bitmapData.value = (bmp1 to bmp2)
.let { (b, a) ->
val (bW, bH) = b?.run { width to height } ?: (0 to 0)
val (aW, aH) = a?.run { width to height } ?: (0 to 0)

if (bW * bH > aH * aW) {
b to a?.resizeBitmap(bW, bH, 1)
} else if (bW * bH < aH * aW) {
b?.resizeBitmap(aW, aH, 1) to a
} else {
b to a
}
}
_isLoading.value = false
}
}
Expand Down

0 comments on commit 8f18f8f

Please sign in to comment.