react-native-rectangle-doc-scanner 10.10.0 → 10.12.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,18 +123,16 @@ class CameraController(
|
|
|
123
123
|
request.resolution.height
|
|
124
124
|
)
|
|
125
125
|
val surface = Surface(surfaceTexture)
|
|
126
|
-
request.provideSurface(surface, ContextCompat.getMainExecutor(context)) { result ->
|
|
127
|
-
Log.d(TAG, "[CAMERAX] Surface provided - result: ${result.resultCode}")
|
|
128
126
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
)
|
|
135
|
-
}
|
|
127
|
+
// Apply transform BEFORE providing surface
|
|
128
|
+
updateTextureViewTransform(
|
|
129
|
+
request.resolution.width,
|
|
130
|
+
request.resolution.height
|
|
131
|
+
)
|
|
136
132
|
|
|
137
|
-
|
|
133
|
+
request.provideSurface(surface, ContextCompat.getMainExecutor(context)) { result ->
|
|
134
|
+
Log.d(TAG, "[CAMERAX] Surface provided - result: ${result.resultCode}")
|
|
135
|
+
// Don't release surface - let CameraX manage it
|
|
138
136
|
}
|
|
139
137
|
} else {
|
|
140
138
|
Log.e(TAG, "[CAMERAX] SurfaceTexture is null! Waiting for TextureView to be ready...")
|
|
@@ -144,18 +142,16 @@ class CameraController(
|
|
|
144
142
|
Log.d(TAG, "[CAMERAX] SurfaceTexture now available ($width x $height)")
|
|
145
143
|
st.setDefaultBufferSize(request.resolution.width, request.resolution.height)
|
|
146
144
|
val surface = Surface(st)
|
|
147
|
-
request.provideSurface(surface, ContextCompat.getMainExecutor(context)) { result ->
|
|
148
|
-
Log.d(TAG, "[CAMERAX] Surface provided (delayed) - result: ${result.resultCode}")
|
|
149
145
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
)
|
|
156
|
-
}
|
|
146
|
+
// Apply transform BEFORE providing surface
|
|
147
|
+
updateTextureViewTransform(
|
|
148
|
+
request.resolution.width,
|
|
149
|
+
request.resolution.height
|
|
150
|
+
)
|
|
157
151
|
|
|
158
|
-
|
|
152
|
+
request.provideSurface(surface, ContextCompat.getMainExecutor(context)) { result ->
|
|
153
|
+
Log.d(TAG, "[CAMERAX] Surface provided (delayed) - result: ${result.resultCode}")
|
|
154
|
+
// Don't release surface - let CameraX manage it
|
|
159
155
|
}
|
|
160
156
|
}
|
|
161
157
|
|
|
@@ -460,8 +456,8 @@ class CameraController(
|
|
|
460
456
|
val centerY = viewHeight / 2f
|
|
461
457
|
|
|
462
458
|
// Camera sensor is landscape (1440x1088), but we want portrait display
|
|
463
|
-
// Rotate 90 degrees
|
|
464
|
-
matrix.postRotate(
|
|
459
|
+
// Rotate 270 degrees (or -90 degrees) to make it portrait with correct orientation
|
|
460
|
+
matrix.postRotate(270f, centerX, centerY)
|
|
465
461
|
|
|
466
462
|
// After rotation, the buffer dimensions are swapped
|
|
467
463
|
val rotatedBufferWidth = bufferHeight // 1088
|
|
@@ -472,7 +468,7 @@ class CameraController(
|
|
|
472
468
|
val scaleY = viewHeight.toFloat() / rotatedBufferHeight.toFloat()
|
|
473
469
|
val scale = scaleX.coerceAtLeast(scaleY) // Use max to fill
|
|
474
470
|
|
|
475
|
-
Log.d(TAG, "[TRANSFORM] ScaleX: $scaleX, ScaleY: $scaleY, Using: $scale")
|
|
471
|
+
Log.d(TAG, "[TRANSFORM] Rotation: 270°, ScaleX: $scaleX, ScaleY: $scaleY, Using: $scale")
|
|
476
472
|
|
|
477
473
|
matrix.postScale(scale, scale, centerX, centerY)
|
|
478
474
|
|
package/package.json
CHANGED