react-native-rectangle-doc-scanner 7.41.0 → 7.43.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.
|
@@ -580,12 +580,18 @@ class CameraController(
|
|
|
580
580
|
val centerY = viewRect.centerY()
|
|
581
581
|
|
|
582
582
|
if (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) {
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
583
|
+
// When rotated 90/270, preview dimensions are swapped
|
|
584
|
+
val swappedWidth = preview.height.toFloat()
|
|
585
|
+
val swappedHeight = preview.width.toFloat()
|
|
586
|
+
|
|
587
|
+
// Calculate scale to fill the view while maintaining aspect ratio
|
|
588
|
+
val scaleX = viewWidth / swappedWidth
|
|
589
|
+
val scaleY = viewHeight / swappedHeight
|
|
590
|
+
val scale = max(scaleX, scaleY)
|
|
591
|
+
|
|
592
|
+
// Apply transformations: first rotate, then scale
|
|
588
593
|
matrix.postRotate(90f * (rotation - 2), centerX, centerY)
|
|
594
|
+
matrix.postScale(scale, scale, centerX, centerY)
|
|
589
595
|
} else if (rotation == Surface.ROTATION_180) {
|
|
590
596
|
matrix.postRotate(180f, centerX, centerY)
|
|
591
597
|
} else {
|