@capgo/camera-preview 7.4.0-beta.2 → 7.4.0-beta.20

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.
Files changed (35) hide show
  1. package/README.md +212 -35
  2. package/android/.gradle/8.14.2/checksums/checksums.lock +0 -0
  3. package/android/.gradle/8.14.2/checksums/md5-checksums.bin +0 -0
  4. package/android/.gradle/8.14.2/checksums/sha1-checksums.bin +0 -0
  5. package/android/.gradle/8.14.2/executionHistory/executionHistory.bin +0 -0
  6. package/android/.gradle/8.14.2/executionHistory/executionHistory.lock +0 -0
  7. package/android/.gradle/8.14.2/fileHashes/fileHashes.bin +0 -0
  8. package/android/.gradle/8.14.2/fileHashes/fileHashes.lock +0 -0
  9. package/android/.gradle/8.14.2/fileHashes/resourceHashesCache.bin +0 -0
  10. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  11. package/android/.gradle/file-system.probe +0 -0
  12. package/android/build.gradle +3 -1
  13. package/android/src/main/AndroidManifest.xml +1 -4
  14. package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraPreview.java +731 -83
  15. package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraXView.java +2813 -805
  16. package/android/src/main/java/com/ahm/capacitor/camera/preview/GridOverlayView.java +112 -0
  17. package/android/src/main/java/com/ahm/capacitor/camera/preview/model/CameraDevice.java +55 -46
  18. package/android/src/main/java/com/ahm/capacitor/camera/preview/model/CameraLens.java +61 -52
  19. package/android/src/main/java/com/ahm/capacitor/camera/preview/model/CameraSessionConfiguration.java +161 -59
  20. package/android/src/main/java/com/ahm/capacitor/camera/preview/model/LensInfo.java +29 -23
  21. package/android/src/main/java/com/ahm/capacitor/camera/preview/model/ZoomFactors.java +24 -23
  22. package/dist/docs.json +292 -29
  23. package/dist/esm/definitions.d.ts +148 -13
  24. package/dist/esm/definitions.js.map +1 -1
  25. package/dist/esm/web.d.ts +52 -3
  26. package/dist/esm/web.js +555 -97
  27. package/dist/esm/web.js.map +1 -1
  28. package/dist/plugin.cjs.js +553 -97
  29. package/dist/plugin.cjs.js.map +1 -1
  30. package/dist/plugin.js +553 -97
  31. package/dist/plugin.js.map +1 -1
  32. package/ios/Sources/CapgoCameraPreview/CameraController.swift +888 -214
  33. package/ios/Sources/CapgoCameraPreview/GridOverlayView.swift +65 -0
  34. package/ios/Sources/CapgoCameraPreview/Plugin.swift +967 -250
  35. package/package.json +2 -2
@@ -4,31 +4,32 @@ package com.ahm.capacitor.camera.preview.model;
4
4
  * Represents zoom factor information for a camera with current lens details.
5
5
  */
