react-native-rectangle-doc-scanner 10.38.0 → 10.39.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.
@@ -123,6 +123,7 @@ class CameraController(
123
123
  Log.d(TAG, "[CAMERAX] Setting target rotation to ROTATION_0 (portrait-only app)")
124
124
 
125
125
  preview = Preview.Builder()
126
+ .setTargetAspectRatio(AspectRatio.RATIO_4_3)
126
127
  .setTargetRotation(targetRotation) // Force portrait
127
128
  .build()
128
129
  .also { previewUseCase ->
@@ -185,7 +186,7 @@ class CameraController(
185
186
  // ImageAnalysis UseCase for document detection
186
187
  imageAnalyzer = ImageAnalysis.Builder()
187
188
  .setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
188
- .setTargetResolution(android.util.Size(1920, 1440)) // Higher resolution for better small-edge detection
189
+ .setTargetAspectRatio(AspectRatio.RATIO_4_3)
189
190
  .setTargetRotation(targetRotation) // Match preview rotation
190
191
  .build()
191
192
  .also {
@@ -201,6 +202,7 @@ class CameraController(
201
202
  // ImageCapture UseCase
202
203
  imageCapture = ImageCapture.Builder()
203
204
  .setCaptureMode(ImageCapture.CAPTURE_MODE_MAXIMIZE_QUALITY)
205
+ .setTargetAspectRatio(AspectRatio.RATIO_4_3)
204
206
  .setTargetRotation(targetRotation) // Match preview rotation
205
207
  .build()
206
208
 
@@ -515,10 +517,8 @@ class CameraController(
515
517
  val centerY = viewHeight / 2f
516
518
 
517
519
  // Calculate rotation from buffer to display coordinates.
518
- // CameraX accounts for sensor orientation via targetRotation. Some tablets with landscape
519
- // sensors report Display 90 in portrait but render upside down; add a 180° fix for that case.
520
- val tabletUpsideDownFix = if (sensorOrientation == 0 && displayRotationDegrees == 90) 180 else 0
521
- val rotationDegrees = ((displayRotationDegrees + tabletUpsideDownFix) % 360).toFloat()
520
+ // CameraX provides buffers in sensor orientation; rotate to match display.
521
+ val rotationDegrees = ((sensorOrientation - displayRotationDegrees + 360) % 360).toFloat()
522
522
 
523
523
  Log.d(TAG, "[TRANSFORM] Applying rotation: ${rotationDegrees}°")
524
524
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "10.38.0",
3
+ "version": "10.39.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",