react-native-rectangle-doc-scanner 7.7.0 → 7.8.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.
|
@@ -240,8 +240,9 @@ class CameraController(
|
|
|
240
240
|
val previewSizes = streamConfigMap.getOutputSizes(SurfaceTexture::class.java)
|
|
241
241
|
Log.d(TAG, "[CAMERA2] Available preview sizes: ${previewSizes?.take(10)?.joinToString { "${it.width}x${it.height}" }}")
|
|
242
242
|
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
// Use the largest available preview size to fill the screen (like iOS uses full image extent)
|
|
244
|
+
previewSize = previewSizes?.maxByOrNull { it.width * it.height }
|
|
245
|
+
Log.d(TAG, "[CAMERA2] Selected LARGEST preview size: ${previewSize?.width}x${previewSize?.height}")
|
|
245
246
|
|
|
246
247
|
val previewAspect = previewSize?.let { it.width.toDouble() / it.height.toDouble() } ?: viewAspect
|
|
247
248
|
val analysisSizes = streamConfigMap.getOutputSizes(ImageFormat.YUV_420_888)
|
|
@@ -551,28 +552,26 @@ class CameraController(
|
|
|
551
552
|
val centerX = viewWidth / 2f
|
|
552
553
|
val centerY = viewHeight / 2f
|
|
553
554
|
|
|
554
|
-
//
|
|
555
|
-
// - The camera sensor output is landscape (1920x1088)
|
|
556
|
-
// - We need to rotate 270 degrees to display it in portrait
|
|
557
|
-
// - Then scale to fill the entire view
|
|
555
|
+
// Match iOS behavior: use the full preview extent and scale to fill
|
|
558
556
|
if (rotation == 270 || rotation == 90) {
|
|
559
|
-
//
|
|
560
|
-
matrix.postRotate(rotation.toFloat(), centerX, centerY)
|
|
561
|
-
|
|
562
|
-
// After rotation, the dimensions are swapped
|
|
557
|
+
// After rotation, dimensions are swapped
|
|
563
558
|
val rotatedWidth = preview.height.toFloat()
|
|
564
559
|
val rotatedHeight = preview.width.toFloat()
|
|
565
560
|
|
|
566
561
|
Log.d(TAG, "[TRANSFORM] After rotation: ${rotatedWidth}x${rotatedHeight}")
|
|
567
562
|
|
|
568
|
-
// Calculate scale to fill the view
|
|
563
|
+
// Calculate scale to completely fill the view (aspect fill - crop mode like iOS)
|
|
564
|
+
// This will crop the image but fill the entire screen
|
|
569
565
|
val scaleX = viewWidth / rotatedWidth
|
|
570
566
|
val scaleY = viewHeight / rotatedHeight
|
|
571
567
|
val scale = maxOf(scaleX, scaleY)
|
|
572
568
|
|
|
573
569
|
Log.d(TAG, "[TRANSFORM] scaleX=$scaleX scaleY=$scaleY finalScale=$scale")
|
|
574
570
|
|
|
575
|
-
// Apply
|
|
571
|
+
// Apply rotation around center first
|
|
572
|
+
matrix.postRotate(rotation.toFloat(), centerX, centerY)
|
|
573
|
+
|
|
574
|
+
// Then scale to fill (will crop excess)
|
|
576
575
|
matrix.postScale(scale, scale, centerX, centerY)
|
|
577
576
|
} else {
|
|
578
577
|
// For 0 or 180 degree rotation
|