6
6
  public class ZoomFactors {
7
- private final float min;
8
- private final float max;
9
- private final float current;
10
- private final LensInfo lens;
11
7
 
12
- public ZoomFactors(float min, float max, float current, LensInfo lens) {
13
- this.min = min;
14
- this.max = max;
15
- this.current = current;
16
- this.lens = lens;
17
- }
8
+ private final float min;
9
+ private final float max;
10
+ private final float current;
11
+ private final LensInfo lens;
18
12
 
19
- public float getMin() {
20
- return min;
21
- }
13
+ public ZoomFactors(float min, float max, float current, LensInfo lens) {
14
+ this.min = min;
15
+ this.max = max;
16
+ this.current = current;
17
+ this.lens = lens;
18
+ }
22
19
 
23
- public float getMax() {
24
- return max;
25
- }
20
+ public float getMin() {
21
+ return min;
22
+ }
26
23
 
27
- public float getCurrent() {
28
- return current;
29
- }
24
+ public float getMax() {
25
+ return max;
26
+ }
30
27
 
31
- public LensInfo getLens() {
32
- return lens;
33
- }
34
- }
28
+ public float getCurrent() {
29
+ return current;
30
+ }
31
+
32
+ public LensInfo getLens() {
33
+ return lens;
34
+ }
35
+ }
package/dist/docs.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "methods": [
8
8
  {
9
9
  "name": "start",
10
- "signature": "(options: CameraPreviewOptions) => Promise<void>",
10
+ "signature": "(options: CameraPreviewOptions) => Promise<{ width: number; height: number; x: number; y: number; }>",
11
11
  "parameters": [
12
12
  {
13
13
  "name": "options",
@@ -15,7 +15,7 @@
15
15
  "type": "CameraPreviewOptions"
16
16
  }
17
17
  ],
18
- "returns": "Promise<void>",
18
+ "returns": "Promise<{ width: number; height: number; x: number; y: number; }>",
19
19
  "tags": [
20
20
  {
21
21
  "name": "param",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  {
25
25
  "name": "returns",
26
- "text": "A promise that resolves when the camera preview is started."
26
+ "text": "A promise that resolves with the preview dimensions."
27
27
  },
28
28
  {
29
29
  "name": "since",
@@ -139,6 +139,106 @@
139
139
  ],
140
140
  "slug": "getsupportedflashmodes"
141
141
  },
142
+ {
143
+ "name": "setAspectRatio",
144
+ "signature": "(options: { aspectRatio: \"4:3\" | \"16:9\"; x?: number; y?: number; }) => Promise<{ width: number; height: number; x: number; y: number; }>",
145
+ "parameters": [
146
+ {
147
+ "name": "options",
148
+ "docs": "- The desired aspect ratio and optional position.\n- aspectRatio: The desired aspect ratio ('4:3' or '16:9')\n- x: Optional x coordinate for positioning. If not provided, view will be auto-centered horizontally.\n- y: Optional y coordinate for positioning. If not provided, view will be auto-centered vertically.",
149
+ "type": "{ aspectRatio: '4:3' | '16:9'; x?: number | undefined; y?: number | undefined; }"
150
+ }
151
+ ],
152
+ "returns": "Promise<{ width: number; height: number; x: number; y: number; }>",
153
+ "tags": [
154
+ {
155
+ "name": "param",
156
+ "text": "options - The desired aspect ratio and optional position.\n- aspectRatio: The desired aspect ratio ('4:3' or '16:9')\n- x: Optional x coordinate for positioning. If not provided, view will be auto-centered horizontally.\n- y: Optional y coordinate for positioning. If not provided, view will be auto-centered vertically."
157
+ },
158
+ {
159
+ "name": "returns",
160
+ "text": "A promise that resolves with the actual preview dimensions and position."
161
+ },
162
+ {
163
+ "name": "since",
164
+ "text": "7.4.0"
165
+ }
166
+ ],
167
+ "docs": "Set the aspect ratio of the camera preview.",
168
+ "complexTypes": [],
169
+ "slug": "setaspectratio"
170
+ },
171
+ {
172
+ "name": "getAspectRatio",
173
+ "signature": "() => Promise<{ aspectRatio: \"4:3\" | \"16:9\"; }>",
174
+ "parameters": [],
175
+ "returns": "Promise<{ aspectRatio: '4:3' | '16:9'; }>",
176
+ "tags": [
177
+ {
178
+ "name": "returns",
179
+ "text": "A promise that resolves with the current aspect ratio."
180
+ },
181
+ {
182
+ "name": "since",
183
+ "text": "7.4.0"
184
+ }
185
+ ],
186
+ "docs": "Gets the current aspect ratio of the camera preview.",
187
+ "complexTypes": [],
188
+ "slug": "getaspectratio"
189
+ },
190
+ {
191
+ "name": "setGridMode",
192
+ "signature": "(options: { gridMode: GridMode; }) => Promise<void>",
193
+ "parameters": [
194
+ {
195
+ "name": "options",
196
+ "docs": "- The desired grid mode ('none', '3x3', or '4x4').",
197
+ "type": "{ gridMode: GridMode; }"
198
+ }
199
+ ],
200
+ "returns": "Promise<void>",
201
+ "tags": [
202
+ {
203
+ "name": "param",
204
+ "text": "options - The desired grid mode ('none', '3x3', or '4x4')."
205
+ },
206
+ {
207
+ "name": "returns",
208
+ "text": "A promise that resolves when the grid mode is set."
209
+ },
210
+ {
211
+ "name": "since",
212
+ "text": "8.0.0"
213
+ }
214
+ ],
215
+ "docs": "Sets the grid mode of the camera preview overlay.",
216
+ "complexTypes": [
217
+ "GridMode"
218
+ ],
219
+ "slug": "setgridmode"
220
+ },
221
+ {
222
+ "name": "getGridMode",
223
+ "signature": "() => Promise<{ gridMode: GridMode; }>",
224
+ "parameters": [],
225
+ "returns": "Promise<{ gridMode: GridMode; }>",
226
+ "tags": [
227
+ {
228
+ "name": "returns",
229
+ "text": "A promise that resolves with the current grid mode."
230
+ },
231
+ {
232
+ "name": "since",
233
+ "text": "8.0.0"
234
+ }
235
+ ],
236
+ "docs": "Gets the current grid mode of the camera preview overlay.",
237
+ "complexTypes": [
238
+ "GridMode"
239
+ ],
240
+ "slug": "getgridmode"
241
+ },
142
242
  {
143
243
  "name": "getHorizontalFov",
144
244
  "signature": "() => Promise<{ result: number; }>",
@@ -373,19 +473,19 @@
373
473
  },
374
474
  {
375
475
  "name": "setZoom",
376
- "signature": "(options: { level: number; ramp?: boolean; }) => Promise<void>",
476
+ "signature": "(options: { level: number; ramp?: boolean; autoFocus?: boolean; }) => Promise<void>",
377
477
  "parameters": [
378
478
  {
379
479
  "name": "options",
380
- "docs": "- The desired zoom level. `ramp` is currently unused.",
381
- "type": "{ level: number; ramp?: boolean | undefined; }"
480
+ "docs": "- The desired zoom level. `ramp` is currently unused. `autoFocus` defaults to true.",
481
+ "type": "{ level: number; ramp?: boolean | undefined; autoFocus?: boolean | undefined; }"
382
482
  }
383
483
  ],
384
484
  "returns": "Promise<void>",
385
485
  "tags": [
386
486
  {
387
487
  "name": "param",
388
- "text": "options - The desired zoom level. `ramp` is currently unused."
488
+ "text": "options - The desired zoom level. `ramp` is currently unused. `autoFocus` defaults to true."
389
489
  },
390
490
  {
391
491
  "name": "returns",
@@ -396,7 +496,7 @@
396
496
  "text": "7.4.0"
397
497
  }
398
498
  ],
399
- "docs": "Sets the camera's zoom level.",
499
+ "docs": "Sets the zoom level of the camera.",
400
500
  "complexTypes": [],
401
501
  "slug": "setzoom"
402
502
  },
@@ -483,6 +583,74 @@
483
583
  "docs": "Gets the ID of the currently active camera device.",
484
584
  "complexTypes": [],
485
585
  "slug": "getdeviceid"
586
+ },
587
+ {
588
+ "name": "getPreviewSize",
589
+ "signature": "() => Promise<{ x: number; y: number; width: number; height: number; }>",
590
+ "parameters": [],
591
+ "returns": "Promise<{ x: number; y: number; width: number; height: number; }>",
592
+ "tags": [
593
+ {
594
+ "name": "returns"
595
+ }
596
+ ],
597
+ "docs": "Gets the current preview size and position.",
598
+ "complexTypes": [],
599
+ "slug": "getpreviewsize"
600
+ },
601
+ {
602
+ "name": "setPreviewSize",
603
+ "signature": "(options: { x?: number; y?: number; width: number; height: number; }) => Promise<{ width: number; height: number; x: number; y: number; }>",
604
+ "parameters": [
605
+ {
606
+ "name": "options",
607
+ "docs": "The new position and dimensions.",
608
+ "type": "{ x?: number | undefined; y?: number | undefined; width: number; height: number; }"
609
+ }
610
+ ],
611
+ "returns": "Promise<{ width: number; height: number; x: number; y: number; }>",
612
+ "tags": [
613
+ {
614
+ "name": "param",
615
+ "text": "options The new position and dimensions."
616
+ },
617
+ {
618
+ "name": "returns",
619
+ "text": "A promise that resolves with the actual preview dimensions and position."
620
+ }
621
+ ],
622
+ "docs": "Sets the preview size and position.",
623
+ "complexTypes": [],
624
+ "slug": "setpreviewsize"
625
+ },
626
+ {
627
+ "name": "setFocus",
628
+ "signature": "(options: { x: number; y: number; }) => Promise<void>",
629
+ "parameters": [
630
+ {
631
+ "name": "options",
632
+ "docs": "- The focus options.",
633
+ "type": "{ x: number; y: number; }"
634
+ }
635
+ ],
636
+ "returns": "Promise<void>",
637
+ "tags": [
638
+ {
639
+ "name": "param",
640
+ "text": "options - The focus options."
641
+ },
642
+ {
643
+ "name": "returns",
644
+ "text": "A promise that resolves when the focus is set."
645
+ },
646
+ {
647
+ "name": "since",
648
+ "text": "8.1.0"
649
+ }
650
+ ],
651
+ "docs": "Sets the camera focus to a specific point in the preview.",
652
+ "complexTypes": [],
653
+ "slug": "setfocus"
486
654
  }
487
655
  ],
488
656
  "properties": []
@@ -567,6 +735,36 @@
567
735
  "complexTypes": [],
568
736
  "type": "number | undefined"
569
737
  },
