react-native-rectangle-doc-scanner 7.29.0 → 7.31.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.
@@ -568,15 +568,16 @@ class CameraController(
568
568
  val isSwapped = rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270
569
569
  val bufferWidth = if (isSwapped) preview.height.toFloat() else preview.width.toFloat()
570
570
  val bufferHeight = if (isSwapped) preview.width.toFloat() else preview.height.toFloat()
571
- val viewRect = RectF(0f, 0f, viewWidth, viewHeight)
572
- val bufferRect = RectF(0f, 0f, bufferWidth, bufferHeight)
573
- val centerX = viewRect.centerX()
574
- val centerY = viewRect.centerY()
575
-
576
- // Uniform scale to avoid stretching; then center-crop to fill the view.
577
- matrix.setRectToRect(bufferRect, viewRect, Matrix.ScaleToFit.CENTER)
571
+ val centerX = viewWidth / 2f
572
+ val centerY = viewHeight / 2f
578
573
  val scale = max(viewWidth / bufferWidth, viewHeight / bufferHeight)
579
- matrix.postScale(scale, scale, centerX, centerY)
574
+ val scaledWidth = bufferWidth * scale
575
+ val scaledHeight = bufferHeight * scale
576
+ val dx = (viewWidth - scaledWidth) / 2f
577
+ val dy = (viewHeight - scaledHeight) / 2f
578
+
579
+ matrix.setScale(scale, scale)
580
+ matrix.postTranslate(dx, dy)
580
581
 
581
582
  if (rotation != Surface.ROTATION_0) {
582
583
  val rotateDegrees = when (rotation) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "7.29.0",
3
+ "version": "7.31.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",