react-native-rectangle-doc-scanner 7.17.0 → 7.18.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.
@@ -565,14 +565,11 @@ class CameraController(
565
565
  val isSwapped = rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270
566
566
  val bufferWidth = if (isSwapped) preview.height.toFloat() else preview.width.toFloat()
567
567
  val bufferHeight = if (isSwapped) preview.width.toFloat() else preview.height.toFloat()
568
- val scale = max(viewWidth / bufferWidth, viewHeight / bufferHeight)
569
- val scaledWidth = bufferWidth * scale
570
- val scaledHeight = bufferHeight * scale
571
- val dx = (viewWidth - scaledWidth) / 2f
572
- val dy = (viewHeight - scaledHeight) / 2f
573
-
574
- matrix.setScale(scale, scale)
575
- matrix.postTranslate(dx, dy)
568
+ val viewRect = RectF(0f, 0f, viewWidth, viewHeight)
569
+ val bufferRect = RectF(0f, 0f, bufferWidth, bufferHeight)
570
+
571
+ // Scale to fill while preserving aspect ratio; avoid double-scaling.
572
+ matrix.setRectToRect(bufferRect, viewRect, Matrix.ScaleToFit.FILL)
576
573
 
577
574
  if (rotation != Surface.ROTATION_0) {
578
575
  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.17.0",
3
+ "version": "7.18.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",