react-native-rectangle-doc-scanner 4.14.0 → 4.16.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.
@@ -510,6 +510,20 @@ class CameraController(
510
510
 
511
511
  private fun computeRotationDegrees(): Int {
512
512
  val displayRotation = displayRotationDegrees()
513
+ if (sensorOrientation == 0) {
514
+ return if (useFrontCamera) {
515
+ (360 - displayRotation) % 360
516
+ } else {
517
+ displayRotation
518
+ }
519
+ }
520
+ if (sensorOrientation == 180) {
521
+ return if (useFrontCamera) {
522
+ (180 + displayRotation) % 360
523
+ } else {
524
+ (180 - displayRotation + 360) % 360
525
+ }
526
+ }
513
527
  return if (useFrontCamera) {
514
528
  (sensorOrientation + displayRotation) % 360
515
529
  } else {
@@ -548,18 +562,12 @@ class CameraController(
548
562
  }
549
563
  previewView.setTransform(matrix)
550
564
 
551
- // Center-crop to fill the view.
552
- val viewAspect = viewWidth / viewHeight
553
- val bufferAspect = bufferWidth / bufferHeight
565
+ // Uniform center-crop to fill the view.
566
+ val scale = max(viewWidth / bufferWidth, viewHeight / bufferHeight)
554
567
  previewView.pivotX = centerX
555
568
  previewView.pivotY = centerY
556
- if (bufferAspect > viewAspect) {
557
- previewView.scaleX = bufferAspect / viewAspect
558
- previewView.scaleY = 1f
559
- } else {
560
- previewView.scaleX = 1f
561
- previewView.scaleY = viewAspect / bufferAspect
562
- }
569
+ previewView.scaleX = scale
570
+ previewView.scaleY = scale
563
571
  }
564
572
 
565
573
  private fun chooseBestSize(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "4.14.0",
3
+ "version": "4.16.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",