@capgo/camera-preview 7.16.3 → 7.16.4
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.
|
@@ -393,7 +393,6 @@ extension CameraController {
|
|
|
393
393
|
fileVideoOutput.connections.forEach { $0.videoOrientation = videoOrientation }
|
|
394
394
|
}
|
|
395
395
|
|
|
396
|
-
|
|
397
396
|
// Set up preview layer session in the same configuration block
|
|
398
397
|
if let layer = self.previewLayer {
|
|
399
398
|
layer.session = captureSession
|
|
@@ -716,7 +715,6 @@ extension CameraController {
|
|
|
716
715
|
gridOverlayView = nil
|
|
717
716
|
}
|
|
718
717
|
|
|
719
|
-
|
|
720
718
|
func updateVideoOrientation() {
|
|
721
719
|
// Get orientation in a thread-safe way
|
|
722
720
|
let videoOrientation = self.getVideoOrientation()
|
|
@@ -771,14 +769,14 @@ extension CameraController {
|
|
|
771
769
|
if device.supportsSessionPreset(.hd4K3840x2160) { return .hd4K3840x2160 }
|
|
772
770
|
if device.supportsSessionPreset(.hd1920x1080) { return .hd1920x1080 }
|
|
773
771
|
if device.supportsSessionPreset(.hd1280x720) { return .hd1280x720 }
|
|
774
|
-
if device.supportsSessionPreset(.high)
|
|
775
|
-
if device.supportsSessionPreset(.photo)
|
|
772
|
+
if device.supportsSessionPreset(.high) { return .high }
|
|
773
|
+
if device.supportsSessionPreset(.photo) { return .photo } // safe, though 4:3
|
|
776
774
|
return .vga640x480
|
|
777
775
|
} else {
|
|
778
776
|
// 4:3 or unknown: prefer photo → high → 1080p → 720p → vga
|
|
779
|
-
if device.supportsSessionPreset(.photo)
|
|
780
|
-
if device.supportsSessionPreset(.high)
|
|
781
|
-
if device.supportsSessionPreset(.hd1920x1080){ return .hd1920x1080 }
|
|
777
|
+
if device.supportsSessionPreset(.photo) { return .photo }
|
|
778
|
+
if device.supportsSessionPreset(.high) { return .high }
|
|
779
|
+
if device.supportsSessionPreset(.hd1920x1080) { return .hd1920x1080 }
|
|
782
780
|
if device.supportsSessionPreset(.hd1280x720) { return .hd1280x720 }
|
|
783
781
|
return .vga640x480
|
|
784
782
|
}
|
|
@@ -1097,7 +1095,7 @@ extension CameraController {
|
|
|
1097
1095
|
|
|
1098
1096
|
// Validate crop rect is within image bounds
|
|
1099
1097
|
if cropRect.minX < 0 || cropRect.minY < 0 ||
|
|
1100
|
-
|
|
1098
|
+
cropRect.maxX > imageSize.width || cropRect.maxY > imageSize.height {
|
|
1101
1099
|
print("[CameraPreview] cropImageToAspectRatio - Warning: Crop rect \(cropRect) exceeds image bounds \(imageSize)")
|
|
1102
1100
|
// Adjust crop rect to fit within image bounds
|
|
1103
1101
|
cropRect = cropRect.intersection(CGRect(origin: .zero, size: imageSize))
|