@capgo/camera-preview 8.8.1 → 8.9.0
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/README.md +58 -0
- package/android/src/main/java/app/capgo/capacitor/camera/preview/CameraPreview.java +43 -0
- package/android/src/main/java/app/capgo/capacitor/camera/preview/CameraXView.java +130 -8
- package/dist/docs.json +80 -0
- package/dist/esm/definitions.d.ts +32 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +10 -1
- package/dist/esm/web.js +50 -2
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +49 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +49 -2
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapgoCameraPreviewPlugin/CameraController.swift +102 -1
- package/ios/Sources/CapgoCameraPreviewPlugin/Plugin.swift +56 -1
- package/package.json +1 -1
package/dist/plugin.cjs.js
CHANGED
|
@@ -189,8 +189,45 @@ class CameraPreviewWeb extends core.WebPlugin {
|
|
|
189
189
|
async getOrientation() {
|
|
190
190
|
return { orientation: this.getCurrentOrientation() };
|
|
191
191
|
}
|
|
192
|
-
getSafeAreaInsets() {
|
|
193
|
-
|
|
192
|
+
async getSafeAreaInsets() {
|
|
193
|
+
const orientationValue = this.getCurrentOrientation();
|
|
194
|
+
let orientation = 0;
|
|
195
|
+
if (orientationValue === 'portrait' || orientationValue === 'portrait-upside-down') {
|
|
196
|
+
orientation = 1;
|
|
197
|
+
}
|
|
198
|
+
else if (orientationValue === 'landscape-left' || orientationValue === 'landscape-right') {
|
|
199
|
+
orientation = 2;
|
|
200
|
+
}
|
|
201
|
+
const parseInset = (value) => {
|
|
202
|
+
const parsed = Number.parseFloat(value);
|
|
203
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
204
|
+
};
|
|
205
|
+
const probe = document.createElement('div');
|
|
206
|
+
probe.style.position = 'fixed';
|
|
207
|
+
probe.style.visibility = 'hidden';
|
|
208
|
+
probe.style.pointerEvents = 'none';
|
|
209
|
+
probe.style.top = '0';
|
|
210
|
+
probe.style.left = '0';
|
|
211
|
+
probe.style.paddingTop = 'env(safe-area-inset-top)';
|
|
212
|
+
probe.style.paddingLeft = 'env(safe-area-inset-left)';
|
|
213
|
+
probe.style.paddingRight = 'env(safe-area-inset-right)';
|
|
214
|
+
document.body.appendChild(probe);
|
|
215
|
+
const styles = getComputedStyle(probe);
|
|
216
|
+
const topInset = parseInset(styles.paddingTop);
|
|
217
|
+
const leftInset = parseInset(styles.paddingLeft);
|
|
218
|
+
const rightInset = parseInset(styles.paddingRight);
|
|
219
|
+
probe.remove();
|
|
220
|
+
let top = 0;
|
|
221
|
+
if (orientation === 1) {
|
|
222
|
+
top = topInset;
|
|
223
|
+
}
|
|
224
|
+
else if (orientation === 2) {
|
|
225
|
+
top = leftInset > 0 ? leftInset : rightInset;
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
top = Math.max(topInset, leftInset, rightInset);
|
|
229
|
+
}
|
|
230
|
+
return { orientation, top };
|
|
194
231
|
}
|
|
195
232
|
async getZoomButtonValues() {
|
|
196
233
|
throw new Error('getZoomButtonValues not supported under the web platform');
|
|
@@ -1359,6 +1396,16 @@ class CameraPreviewWeb extends core.WebPlugin {
|
|
|
1359
1396
|
async setExposureCompensation(_options) {
|
|
1360
1397
|
throw new Error('setExposureCompensation not supported under the web platform');
|
|
1361
1398
|
}
|
|
1399
|
+
// White balance stubs (unsupported on web)
|
|
1400
|
+
async getWhiteBalanceModes() {
|
|
1401
|
+
throw new Error('getWhiteBalanceModes not supported under the web platform');
|
|
1402
|
+
}
|
|
1403
|
+
async getWhiteBalanceMode() {
|
|
1404
|
+
throw new Error('getWhiteBalanceMode not supported under the web platform');
|
|
1405
|
+
}
|
|
1406
|
+
async setWhiteBalanceMode(_options) {
|
|
1407
|
+
throw new Error('setWhiteBalanceMode not supported under the web platform');
|
|
1408
|
+
}
|
|
1362
1409
|
async getSupportedVideoFrameRates() {
|
|
1363
1410
|
throw new Error('getSupportedVideoFrameRates not supported under the web platform');
|
|
1364
1411
|
}
|