react-native-rectangle-doc-scanner 3.196.0 → 3.198.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.
|
@@ -357,10 +357,10 @@ class CameraController(
|
|
|
357
357
|
return
|
|
358
358
|
}
|
|
359
359
|
|
|
360
|
-
val
|
|
360
|
+
val rotationDegrees = getRotationDegrees()
|
|
361
361
|
val matrix = Matrix()
|
|
362
362
|
val viewRect = RectF(0f, 0f, viewWidth.toFloat(), viewHeight.toFloat())
|
|
363
|
-
val bufferRect = if (
|
|
363
|
+
val bufferRect = if (rotationDegrees == 90 || rotationDegrees == 270) {
|
|
364
364
|
RectF(0f, 0f, previewSize.height.toFloat(), previewSize.width.toFloat())
|
|
365
365
|
} else {
|
|
366
366
|
RectF(0f, 0f, previewSize.width.toFloat(), previewSize.height.toFloat())
|
|
@@ -369,19 +369,13 @@ class CameraController(
|
|
|
369
369
|
val centerY = viewRect.centerY()
|
|
370
370
|
|
|
371
371
|
bufferRect.offset(centerX - bufferRect.centerX(), centerY - bufferRect.centerY())
|
|
372
|
-
|
|
372
|
+
// Fill the view while preserving aspect ratio (center-crop).
|
|
373
|
+
matrix.setRectToRect(bufferRect, viewRect, Matrix.ScaleToFit.FILL)
|
|
373
374
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
}
|
|
379
|
-
matrix.postScale(scale, scale, centerX, centerY)
|
|
380
|
-
|
|
381
|
-
when (rotation) {
|
|
382
|
-
Surface.ROTATION_90 -> matrix.postRotate(90f, centerX, centerY)
|
|
383
|
-
Surface.ROTATION_180 -> matrix.postRotate(180f, centerX, centerY)
|
|
384
|
-
Surface.ROTATION_270 -> matrix.postRotate(270f, centerX, centerY)
|
|
375
|
+
when (rotationDegrees) {
|
|
376
|
+
90 -> matrix.postRotate(90f, centerX, centerY)
|
|
377
|
+
180 -> matrix.postRotate(180f, centerX, centerY)
|
|
378
|
+
270 -> matrix.postRotate(270f, centerX, centerY)
|
|
385
379
|
}
|
|
386
380
|
|
|
387
381
|
previewView.setTransform(matrix)
|
package/package.json
CHANGED