react-native-rectangle-doc-scanner 7.44.0 → 7.45.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.
|
@@ -584,20 +584,30 @@ class CameraController(
|
|
|
584
584
|
val swappedWidth = preview.height.toFloat()
|
|
585
585
|
val swappedHeight = preview.width.toFloat()
|
|
586
586
|
|
|
587
|
-
// Android: Use
|
|
588
|
-
val effectiveViewHeight = viewHeight * 0.
|
|
589
|
-
val verticalPadding = (viewHeight - effectiveViewHeight) / 2f
|
|
587
|
+
// Android: Use 90% of view height to add 10% padding (5% top + 5% bottom)
|
|
588
|
+
val effectiveViewHeight = viewHeight * 0.90f
|
|
590
589
|
|
|
591
590
|
// Calculate scale to fit within the effective area while maintaining aspect ratio
|
|
592
591
|
val scaleX = viewWidth / swappedWidth
|
|
593
592
|
val scaleY = effectiveViewHeight / swappedHeight
|
|
594
593
|
val scale = min(scaleX, scaleY)
|
|
595
594
|
|
|
596
|
-
//
|
|
597
|
-
|
|
598
|
-
|
|
595
|
+
// Calculate the final dimensions after scaling
|
|
596
|
+
val scaledWidth = swappedWidth * scale
|
|
597
|
+
val scaledHeight = swappedHeight * scale
|
|
599
598
|
|
|
600
|
-
|
|
599
|
+
// Create buffer rectangle at origin
|
|
600
|
+
val bufferRectRotated = RectF(0f, 0f, swappedHeight, swappedWidth)
|
|
601
|
+
|
|
602
|
+
// Set up the matrix: scale and center the rotated preview
|
|
603
|
+
matrix.setScale(scale, scale)
|
|
604
|
+
matrix.postRotate(90f * (rotation - 2), scaledWidth / 2f, scaledHeight / 2f)
|
|
605
|
+
matrix.postTranslate(
|
|
606
|
+
centerX - scaledWidth / 2f,
|
|
607
|
+
centerY - scaledHeight / 2f
|
|
608
|
+
)
|
|
609
|
+
|
|
610
|
+
Log.d(TAG, "[TRANSFORM] Android: effectiveHeight=$effectiveViewHeight, scale=$scale, scaledSize=${scaledWidth}x${scaledHeight}")
|
|
601
611
|
} else if (rotation == Surface.ROTATION_180) {
|
|
602
612
|
matrix.postRotate(180f, centerX, centerY)
|
|
603
613
|
} else {
|