react-native-rectangle-doc-scanner 10.34.0 → 10.35.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.
@@ -457,18 +457,22 @@ class CameraController(
457
457
  else -> 0
458
458
  }
459
459
 
460
- // The TextureView transform handles display rotation, but the coordinates coming from
461
- // ImageAnalysis are in the sensor's native orientation. We need to map those sensor-space
462
- // coordinates to the final display orientation that the user sees.
460
+ // The coordinates coming from ImageAnalysis are in sensor's native orientation.
461
+ // For a 90° sensor (phones in portrait), the camera buffer is landscape but coordinates
462
+ // are in sensor space. We need to rotate coordinates to match the display orientation.
463
463
 
464
- // For coordinate mapping, we need to account for how the image was rotated by the TextureView.
465
- // The TextureView applies: displayRotation + tabletFix
464
+ // The TextureView rotation for display
466
465
  val tabletUpsideDownFix = if (sensorOrientation == 0 && displayRotationDegrees == 90) 180 else 0
467
466
  val textureViewRotation = ((displayRotationDegrees + tabletUpsideDownFix) % 360).toFloat()
468
467
 
469
- // But the image analysis coordinates are in sensor orientation. So we need to apply
470
- // the SAME rotation that the TextureView applies to align coordinates with display.
471
- val rotationDegrees = textureViewRotation
468
+ // For coordinate mapping: we need to account for BOTH sensor orientation AND display rotation
469
+ // - Sensor 90° + Display 0°: Coordinates are in landscape sensor space, need 90° rotation to portrait
470
+ // - Sensor 0° + Display 90°: Coordinates are in portrait, need 270° rotation (display + fix)
471
+ val rotationDegrees = if (sensorOrientation == 90 && displayRotationDegrees == 0) {
472
+ 90f // Rotate coordinates 90° to match portrait display
473
+ } else {
474
+ textureViewRotation // Use TextureView rotation
475
+ }
472
476
 
473
477
  Log.d(TAG, "[MAPPING] Image: ${imageWidth}x${imageHeight}, Sensor: ${sensorOrientation}°, " +
474
478
  "Display: ${displayRotationDegrees}°, TextureView rotation: ${textureViewRotation}°, " +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "10.34.0",
3
+ "version": "10.35.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",