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
|
-
.
|
|
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
|
|
519
|
-
|
|
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