react-native-rectangle-doc-scanner 4.11.0 → 4.12.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.
@@ -595,12 +595,19 @@ class CameraController(
595
595
  val highResSizes = capped.filter { it.width * it.height >= minAcceptableArea }
596
596
  val pool = if (highResSizes.isNotEmpty()) highResSizes else capped
597
597
 
598
+ // Debug: log aspect ratio diff for each size
599
+ pool.forEach { size ->
600
+ val diff = aspectDiff(size)
601
+ Log.d(TAG, "[SIZE_SELECTION] ${size.width}x${size.height} aspect=${size.width.toDouble()/size.height} diff=$diff")
602
+ }
603
+
598
604
  val bestDiff = pool.minOf { aspectDiff(it) }
599
- // Allow slightly more tolerance for aspect ratio (0.15 instead of 0.05) to find better matches
600
- val close = pool.filter { aspectDiff(it) <= bestDiff + 0.15 }
605
+ // Use tight tolerance (0.05) to get the best aspect ratio match
606
+ val close = pool.filter { aspectDiff(it) <= bestDiff + 0.05 }
601
607
 
602
- // Return the highest resolution among good aspect ratio matches
603
- return close.maxByOrNull { it.width * it.height } ?: pool.maxByOrNull { it.width * it.height }
608
+ 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
+ return selected
604
611
  }
605
612
 
606
613
  val matching = capped.filter { aspectDiff(it) <= ANALYSIS_ASPECT_TOLERANCE }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "4.11.0",
3
+ "version": "4.12.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",