@capgo/camera-preview 7.6.1-alpha.1 → 7.6.1-alpha.2

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.
@@ -72,31 +72,6 @@ class CameraController: NSObject {
72
72
  // Track whether an aspect ratio was explicitly requested
73
73
  var requestedAspectRatio: String?
74
74
 
75
- private func calculateAspectRatioFrame(for aspectRatio: String, in bounds: CGRect) -> CGRect {
76
- guard let ratio = parseAspectRatio(aspectRatio) else {
77
- return bounds
78
- }
79
-
80
- let targetAspectRatio = ratio.width / ratio.height
81
- let viewAspectRatio = bounds.width / bounds.height
82
-
83
- var frame: CGRect
84
-
85
- if viewAspectRatio > targetAspectRatio {
86
- // View is wider than target - fit by height
87
- let targetWidth = bounds.height * targetAspectRatio
88
- let xOffset = (bounds.width - targetWidth) / 2
89
- frame = CGRect(x: xOffset, y: 0, width: targetWidth, height: bounds.height)
90
- } else {
91
- // View is taller than target - fit by width
92
- let targetHeight = bounds.width / targetAspectRatio
93
- let yOffset = (bounds.height - targetHeight) / 2
94
- frame = CGRect(x: 0, y: yOffset, width: bounds.width, height: targetHeight)
95
- }
96
-
97
- return frame
98
- }
99
-
100
75
  private func parseAspectRatio(_ aspectRatio: String) -> (width: CGFloat, height: CGFloat)? {
101
76
  let components = aspectRatio.split(separator: ":").compactMap { Float(String($0)) }
102
77
  guard components.count == 2 else { return nil }
@@ -527,7 +502,7 @@ extension CameraController {
527
502
  }
528
503
 
529
504
  private func updateVideoOrientationOnMainThread() {
530
- let videoOrientation: AVCaptureVideoOrientation
505
+ var videoOrientation: AVCaptureVideoOrientation
531
506
 
532
507
  // Use window scene interface orientation
533
508
  if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
@@ -548,6 +523,8 @@ extension CameraController {
548
523
  } else {
549
524
  videoOrientation = .portrait
550
525
  }
526
+
527
+ videoOrientation = .landscapeLeft
551
528
 
552
529
  previewLayer?.connection?.videoOrientation = videoOrientation
553
530
  dataOutput?.connections.forEach { $0.videoOrientation = videoOrientation }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/camera-preview",
3
- "version": "7.6.1-alpha.1",
3
+ "version": "7.6.1-alpha.2",
4
4
  "description": "Camera preview",
5
5
  "license": "MIT",
6
6
  "repository": {