react-native-rectangle-doc-scanner 7.34.0 → 7.35.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.
@@ -559,7 +559,7 @@ class CameraController(
559
559
  val viewHeight = previewView.height.toFloat()
560
560
  val preview = previewSize ?: return
561
561
  if (viewWidth == 0f || viewHeight == 0f) return
562
- val rotation = previewView.display?.rotation ?: Surface.ROTATION_0
562
+ val rotationDegrees = computeRotationDegrees()
563
563
  Log.d(
564
564
  TAG,
565
565
  "[TRANSFORM] rotation=${displayRotationDegrees()} view=${viewWidth}x${viewHeight} preview=${preview.width}x${preview.height}"
@@ -568,20 +568,15 @@ class CameraController(
568
568
  val matrix = Matrix()
569
569
  val bufferWidth = preview.width.toFloat()
570
570
  val bufferHeight = preview.height.toFloat()
571
- val rotateDegrees = when (rotation) {
572
- Surface.ROTATION_90 -> -90f
573
- Surface.ROTATION_180 -> 180f
574
- Surface.ROTATION_270 -> 90f
575
- else -> 0f
576
- }
571
+ val rotateDegrees = -rotationDegrees.toFloat()
577
572
 
578
573
  // Move buffer center to origin, rotate, scale uniformly to fill view, then move to view center.
579
574
  matrix.postTranslate(-bufferWidth / 2f, -bufferHeight / 2f)
580
575
  if (rotateDegrees != 0f) {
581
576
  matrix.postRotate(rotateDegrees)
582
577
  }
583
- val rotatedWidth = if (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) bufferHeight else bufferWidth
584
- val rotatedHeight = if (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) bufferWidth else bufferHeight
578
+ val rotatedWidth = if (rotationDegrees == 90 || rotationDegrees == 270) bufferHeight else bufferWidth
579
+ val rotatedHeight = if (rotationDegrees == 90 || rotationDegrees == 270) bufferWidth else bufferHeight
585
580
  val scale = max(viewWidth / rotatedWidth, viewHeight / rotatedHeight)
586
581
  matrix.postScale(scale, scale)
587
582
  matrix.postTranslate(viewWidth / 2f, viewHeight / 2f)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "7.34.0",
3
+ "version": "7.35.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",