738
+ {
739
+ "name": "aspectRatio",
740
+ "tags": [
741
+ {
742
+ "text": "2.0.0",
743
+ "name": "since"
744
+ }
745
+ ],
746
+ "docs": "The aspect ratio of the camera preview, '4:3' or '16:9' or 'fill'.\nCannot be set if width or height is provided, otherwise the call will be rejected.\nUse setPreviewSize to adjust size after starting.",
747
+ "complexTypes": [],
748
+ "type": "'4:3' | '16:9' | undefined"
749
+ },
750
+ {
751
+ "name": "gridMode",
752
+ "tags": [
753
+ {
754
+ "text": "\"none\"",
755
+ "name": "default"
756
+ },
757
+ {
758
+ "text": "2.1.0",
759
+ "name": "since"
760
+ }
761
+ ],
762
+ "docs": "The grid overlay to display on the camera preview.",
763
+ "complexTypes": [
764
+ "GridMode"
765
+ ],
766
+ "type": "GridMode"
767
+ },
570
768
  {
571
769
  "name": "includeSafeAreaInsets",
572
770
  "tags": [
@@ -669,27 +867,11 @@
669
867
  "complexTypes": [],
670
868
  "type": "boolean | undefined"
671
869
  },
672
- {
673
- "name": "enableHighResolution",
674
- "tags": [
675
- {
676
- "text": "ios",
677
- "name": "platform"
678
- },
679
- {
680
- "text": "false",
681
- "name": "default"
682
- }
683
- ],
684
- "docs": "If true, enables high-resolution image capture.",
685
- "complexTypes": [],
686
- "type": "boolean | undefined"
687
- },
688
870
  {
689
871
  "name": "disableAudio",
690
872
  "tags": [
691
873
  {
692
- "text": "false",
874
+ "text": "true",
693
875
  "name": "default"
694
876
  }
695
877
  ],
@@ -772,6 +954,26 @@
772
954
  "docs": "The `deviceId` of the camera to use. If provided, `position` is ignored.",
773
955
  "complexTypes": [],
774
956
  "type": "string | undefined"
957
+ },
958
+ {
959
+ "name": "initialZoomLevel",
960
+ "tags": [
961
+ {
962
+ "text": "1.0",
963
+ "name": "default"
964
+ },
965
+ {
966
+ "text": "android, ios",
967
+ "name": "platform"
968
+ },
969
+ {
970
+ "text": "2.2.0",
971
+ "name": "since"
972
+ }
973
+ ],
974
+ "docs": "The initial zoom level when starting the camera preview.\nIf the requested zoom level is not available, the native plugin will reject.",
975
+ "complexTypes": [],
976
+ "type": "number | undefined"
775
977
  }
776
978
  ]
