@capgo/camera-preview 7.4.0-beta.21 → 7.4.0-beta.22

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.
@@ -436,7 +436,7 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelega
436
436
  self.disableAudio = call.getBool("disableAudio") ?? true
437
437
  self.aspectRatio = call.getString("aspectRatio")
438
438
  self.gridMode = call.getString("gridMode") ?? "none"
439
- self.positioning = call.getString("positioning") ?? "center"
439
+ self.positioning = call.getString("positioning") ?? "top"
440
440
  let initialZoomLevel = call.getFloat("initialZoomLevel") ?? 1.0
441
441
  if self.aspectRatio != nil && (call.getInt("width") != nil || call.getInt("height") != nil) {
442
442
  call.reject("Cannot set both aspectRatio and size (width/height). Use setPreviewSize after start.")
@@ -473,7 +473,7 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelega
473
473
  private func completeStartCamera(call: CAPPluginCall) {
474
474
  // Create and configure the preview view first
475
475
  self.updateCameraFrame()
476
-
476
+
477
477
  print("[CameraPreview] completeStartCamera - Preview frame after updateCameraFrame: \(self.previewView.frame)")
478
478
 
479
479
  // Make webview transparent - comprehensive approach
@@ -509,7 +509,7 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelega
509
509
  // Set up callback to wait for first frame before resolving
510
510
  self.cameraController.firstFrameReadyCallback = { [weak self] in
511
511
  guard let self = self else { return }
512
-
512
+
513
513
  DispatchQueue.main.async {
514
514
  var returnedObject = JSObject()
515
515
  returnedObject["width"] = self.previewView.frame.width as any JSValue
@@ -519,7 +519,7 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelega
519
519
  call.resolve(returnedObject)
520
520
  }
521
521
  }
522
-
522
+
523
523
  // If already received first frame (unlikely but possible), resolve immediately
524
524
  if self.cameraController.hasReceivedFirstFrame {
525
525
  var returnedObject = JSObject()
@@ -687,7 +687,7 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelega
687
687
  let width = call.getInt("width")
688
688
  let height = call.getInt("height")
689
689
  let aspectRatio = call.getString("aspectRatio")
690
-
690
+
691
691
  print("[CameraPreview] Raw parameter values - width: \(String(describing: width)), height: \(String(describing: height)), aspectRatio: \(String(describing: aspectRatio))")
692
692
 
693
693
  // Check for conflicting parameters
@@ -701,11 +701,11 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelega
701
701
  // Don't pass aspectRatio in this case - let the capture method handle preview matching
702
702
  print("[CameraPreview] Capture decision - width: \(width == nil), height: \(height == nil), aspectRatio param: \(aspectRatio == nil)")
703
703
  print("[CameraPreview] Stored aspectRatio: \(self.aspectRatio ?? "nil")")
704
-
704
+
705
705
  // Only pass aspectRatio if explicitly provided in the capture call
706
706
  // Never use the stored aspectRatio when capturing without dimensions
707
707
  let captureAspectRatio: String? = aspectRatio
708
-
708
+
709
709
  print("[CameraPreview] Capture params - quality: \(quality), saveToGallery: \(saveToGallery), withExifLocation: \(withExifLocation), width: \(width ?? -1), height: \(height ?? -1), aspectRatio: \(aspectRatio ?? "nil"), using aspectRatio: \(captureAspectRatio ?? "nil")")
710
710
  print("[CameraPreview] Current location: \(self.currentLocation?.description ?? "nil")")
711
711
  print("[CameraPreview] Preview dimensions: \(self.previewView.frame.width)x\(self.previewView.frame.height)")
@@ -1354,9 +1354,9 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelega
1354
1354
  // Handle auto-centering when position is -1
1355
1355
  if currentX == -1 || currentY == -1 {
1356
1356
  // Only override dimensions if aspect ratio is provided and no explicit dimensions given
1357
- if let ratio = currentAspectRatio,
1358
- currentWidth == UIScreen.main.bounds.size.width &&
1359
- currentHeight == UIScreen.main.bounds.size.height {
1357
+ if let ratio = currentAspectRatio,
1358
+ currentWidth == UIScreen.main.bounds.size.width &&
1359
+ currentHeight == UIScreen.main.bounds.size.height {
1360
1360
  finalWidth = webViewWidth
1361
1361
 
1362
1362
  // Calculate height based on aspect ratio
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/camera-preview",
3
- "version": "7.4.0-beta.21",
3
+ "version": "7.4.0-beta.22",
4
4
  "description": "Camera preview",
5
5
  "license": "MIT",
6
6
  "repository": {