react-native-rectangle-doc-scanner 7.36.0 → 7.37.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.
|
@@ -575,17 +575,18 @@ class CameraController(
|
|
|
575
575
|
val centerX = viewRect.centerX()
|
|
576
576
|
val centerY = viewRect.centerY()
|
|
577
577
|
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
}
|
|
588
|
-
|
|
578
|
+
// Center-crop without distortion for all rotations.
|
|
579
|
+
matrix.setRectToRect(bufferRect, viewRect, Matrix.ScaleToFit.CENTER)
|
|
580
|
+
val scale = max(viewWidth / bufferRect.width(), viewHeight / bufferRect.height())
|
|
581
|
+
matrix.postScale(scale, scale, centerX, centerY)
|
|
582
|
+
val rotateDegrees = when (rotation) {
|
|
583
|
+
Surface.ROTATION_90 -> -90f
|
|
584
|
+
Surface.ROTATION_180 -> 180f
|
|
585
|
+
Surface.ROTATION_270 -> 90f
|
|
586
|
+
else -> 0f
|
|
587
|
+
}
|
|
588
|
+
if (rotateDegrees != 0f) {
|
|
589
|
+
matrix.postRotate(rotateDegrees, centerX, centerY)
|
|
589
590
|
}
|
|
590
591
|
|
|
591
592
|
previewView.setTransform(matrix)
|