react-native-rectangle-doc-scanner 7.60.0 → 7.62.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.
|
@@ -661,14 +661,10 @@ class CameraController(
|
|
|
661
661
|
if (viewWidth == 0f || viewHeight == 0f) return
|
|
662
662
|
|
|
663
663
|
val rotationDegrees = computeRotationDegrees()
|
|
664
|
-
val
|
|
665
|
-
90 -> 270
|
|
666
|
-
270 -> 90
|
|
667
|
-
else -> rotationDegrees
|
|
668
|
-
}
|
|
664
|
+
val displayRotation = displayRotationDegrees()
|
|
669
665
|
Log.d(
|
|
670
666
|
TAG,
|
|
671
|
-
"[TRANSFORM]
|
|
667
|
+
"[TRANSFORM] rotations sensor=$sensorOrientation display=$displayRotation computed=$rotationDegrees view=${viewWidth}x${viewHeight} preview=${preview.width}x${preview.height}"
|
|
672
668
|
)
|
|
673
669
|
|
|
674
670
|
val matrix = Matrix()
|
|
@@ -676,24 +672,24 @@ class CameraController(
|
|
|
676
672
|
val centerX = viewRect.centerX()
|
|
677
673
|
val centerY = viewRect.centerY()
|
|
678
674
|
|
|
679
|
-
val isSwapped =
|
|
675
|
+
val isSwapped = rotationDegrees == 90 || rotationDegrees == 270
|
|
680
676
|
val bufferWidth = if (isSwapped) preview.height.toFloat() else preview.width.toFloat()
|
|
681
677
|
val bufferHeight = if (isSwapped) preview.width.toFloat() else preview.height.toFloat()
|
|
682
678
|
val bufferRect = RectF(0f, 0f, bufferWidth, bufferHeight)
|
|
683
679
|
bufferRect.offset(centerX - bufferRect.centerX(), centerY - bufferRect.centerY())
|
|
684
680
|
|
|
685
681
|
matrix.setRectToRect(viewRect, bufferRect, Matrix.ScaleToFit.FILL)
|
|
686
|
-
val scale = max(viewWidth /
|
|
682
|
+
val scale = max(viewWidth / bufferRect.width(), viewHeight / bufferRect.height())
|
|
687
683
|
matrix.postScale(scale, scale, centerX, centerY)
|
|
688
|
-
if (
|
|
689
|
-
matrix.postRotate(
|
|
684
|
+
if (rotationDegrees != 0) {
|
|
685
|
+
matrix.postRotate(rotationDegrees.toFloat(), centerX, centerY)
|
|
690
686
|
}
|
|
691
687
|
|
|
692
688
|
previewView.setTransform(matrix)
|
|
693
689
|
latestTransform = Matrix(matrix)
|
|
694
690
|
latestBufferWidth = preview.width
|
|
695
691
|
latestBufferHeight = preview.height
|
|
696
|
-
latestTransformRotation =
|
|
692
|
+
latestTransformRotation = rotationDegrees
|
|
697
693
|
|
|
698
694
|
val pts = floatArrayOf(
|
|
699
695
|
0f, 0f,
|
|
@@ -708,6 +704,10 @@ class CameraController(
|
|
|
708
704
|
"buffer=${bufferWidth}x${bufferHeight} scale=$scale center=${centerX}x${centerY} matrix=$matrix " +
|
|
709
705
|
"pts=[${pts[0]},${pts[1]} ${pts[2]},${pts[3]} ${pts[4]},${pts[5]} ${pts[6]},${pts[7]}]"
|
|
710
706
|
)
|
|
707
|
+
val recomputed = computeRotationDegrees()
|
|
708
|
+
if (rotationDegrees != recomputed) {
|
|
709
|
+
Log.e(TAG, "[TRANSFORM] rotation mismatch computed=$rotationDegrees recomputed=$recomputed")
|
|
710
|
+
}
|
|
711
711
|
Log.d(TAG, "[TRANSFORM] Matrix applied successfully")
|
|
712
712
|
}
|
|
713
713
|
|