Skip to content

Commit 79fde4d

Browse files
Merge pull request #2 from dev-diaries41/fix/typo
Fix typo in getScaledDimensions args
2 parents 34d9319 + 8147e03 commit 79fde4d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

core/src/main/java/com/fpf/smartscansdk/core/utils/ImageUtils.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ fun centerCrop(bitmap: Bitmap, imageSize: Int): Bitmap {
2525
return bitmapCropped
2626
}
2727

28-
fun getScaledDimensions(imgWith: Int, imgHeight: Int, maxSize: Int = 1024): Pair<Int, Int> {
29-
if (imgWith <= maxSize && imgHeight <= maxSize) {
30-
return imgWith to imgHeight
28+
fun getScaledDimensions(width: Int, height: Int, maxSize: Int = 1024): Pair<Int, Int> {
29+
if (width <= maxSize && height <= maxSize) {
30+
return width to height
3131
}
32-
return if (imgWith >= imgHeight) {
33-
val scale = maxSize.toFloat() / imgWith
34-
maxSize to (imgHeight * scale).toInt()
32+
return if (width >= height) {
33+
val scale = maxSize.toFloat() / width
34+
maxSize to (height * scale).toInt()
3535
} else {
36-
val scale = maxSize.toFloat() / imgHeight
37-
(imgWith * scale).toInt() to maxSize
36+
val scale = maxSize.toFloat() / height
37+
(width * scale).toInt() to maxSize
3838
}
3939
}
4040

0 commit comments

Comments
 (0)