react-native-rectangle-doc-scanner 7.43.0 → 7.44.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.
|
@@ -584,14 +584,20 @@ class CameraController(
|
|
|
584
584
|
val swappedWidth = preview.height.toFloat()
|
|
585
585
|
val swappedHeight = preview.width.toFloat()
|
|
586
586
|
|
|
587
|
-
//
|
|
587
|
+
// Android: Use 85% of view height to add 15% padding (7.5% top + 7.5% bottom)
|
|
588
|
+
val effectiveViewHeight = viewHeight * 0.85f
|
|
589
|
+
val verticalPadding = (viewHeight - effectiveViewHeight) / 2f
|
|
590
|
+
|
|
591
|
+
// Calculate scale to fit within the effective area while maintaining aspect ratio
|
|
588
592
|
val scaleX = viewWidth / swappedWidth
|
|
589
|
-
val scaleY =
|
|
590
|
-
val scale =
|
|
593
|
+
val scaleY = effectiveViewHeight / swappedHeight
|
|
594
|
+
val scale = min(scaleX, scaleY)
|
|
591
595
|
|
|
592
596
|
// Apply transformations: first rotate, then scale
|
|
593
597
|
matrix.postRotate(90f * (rotation - 2), centerX, centerY)
|
|
594
598
|
matrix.postScale(scale, scale, centerX, centerY)
|
|
599
|
+
|
|
600
|
+
Log.d(TAG, "[TRANSFORM] Android tablet mode: effectiveHeight=$effectiveViewHeight, padding=$verticalPadding, scale=$scale")
|
|
595
601
|
} else if (rotation == Surface.ROTATION_180) {
|
|
596
602
|
matrix.postRotate(180f, centerX, centerY)
|
|
597
603
|
} else {
|