@capgo/camera-preview 7.3.12 → 7.4.0-beta.10
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/CapgoCameraPreview.podspec +16 -13
- package/README.md +467 -73
- package/android/.gradle/8.14.2/checksums/checksums.lock +0 -0
- package/android/.gradle/8.14.2/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/8.14.2/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.14.2/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/8.14.2/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/8.14.2/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.14.2/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/8.14.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.14.2/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/8.14.2/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/file-system.probe +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build.gradle +11 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/main/AndroidManifest.xml +5 -3
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraPreview.java +472 -541
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraXView.java +1648 -0
- package/android/src/main/java/com/ahm/capacitor/camera/preview/GridOverlayView.java +82 -0
- package/android/src/main/java/com/ahm/capacitor/camera/preview/model/CameraDevice.java +54 -0
- package/android/src/main/java/com/ahm/capacitor/camera/preview/model/CameraLens.java +70 -0
- package/android/src/main/java/com/ahm/capacitor/camera/preview/model/CameraSessionConfiguration.java +79 -0
- package/android/src/main/java/com/ahm/capacitor/camera/preview/model/LensInfo.java +34 -0
- package/android/src/main/java/com/ahm/capacitor/camera/preview/model/ZoomFactors.java +34 -0
- package/dist/docs.json +934 -154
- package/dist/esm/definitions.d.ts +445 -83
- package/dist/esm/definitions.js +10 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +73 -3
- package/dist/esm/web.js +492 -68
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +498 -68
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +498 -68
- package/dist/plugin.js.map +1 -1
- package/ios/{Plugin → Sources/CapgoCameraPreview}/CameraController.swift +601 -59
- package/ios/Sources/CapgoCameraPreview/GridOverlayView.swift +65 -0
- package/ios/Sources/CapgoCameraPreview/Plugin.swift +1369 -0
- package/ios/Tests/CameraPreviewPluginTests/CameraPreviewPluginTests.swift +15 -0
- package/package.json +1 -1
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraActivity.java +0 -1279
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CustomSurfaceView.java +0 -29
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CustomTextureView.java +0 -39
- package/android/src/main/java/com/ahm/capacitor/camera/preview/Preview.java +0 -461
- package/android/src/main/java/com/ahm/capacitor/camera/preview/TapGestureDetector.java +0 -24
- package/ios/Plugin/Info.plist +0 -24
- package/ios/Plugin/Plugin.h +0 -10
- package/ios/Plugin/Plugin.m +0 -18
- package/ios/Plugin/Plugin.swift +0 -511
- package/ios/Plugin.xcodeproj/project.pbxproj +0 -593
- package/ios/Plugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/Plugin.xcworkspace/contents.xcworkspacedata +0 -10
- package/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/PluginTests/Info.plist +0 -22
- package/ios/PluginTests/PluginTests.swift +0 -83
- package/ios/Podfile +0 -13
- package/ios/Podfile.lock +0 -23
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import UIKit
|
|
2
|
+
|
|
3
|
+
class GridOverlayView: UIView {
|
|
4
|
+
|
|
5
|
+
var gridMode: String = "none" {
|
|
6
|
+
didSet {
|
|
7
|
+
isHidden = gridMode == "none"
|
|
8
|
+
setNeedsDisplay()
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
override init(frame: CGRect) {
|
|
13
|
+
super.init(frame: frame)
|
|
14
|
+
setup()
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
required init?(coder: NSCoder) {
|
|
18
|
+
super.init(coder: coder)
|
|
19
|
+
setup()
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
private func setup() {
|
|
23
|
+
backgroundColor = UIColor.clear
|
|
24
|
+
isUserInteractionEnabled = false
|
|
25
|
+
isHidden = true
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
override func draw(_ rect: CGRect) {
|
|
29
|
+
guard let context = UIGraphicsGetCurrentContext() else { return }
|
|
30
|
+
|
|
31
|
+
if gridMode == "none" {
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
context.setStrokeColor(UIColor.white.withAlphaComponent(0.5).cgColor)
|
|
36
|
+
context.setLineWidth(1.0)
|
|
37
|
+
|
|
38
|
+
if gridMode == "3x3" {
|
|
39
|
+
drawGrid(context: context, rect: rect, divisions: 3)
|
|
40
|
+
} else if gridMode == "4x4" {
|
|
41
|
+
drawGrid(context: context, rect: rect, divisions: 4)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private func drawGrid(context: CGContext, rect: CGRect, divisions: Int) {
|
|
46
|
+
let stepX = rect.width / CGFloat(divisions)
|
|
47
|
+
let stepY = rect.height / CGFloat(divisions)
|
|
48
|
+
|
|
49
|
+
// Draw vertical lines
|
|
50
|
+
for i in 1..<divisions {
|
|
51
|
+
let x = CGFloat(i) * stepX
|
|
52
|
+
context.move(to: CGPoint(x: x, y: 0))
|
|
53
|
+
context.addLine(to: CGPoint(x: x, y: rect.height))
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Draw horizontal lines
|
|
57
|
+
for i in 1..<divisions {
|
|
58
|
+
let y = CGFloat(i) * stepY
|
|
59
|
+
context.move(to: CGPoint(x: 0, y: y))
|
|
60
|
+
context.addLine(to: CGPoint(x: rect.width, y: y))
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
context.strokePath()
|
|
64
|
+
}
|
|
65
|
+
}
|