react-native-rectangle-doc-scanner 7.19.0 → 7.20.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.
@@ -554,14 +554,13 @@ class CameraController(
554
554
  val viewHeight = previewView.height.toFloat()
555
555
  val preview = previewSize ?: return
556
556
  if (viewWidth == 0f || viewHeight == 0f) return
557
- val rotation = previewView.display?.rotation ?: Surface.ROTATION_0
558
- val rotationDegrees = displayRotationDegrees()
557
+ val rotationDegrees = computeRotationDegrees()
559
558
  Log.d(TAG, "[TRANSFORM] rotation=$rotationDegrees view=${viewWidth}x${viewHeight} preview=${preview.width}x${preview.height}")
560
559
 
561
560
  val matrix = Matrix()
562
561
  val centerX = viewWidth / 2f
563
562
  val centerY = viewHeight / 2f
564
- val isSwapped = rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270
563
+ val isSwapped = rotationDegrees == 90 || rotationDegrees == 270
565
564
  val bufferWidth = if (isSwapped) preview.height.toFloat() else preview.width.toFloat()
566
565
  val bufferHeight = if (isSwapped) preview.width.toFloat() else preview.height.toFloat()
567
566
  val scale = max(viewWidth / bufferWidth, viewHeight / bufferHeight)
@@ -572,14 +571,8 @@ class CameraController(
572
571
  matrix.setScale(scale, scale)
573
572
  matrix.postTranslate(dx, dy)
574
573
 
575
- if (rotation != Surface.ROTATION_0) {
576
- val rotateDegrees = when (rotation) {
577
- Surface.ROTATION_90 -> -90f
578
- Surface.ROTATION_180 -> 180f
579
- Surface.ROTATION_270 -> 90f
580
- else -> 0f
581
- }
582
- matrix.postRotate(rotateDegrees, centerX, centerY)
574
+ if (rotationDegrees != 0) {
575
+ matrix.postRotate(rotationDegrees.toFloat(), centerX, centerY)
583
576
  }
584
577
 
585
578
  previewView.setTransform(matrix)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "7.19.0",
3
+ "version": "7.20.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",