react-native-rectangle-doc-scanner 4.5.0 → 4.6.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.
|
@@ -559,10 +559,13 @@ class CameraController(
|
|
|
559
559
|
}
|
|
560
560
|
|
|
561
561
|
if (preferClosestAspect) {
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
)
|
|
562
|
+
val maxAreaOverall = capped.maxOf { it.width * it.height }
|
|
563
|
+
val minAcceptableArea = max(640 * 480, (maxAreaOverall * 0.1).toInt())
|
|
564
|
+
val sized = capped.filter { it.width * it.height >= minAcceptableArea }
|
|
565
|
+
val pool = if (sized.isNotEmpty()) sized else capped
|
|
566
|
+
val bestDiff = pool.minOf { aspectDiff(it) }
|
|
567
|
+
val close = pool.filter { aspectDiff(it) <= bestDiff + 0.05 }
|
|
568
|
+
return close.maxByOrNull { it.width * it.height } ?: pool.maxByOrNull { it.width * it.height }
|
|
566
569
|
}
|
|
567
570
|
|
|
568
571
|
val matching = capped.filter { aspectDiff(it) <= ANALYSIS_ASPECT_TOLERANCE }
|