react-native-rectangle-doc-scanner 4.12.0 → 4.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -602,11 +602,12 @@ class CameraController(
|
|
|
602
602
|
}
|
|
603
603
|
|
|
604
604
|
val bestDiff = pool.minOf { aspectDiff(it) }
|
|
605
|
-
// Use tight tolerance (0.
|
|
606
|
-
val close = pool.filter { aspectDiff(it) <= bestDiff + 0.
|
|
605
|
+
// Use very tight tolerance (0.001) to get only the best aspect ratio matches
|
|
606
|
+
val close = pool.filter { aspectDiff(it) <= bestDiff + 0.001 }
|
|
607
607
|
|
|
608
|
+
// Among best aspect ratio matches, prefer higher resolution
|
|
608
609
|
val selected = close.maxByOrNull { it.width * it.height } ?: pool.maxByOrNull { it.width * it.height }
|
|
609
|
-
Log.d(TAG, "[SIZE_SELECTION] Best aspect diff: $bestDiff, selected: ${selected?.width}x${selected?.height}")
|
|
610
|
+
Log.d(TAG, "[SIZE_SELECTION] Best aspect diff: $bestDiff, candidates: ${close.size}, selected: ${selected?.width}x${selected?.height}")
|
|
610
611
|
return selected
|
|
611
612
|
}
|
|
612
613
|
|