react-native-rectangle-doc-scanner 10.14.0 → 10.16.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.
|
@@ -467,24 +467,29 @@ class CameraController(
|
|
|
467
467
|
|
|
468
468
|
// Get sensor orientation to determine correct rotation
|
|
469
469
|
val sensorOrientation = getCameraSensorOrientation()
|
|
470
|
+
val displayRotationDegrees = when (textureView.display?.rotation ?: Surface.ROTATION_0) {
|
|
471
|
+
Surface.ROTATION_0 -> 0
|
|
472
|
+
Surface.ROTATION_90 -> 90
|
|
473
|
+
Surface.ROTATION_180 -> 180
|
|
474
|
+
Surface.ROTATION_270 -> 270
|
|
475
|
+
else -> 0
|
|
476
|
+
}
|
|
470
477
|
|
|
471
|
-
Log.d(
|
|
478
|
+
Log.d(
|
|
479
|
+
TAG,
|
|
480
|
+
"[TRANSFORM] View: ${viewWidth}x${viewHeight}, Buffer: ${bufferWidth}x${bufferHeight}, " +
|
|
481
|
+
"Sensor: ${sensorOrientation}°, Display: ${displayRotationDegrees}°"
|
|
482
|
+
)
|
|
472
483
|
|
|
473
484
|
val matrix = android.graphics.Matrix()
|
|
474
485
|
val centerX = viewWidth / 2f
|
|
475
486
|
val centerY = viewHeight / 2f
|
|
476
487
|
|
|
477
|
-
// Calculate rotation
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
val rotationDegrees = when (sensorOrientation) {
|
|
483
|
-
0 -> 270f // Tablet case - sensor is landscape, rotate to portrait
|
|
484
|
-
90 -> 90f // Most phones - sensor already portrait-ish, small correction
|
|
485
|
-
180 -> 180f
|
|
486
|
-
270 -> 270f
|
|
487
|
-
else -> 90f
|
|
488
|
+
// Calculate rotation from buffer to display coordinates.
|
|
489
|
+
val rotationDegrees = if (useFrontCamera) {
|
|
490
|
+
((sensorOrientation + displayRotationDegrees) % 360).toFloat()
|
|
491
|
+
} else {
|
|
492
|
+
((sensorOrientation - displayRotationDegrees + 360) % 360).toFloat()
|
|
488
493
|
}
|
|
489
494
|
|
|
490
495
|
Log.d(TAG, "[TRANSFORM] Applying rotation: ${rotationDegrees}°")
|
package/package.json
CHANGED