react-native-rectangle-doc-scanner 7.19.0 → 7.20.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.
|
@@ -554,14 +554,13 @@ class CameraController(
|
|
|
554
554
|
val viewHeight = previewView.height.toFloat()
|
|
555
555
|
val preview = previewSize ?: return
|
|
556
556
|
if (viewWidth == 0f || viewHeight == 0f) return
|
|
557
|
-
val
|
|
558
|
-
val rotationDegrees = displayRotationDegrees()
|
|
557
|
+
val rotationDegrees = computeRotationDegrees()
|
|
559
558
|
Log.d(TAG, "[TRANSFORM] rotation=$rotationDegrees view=${viewWidth}x${viewHeight} preview=${preview.width}x${preview.height}")
|
|
560
559
|
|
|
561
560
|
val matrix = Matrix()
|
|
562
561
|
val centerX = viewWidth / 2f
|
|
563
562
|
val centerY = viewHeight / 2f
|
|
564
|
-
val isSwapped =
|
|
563
|
+
val isSwapped = rotationDegrees == 90 || rotationDegrees == 270
|
|
565
564
|
val bufferWidth = if (isSwapped) preview.height.toFloat() else preview.width.toFloat()
|
|
566
565
|
val bufferHeight = if (isSwapped) preview.width.toFloat() else preview.height.toFloat()
|
|
567
566
|
val scale = max(viewWidth / bufferWidth, viewHeight / bufferHeight)
|
|
@@ -572,14 +571,8 @@ class CameraController(
|
|
|
572
571
|
matrix.setScale(scale, scale)
|
|
573
572
|
matrix.postTranslate(dx, dy)
|
|
574
573
|
|
|
575
|
-
if (
|
|
576
|
-
|
|
577
|
-
Surface.ROTATION_90 -> -90f
|
|
578
|
-
Surface.ROTATION_180 -> 180f
|
|
579
|
-
Surface.ROTATION_270 -> 90f
|
|
580
|
-
else -> 0f
|
|
581
|
-
}
|
|
582
|
-
matrix.postRotate(rotateDegrees, centerX, centerY)
|
|
574
|
+
if (rotationDegrees != 0) {
|
|
575
|
+
matrix.postRotate(rotationDegrees.toFloat(), centerX, centerY)
|
|
583
576
|
}
|
|
584
577
|
|
|
585
578
|
previewView.setTransform(matrix)
|