react-native-rectangle-doc-scanner 7.61.0 → 7.62.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.
@@ -661,10 +661,10 @@ class CameraController(
661
661
  if (viewWidth == 0f || viewHeight == 0f) return
662
662
 
663
663
  val rotationDegrees = computeRotationDegrees()
664
- val transformRotation = rotationDegrees
664
+ val displayRotation = displayRotationDegrees()
665
665
  Log.d(
666
666
  TAG,
667
- "[TRANSFORM] rotation=$transformRotation view=${viewWidth}x${viewHeight} preview=${preview.width}x${preview.height}"
667
+ "[TRANSFORM] rotations sensor=$sensorOrientation display=$displayRotation computed=$rotationDegrees view=${viewWidth}x${viewHeight} preview=${preview.width}x${preview.height}"
668
668
  )
669
669
 
670
670
  val matrix = Matrix()
@@ -672,24 +672,24 @@ class CameraController(
672
672
  val centerX = viewRect.centerX()
673
673
  val centerY = viewRect.centerY()
674
674
 
675
- val isSwapped = transformRotation == 90 || transformRotation == 270
675
+ val isSwapped = rotationDegrees == 90 || rotationDegrees == 270
676
676
  val bufferWidth = if (isSwapped) preview.height.toFloat() else preview.width.toFloat()
677
677
  val bufferHeight = if (isSwapped) preview.width.toFloat() else preview.height.toFloat()
678
678
  val bufferRect = RectF(0f, 0f, bufferWidth, bufferHeight)
679
679
  bufferRect.offset(centerX - bufferRect.centerX(), centerY - bufferRect.centerY())
680
680
 
681
- matrix.setRectToRect(bufferRect, viewRect, Matrix.ScaleToFit.FILL)
682
- val scale = max(viewWidth / bufferWidth, viewHeight / bufferHeight)
681
+ matrix.setRectToRect(viewRect, bufferRect, Matrix.ScaleToFit.FILL)
682
+ val scale = max(viewWidth / bufferRect.width(), viewHeight / bufferRect.height())
683
683
  matrix.postScale(scale, scale, centerX, centerY)
684
- if (transformRotation != 0) {
685
- matrix.postRotate(transformRotation.toFloat(), centerX, centerY)
684
+ if (rotationDegrees != 0) {
685
+ matrix.postRotate(rotationDegrees.toFloat(), centerX, centerY)
686
686
  }
687
687
 
688
688
  previewView.setTransform(matrix)
689
689
  latestTransform = Matrix(matrix)
690
690
  latestBufferWidth = preview.width
691
691
  latestBufferHeight = preview.height
692
- latestTransformRotation = transformRotation
692
+ latestTransformRotation = rotationDegrees
693
693
 
694
694
  val pts = floatArrayOf(
695
695
  0f, 0f,
@@ -704,6 +704,10 @@ class CameraController(
704
704
  "buffer=${bufferWidth}x${bufferHeight} scale=$scale center=${centerX}x${centerY} matrix=$matrix " +
705
705
  "pts=[${pts[0]},${pts[1]} ${pts[2]},${pts[3]} ${pts[4]},${pts[5]} ${pts[6]},${pts[7]}]"
706
706
  )
707
+ val recomputed = computeRotationDegrees()
708
+ if (rotationDegrees != recomputed) {
709
+ Log.e(TAG, "[TRANSFORM] rotation mismatch computed=$rotationDegrees recomputed=$recomputed")
710
+ }
707
711
  Log.d(TAG, "[TRANSFORM] Matrix applied successfully")
708
712
  }
709
713
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "7.61.0",
3
+ "version": "7.62.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",