777
979
  },
@@ -792,18 +994,44 @@
792
994
  "properties": [
793
995
  {
794
996
  "name": "height",
795
- "tags": [],
796
- "docs": "The desired height of the picture in pixels. If not provided, the device default is used.",
997
+ "tags": [
998
+ {
999
+ "text": ",\nThe desired height of the picture in pixels. \nIf not specified and no aspectRatio is provided, the captured image will match the preview's visible area.",
1000
+ "name": "deprecated"
1001
+ }
1002
+ ],
1003
+ "docs": "",
797
1004
  "complexTypes": [],
798
1005
  "type": "number | undefined"
799
1006
  },
800
1007
  {
801
1008
  "name": "width",
802
- "tags": [],
803
- "docs": "The desired width of the picture in pixels. If not provided, the device default is used.",
1009
+ "tags": [
1010
+ {
1011
+ "text": ",\nThe desired width of the picture in pixels. \nIf not specified and no aspectRatio is provided, the captured image will match the preview's visible area.",
1012
+ "name": "deprecated"
1013
+ }
1014
+ ],
1015
+ "docs": "",
804
1016
  "complexTypes": [],
805
1017
  "type": "number | undefined"
806
1018
  },
1019
+ {
1020
+ "name": "aspectRatio",
1021
+ "tags": [
1022
+ {
1023
+ "text": ",\nThe desired aspect ratio of the captured image (e.g., '4:3', '16:9').\nIf not specified and no width/height is provided, the aspect ratio from the camera start will be used.\nIf no aspect ratio was set at start, defaults to '4:3'.\nCannot be used together with width or height - the capture will be rejected with an error.",
1024
+ "name": "deprecated"
1025
+ },
1026
+ {
1027
+ "text": "7.7.0",
1028
+ "name": "since"
1029
+ }
1030
+ ],
1031
+ "docs": "",
1032
+ "complexTypes": [],
1033
+ "type": "string | undefined"
1034
+ },
807
1035
  {
808
1036
  "name": "quality",
809
1037
  "tags": [
@@ -845,6 +1073,22 @@
845
1073
  "docs": "If true, the captured image will be saved to the user's gallery.",
846
1074
  "complexTypes": [],
847
1075
  "type": "boolean | undefined"
1076
+ },
1077
+ {
1078
+ "name": "withExifLocation",
1079
+ "tags": [
1080
+ {
1081
+ "text": "false",
1082
+ "name": "default"
1083
+ },
1084
+ {
1085
+ "text": "7.6.0",
1086
+ "name": "since"
1087
+ }
1088
+ ],
1089
+ "docs": "If true, the plugin will attempt to add GPS location data to the image's EXIF metadata.\nThis may prompt the user for location permissions.",
1090
+ "complexTypes": [],
1091
+ "type": "boolean | undefined"
848
1092
  }
849
1093
  ]
850
1094
  },
@@ -1144,6 +1388,25 @@
1144
1388
  }
1145
1389
  ],
1146
1390
  "typeAliases": [
1391
+ {
1392
+ "name": "GridMode",
1393
+ "slug": "gridmode",
1394
+ "docs": "",
1395
+ "types": [
1396
+ {
1397
+ "text": "\"none\"",
1398
+ "complexTypes": []
1399
+ },
1400
+ {
1401
+ "text": "\"3x3\"",
1402
+ "complexTypes": []
1403
+ },
1404
+ {
1405
+ "text": "\"4x4\"",
1406
+ "complexTypes": []
1407
+ }
1408
+ ]
1409
+ },
1147
1410
  {
1148
1411
  "name": "CameraPosition",
1149
1412
  "slug": "cameraposition",