react-native-rectangle-doc-scanner 10.15.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,23 +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
|
-
0 -> 270f // Tablet - landscape sensor
|
|
483
|
-
90 -> 270f // Phone - portrait sensor but still needs 270° rotation
|
|
484
|
-
180 -> 90f // Inverted
|
|
485
|
-
270 -> 90f // Some rare devices
|
|
486
|
-
else -> 270f
|
|
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()
|
|
487
493
|
}
|
|
488
494
|
|
|
489
495
|
Log.d(TAG, "[TRANSFORM] Applying rotation: ${rotationDegrees}°")
|
package/package.json
CHANGED