react-native-rectangle-doc-scanner 10.15.0 → 10.17.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(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
- // For back camera in portrait mode, we need to rotate counter-clockwise
479
- // Sensor = landscape sensor, need 270° (-90°) rotation
480
- // Sensor 90° = portrait sensor, need 270° (-90°) rotation to correct
481
- val rotationDegrees = when (sensorOrientation) {
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
+ ((displayRotationDegrees + sensorOrientation) % 360).toFloat()
491
+ } else {
492
+ ((displayRotationDegrees - sensorOrientation + 360) % 360).toFloat()
487
493
  }
488
494
 
489
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.15.0",
3
+ "version": "10.17.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",