react-native-rectangle-doc-scanner 7.64.0 → 7.65.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.
@@ -669,8 +669,9 @@ class CameraController(
669
669
  val centerX = viewRect.centerX()
670
670
  val centerY = viewRect.centerY()
671
671
 
672
- val appliedRotation = rotationDegrees
673
- val swap = appliedRotation == 90 || appliedRotation == 270
672
+ // Portrait-only mode: swap buffer dimensions based on sensor orientation
673
+ // sensorOrientation=90 means camera is rotated 90° from device natural orientation
674
+ val swap = sensorOrientation == 90 || sensorOrientation == 270
674
675
  val bufferWidth = if (swap) preview.height.toFloat() else preview.width.toFloat()
675
676
  val bufferHeight = if (swap) preview.width.toFloat() else preview.height.toFloat()
676
677
  val bufferRect = RectF(0f, 0f, bufferWidth, bufferHeight)
@@ -680,9 +681,7 @@ class CameraController(
680
681
  matrix.setRectToRect(viewRect, bufferRect, Matrix.ScaleToFit.FILL)
681
682
  val scale = max(viewWidth / bufferRect.width(), viewHeight / bufferRect.height())
682
683
  matrix.postScale(scale, scale, centerX, centerY)
683
- if (appliedRotation != 0) {
684
- matrix.postRotate(appliedRotation.toFloat(), centerX, centerY)
685
- }
684
+ // Portrait-only: no additional rotation needed, sensor orientation is already handled by buffer swap
686
685
 
687
686
  val pts = floatArrayOf(
688
687
  0f, 0f,
@@ -694,26 +693,20 @@ class CameraController(
694
693
 
695
694
  Log.d(
696
695
  TAG,
697
- "[TRANSFORM] rotations sensor=$sensorOrientation display=$displayRotation computed=$rotationDegrees applied=$appliedRotation " +
698
- "view=${viewWidth}x${viewHeight} preview=${preview.width}x${preview.height}"
696
+ "[TRANSFORM] sensor=$sensorOrientation display=$displayRotation swap=$swap " +
697
+ "view=${viewWidth}x${viewHeight} preview=${preview.width}x${preview.height} buffer=${bufferWidth}x${bufferHeight}"
699
698
  )
700
699
 
701
700
  previewView.setTransform(matrix)
702
701
  latestTransform = Matrix(matrix)
703
702
  latestBufferWidth = preview.width
704
703
  latestBufferHeight = preview.height
705
- latestTransformRotation = appliedRotation
704
+ latestTransformRotation = 0 // Portrait-only mode, no rotation applied
706
705
 
707
706
  Log.d(
708
707
  TAG,
709
- "[TRANSFORM] viewClass=${previewView.javaClass.name} isTextureView=${previewView is TextureView} " +
710
- "buffer=${bufferWidth}x${bufferHeight} scale=$scale center=${centerX}x${centerY} matrix=$matrix " +
711
- "pts=[${pts[0]},${pts[1]} ${pts[2]},${pts[3]} ${pts[4]},${pts[5]} ${pts[6]},${pts[7]}]"
708
+ "[TRANSFORM] scale=$scale matrix=$matrix"
712
709
  )
713
- val recomputed = computeRotationDegrees()
714
- if (rotationDegrees != recomputed) {
715
- Log.e(TAG, "[TRANSFORM] rotation mismatch computed=$rotationDegrees recomputed=$recomputed")
716
- }
717
710
  Log.d(TAG, "[TRANSFORM] Matrix applied successfully")
718
711
  }
719
712
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "7.64.0",
3
+ "version": "7.65.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",