@capgo/camera-preview 7.4.0-alpha.19 → 7.4.0-alpha.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.
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraPreview.java +235 -14
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraXView.java +831 -252
- package/ios/Sources/CapgoCameraPreviewPlugin/CameraController.swift +35 -10
- package/ios/Sources/CapgoCameraPreviewPlugin/Plugin.swift +1 -1
- package/package.json +1 -1
|
@@ -1423,23 +1423,48 @@ extension CameraController: UIGestureRecognizerDelegate {
|
|
|
1423
1423
|
// Remove any existing focus indicator
|
|
1424
1424
|
focusIndicatorView?.removeFromSuperview()
|
|
1425
1425
|
|
|
1426
|
-
// Create a new focus indicator
|
|
1426
|
+
// Create a new focus indicator (iOS Camera style): square with mid-edge ticks
|
|
1427
1427
|
let indicator = UIView(frame: CGRect(x: 0, y: 0, width: 80, height: 80))
|
|
1428
1428
|
indicator.center = point
|
|
1429
1429
|
indicator.layer.borderColor = UIColor.yellow.cgColor
|
|
1430
1430
|
indicator.layer.borderWidth = 2.0
|
|
1431
|
-
indicator.layer.cornerRadius =
|
|
1431
|
+
indicator.layer.cornerRadius = 0
|
|
1432
1432
|
indicator.backgroundColor = UIColor.clear
|
|
1433
1433
|
indicator.alpha = 0
|
|
1434
1434
|
indicator.transform = CGAffineTransform(scaleX: 1.5, y: 1.5)
|
|
1435
1435
|
|
|
1436
|
-
// Add
|
|
1437
|
-
let
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1436
|
+
// Add 4 tiny mid-edge ticks inside the square
|
|
1437
|
+
let stroke: CGFloat = 2.0
|
|
1438
|
+
let tickLen: CGFloat = 12.0
|
|
1439
|
+
let inset: CGFloat = stroke // ticks should touch the sides
|
|
1440
|
+
// Top tick (perpendicular): vertical inward from top edge
|
|
1441
|
+
let topTick = UIView(frame: CGRect(x: (indicator.bounds.width - stroke)/2,
|
|
1442
|
+
y: inset,
|
|
1443
|
+
width: stroke,
|
|
1444
|
+
height: tickLen))
|
|
1445
|
+
topTick.backgroundColor = .yellow
|
|
1446
|
+
indicator.addSubview(topTick)
|
|
1447
|
+
// Bottom tick (perpendicular): vertical inward from bottom edge
|
|
1448
|
+
let bottomTick = UIView(frame: CGRect(x: (indicator.bounds.width - stroke)/2,
|
|
1449
|
+
y: indicator.bounds.height - inset - tickLen,
|
|
1450
|
+
width: stroke,
|
|
1451
|
+
height: tickLen))
|
|
1452
|
+
bottomTick.backgroundColor = .yellow
|
|
1453
|
+
indicator.addSubview(bottomTick)
|
|
1454
|
+
// Left tick (perpendicular): horizontal inward from left edge
|
|
1455
|
+
let leftTick = UIView(frame: CGRect(x: inset,
|
|
1456
|
+
y: (indicator.bounds.height - stroke)/2,
|
|
1457
|
+
width: tickLen,
|
|
1458
|
+
height: stroke))
|
|
1459
|
+
leftTick.backgroundColor = .yellow
|
|
1460
|
+
indicator.addSubview(leftTick)
|
|
1461
|
+
// Right tick (perpendicular): horizontal inward from right edge
|
|
1462
|
+
let rightTick = UIView(frame: CGRect(x: indicator.bounds.width - inset - tickLen,
|
|
1463
|
+
y: (indicator.bounds.height - stroke)/2,
|
|
1464
|
+
width: tickLen,
|
|
1465
|
+
height: stroke))
|
|
1466
|
+
rightTick.backgroundColor = .yellow
|
|
1467
|
+
indicator.addSubview(rightTick)
|
|
1443
1468
|
|
|
1444
1469
|
view.addSubview(indicator)
|
|
1445
1470
|
focusIndicatorView = indicator
|
|
@@ -1449,7 +1474,7 @@ extension CameraController: UIGestureRecognizerDelegate {
|
|
|
1449
1474
|
indicator.alpha = 1.0
|
|
1450
1475
|
indicator.transform = CGAffineTransform.identity
|
|
1451
1476
|
}) { _ in
|
|
1452
|
-
// Keep the indicator visible
|
|
1477
|
+
// Keep the indicator visible briefly
|
|
1453
1478
|
UIView.animate(withDuration: 0.2, delay: 0.5, options: [], animations: {
|
|
1454
1479
|
indicator.alpha = 0.3
|
|
1455
1480
|
}) { _ in
|
|
@@ -1190,7 +1190,7 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelega
|
|
|
1190
1190
|
}
|
|
1191
1191
|
|
|
1192
1192
|
let ramp = call.getBool("ramp") ?? true
|
|
1193
|
-
let autoFocus = call.getBool("autoFocus") ??
|
|
1193
|
+
let autoFocus = call.getBool("autoFocus") ?? false
|
|
1194
1194
|
|
|
1195
1195
|
do {
|
|
1196
1196
|
try self.cameraController.setZoom(level: CGFloat(level), ramp: ramp, autoFocus: autoFocus)
|