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(TAG, "[TRANSFORM] View: ${viewWidth}x${viewHeight}, Buffer: ${bufferWidth}x${bufferHeight}, Sensor: ${sensorOrientation}°")
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 needed for portrait display
478
- // The rotation is inverse of sensor orientation
479
- // Sensor = device held naturally shows landscape, need 270° to portrait
480
- // Sensor 90° = device held naturally shows portrait, need 90° correction
481
- // Sensor 270° = need 270° correction
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "10.14.0",
3
+ "version": "10.16.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",