scandit-datacapture-frameworks-core 8.2.1 → 8.3.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/__mocks__/Defaults.ts +6 -1
- package/dist/dts/ClusteringMode.d.ts +6 -0
- package/dist/dts/camera/Camera.d.ts +16 -3
- package/dist/dts/camera/CameraSettings.d.ts +10 -3
- package/dist/dts/camera/FocusGesture.d.ts +6 -0
- package/dist/dts/camera/FocusGestureListener.d.ts +5 -0
- package/dist/dts/camera/FocusGestureListenerEvents.d.ts +3 -0
- package/dist/dts/camera/MacroMode.d.ts +5 -0
- package/dist/dts/camera/SwipeToZoom.d.ts +14 -0
- package/dist/dts/camera/TapToFocus.d.ts +15 -0
- package/dist/dts/camera/TorchSwitchControl.d.ts +5 -0
- package/dist/dts/camera/ZoomGesture.d.ts +5 -0
- package/dist/dts/camera/ZoomGestureListener.d.ts +5 -0
- package/dist/dts/camera/ZoomGestureListenerEvents.d.ts +4 -0
- package/dist/dts/camera/ZoomSwitchControl.d.ts +7 -0
- package/dist/dts/camera/controller/CameraController.d.ts +8 -0
- package/dist/dts/camera/index.d.ts +5 -0
- package/dist/dts/camerahelpers/MacroModeListenerEvents.d.ts +3 -0
- package/dist/dts/camerahelpers/TorchListenerEvents.d.ts +3 -0
- package/dist/dts/camerahelpers/index.d.ts +2 -0
- package/dist/dts/common/Color.d.ts +1 -1
- package/dist/dts/common/Payload.d.ts +36 -1
- package/dist/dts/defaults/CoreDefaults.d.ts +7 -1
- package/dist/dts/defaults/getCoreDefaults.d.ts +1 -1
- package/dist/dts/frame/FrameData.d.ts +6 -0
- package/dist/dts/frame/MacroModeListener.d.ts +4 -0
- package/dist/dts/frame/TorchListener.d.ts +4 -0
- package/dist/dts/frame/index.d.ts +2 -0
- package/dist/dts/generated/CoreProxyAdapter.d.ts +71 -0
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/view/DataCaptureView.d.ts +7 -0
- package/dist/dts/view/DataCaptureViewController.d.ts +22 -2
- package/dist/index.js +871 -69
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/test/CameraSettings.test.ts +335 -0
- package/test/Color.test.ts +98 -0
package/dist/index.js
CHANGED
|
@@ -391,6 +391,50 @@ class FactoryMaker {
|
|
|
391
391
|
}
|
|
392
392
|
FactoryMaker.instances = new Map();
|
|
393
393
|
|
|
394
|
+
var FocusGestureListenerEvents;
|
|
395
|
+
(function (FocusGestureListenerEvents) {
|
|
396
|
+
FocusGestureListenerEvents["onFocusGesture"] = "FocusGestureListener.onFocusGesture";
|
|
397
|
+
})(FocusGestureListenerEvents || (FocusGestureListenerEvents = {}));
|
|
398
|
+
|
|
399
|
+
/******************************************************************************
|
|
400
|
+
Copyright (c) Microsoft Corporation.
|
|
401
|
+
|
|
402
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
403
|
+
purpose with or without fee is hereby granted.
|
|
404
|
+
|
|
405
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
406
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
407
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
408
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
409
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
410
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
411
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
412
|
+
***************************************************************************** */
|
|
413
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
function __decorate(decorators, target, key, desc) {
|
|
417
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
418
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
419
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
420
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
424
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
425
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
426
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
427
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
428
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
429
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
434
|
+
var e = new Error(message);
|
|
435
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
436
|
+
};
|
|
437
|
+
|
|
394
438
|
function ignoreFromSerialization(target, propertyName) {
|
|
395
439
|
target.ignoredProperties = target.ignoredProperties || [];
|
|
396
440
|
target.ignoredProperties.push(propertyName);
|
|
@@ -462,8 +506,46 @@ class TapToFocus extends DefaultSerializeable {
|
|
|
462
506
|
constructor() {
|
|
463
507
|
super();
|
|
464
508
|
this.type = 'tapToFocus';
|
|
509
|
+
this.showUIIndicator = true;
|
|
510
|
+
this.listeners = [];
|
|
511
|
+
}
|
|
512
|
+
addListener(listener) {
|
|
513
|
+
if (!this.listeners.includes(listener)) {
|
|
514
|
+
const wasEmpty = this.listeners.length === 0;
|
|
515
|
+
this.listeners.push(listener);
|
|
516
|
+
if (wasEmpty && this.onListenersChanged) {
|
|
517
|
+
this.onListenersChanged();
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
removeListener(listener) {
|
|
522
|
+
if (this.listeners.includes(listener)) {
|
|
523
|
+
this.listeners.splice(this.listeners.indexOf(listener), 1);
|
|
524
|
+
if (this.listeners.length === 0 && this.onListenersChanged) {
|
|
525
|
+
this.onListenersChanged();
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
triggerFocus(point) {
|
|
530
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
531
|
+
if (this._controller) {
|
|
532
|
+
yield this._controller.triggerFocus(point);
|
|
533
|
+
}
|
|
534
|
+
});
|
|
465
535
|
}
|
|
466
536
|
}
|
|
537
|
+
__decorate([
|
|
538
|
+
nameForSerialization('showUIIndicator')
|
|
539
|
+
], TapToFocus.prototype, "showUIIndicator", void 0);
|
|
540
|
+
__decorate([
|
|
541
|
+
ignoreFromSerialization
|
|
542
|
+
], TapToFocus.prototype, "listeners", void 0);
|
|
543
|
+
__decorate([
|
|
544
|
+
ignoreFromSerialization
|
|
545
|
+
], TapToFocus.prototype, "onListenersChanged", void 0);
|
|
546
|
+
__decorate([
|
|
547
|
+
ignoreFromSerialization
|
|
548
|
+
], TapToFocus.prototype, "_controller", void 0);
|
|
467
549
|
|
|
468
550
|
class PrivateFocusGestureDeserializer {
|
|
469
551
|
static fromJSON(json) {
|
|
@@ -480,8 +562,49 @@ class SwipeToZoom extends DefaultSerializeable {
|
|
|
480
562
|
constructor() {
|
|
481
563
|
super();
|
|
482
564
|
this.type = 'swipeToZoom';
|
|
565
|
+
this.listeners = [];
|
|
566
|
+
}
|
|
567
|
+
addListener(listener) {
|
|
568
|
+
if (!this.listeners.includes(listener)) {
|
|
569
|
+
const wasEmpty = this.listeners.length === 0;
|
|
570
|
+
this.listeners.push(listener);
|
|
571
|
+
if (wasEmpty && this.onListenersChanged) {
|
|
572
|
+
this.onListenersChanged();
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
removeListener(listener) {
|
|
577
|
+
if (this.listeners.includes(listener)) {
|
|
578
|
+
this.listeners.splice(this.listeners.indexOf(listener), 1);
|
|
579
|
+
if (this.listeners.length === 0 && this.onListenersChanged) {
|
|
580
|
+
this.onListenersChanged();
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
triggerZoomIn() {
|
|
585
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
586
|
+
if (this._controller) {
|
|
587
|
+
yield this._controller.triggerZoomIn();
|
|
588
|
+
}
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
triggerZoomOut() {
|
|
592
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
593
|
+
if (this._controller) {
|
|
594
|
+
yield this._controller.triggerZoomOut();
|
|
595
|
+
}
|
|
596
|
+
});
|
|
483
597
|
}
|
|
484
598
|
}
|
|
599
|
+
__decorate([
|
|
600
|
+
ignoreFromSerialization
|
|
601
|
+
], SwipeToZoom.prototype, "listeners", void 0);
|
|
602
|
+
__decorate([
|
|
603
|
+
ignoreFromSerialization
|
|
604
|
+
], SwipeToZoom.prototype, "onListenersChanged", void 0);
|
|
605
|
+
__decorate([
|
|
606
|
+
ignoreFromSerialization
|
|
607
|
+
], SwipeToZoom.prototype, "_controller", void 0);
|
|
485
608
|
|
|
486
609
|
class PrivateZoomGestureDeserializer {
|
|
487
610
|
static fromJSON(json) {
|
|
@@ -494,44 +617,11 @@ class PrivateZoomGestureDeserializer {
|
|
|
494
617
|
}
|
|
495
618
|
}
|
|
496
619
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
504
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
505
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
506
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
507
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
508
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
509
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
510
|
-
***************************************************************************** */
|
|
511
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
function __decorate(decorators, target, key, desc) {
|
|
515
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
516
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
517
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
518
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
522
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
523
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
524
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
525
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
526
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
527
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
528
|
-
});
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
532
|
-
var e = new Error(message);
|
|
533
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
534
|
-
};
|
|
620
|
+
var ZoomGestureListenerEvents;
|
|
621
|
+
(function (ZoomGestureListenerEvents) {
|
|
622
|
+
ZoomGestureListenerEvents["onZoomInGesture"] = "ZoomGestureListener.onZoomInGesture";
|
|
623
|
+
ZoomGestureListenerEvents["onZoomOutGesture"] = "ZoomGestureListener.onZoomOutGesture";
|
|
624
|
+
})(ZoomGestureListenerEvents || (ZoomGestureListenerEvents = {}));
|
|
535
625
|
|
|
536
626
|
var CameraPosition;
|
|
537
627
|
(function (CameraPosition) {
|
|
@@ -545,6 +635,16 @@ var FrameSourceListenerEvents;
|
|
|
545
635
|
FrameSourceListenerEvents["didChangeState"] = "FrameSourceListener.onStateChanged";
|
|
546
636
|
})(FrameSourceListenerEvents || (FrameSourceListenerEvents = {}));
|
|
547
637
|
|
|
638
|
+
var TorchListenerEvents;
|
|
639
|
+
(function (TorchListenerEvents) {
|
|
640
|
+
TorchListenerEvents["didChangeTorchToState"] = "TorchListener.onTorchStateChanged";
|
|
641
|
+
})(TorchListenerEvents || (TorchListenerEvents = {}));
|
|
642
|
+
|
|
643
|
+
var MacroModeListenerEvents;
|
|
644
|
+
(function (MacroModeListenerEvents) {
|
|
645
|
+
MacroModeListenerEvents["didChangeMacroMode"] = "MacroModeListener.onMacroModeChanged";
|
|
646
|
+
})(MacroModeListenerEvents || (MacroModeListenerEvents = {}));
|
|
647
|
+
|
|
548
648
|
var FrameSourceState;
|
|
549
649
|
(function (FrameSourceState) {
|
|
550
650
|
FrameSourceState["On"] = "on";
|
|
@@ -1179,8 +1279,7 @@ class Color {
|
|
|
1179
1279
|
return new Color(Color.normalizeHex(hex));
|
|
1180
1280
|
}
|
|
1181
1281
|
static fromRGBA(red, green, blue, alpha = 1) {
|
|
1182
|
-
const hexString = [red, green, blue, this.normalizeAlpha(alpha)]
|
|
1183
|
-
.reduce((hex, colorComponent) => hex + this.numberToHex(colorComponent), '');
|
|
1282
|
+
const hexString = [red, green, blue, this.normalizeAlpha(alpha)].reduce((hex, colorComponent) => hex + this.numberToHex(colorComponent), '');
|
|
1184
1283
|
return new Color(hexString);
|
|
1185
1284
|
}
|
|
1186
1285
|
static hexToNumber(hex) {
|
|
@@ -1204,13 +1303,16 @@ class Color {
|
|
|
1204
1303
|
}
|
|
1205
1304
|
// double digits if single digit
|
|
1206
1305
|
if (hex.length < 6) {
|
|
1207
|
-
hex = hex
|
|
1306
|
+
hex = hex
|
|
1307
|
+
.split('')
|
|
1308
|
+
.map(s => s + s)
|
|
1309
|
+
.join('');
|
|
1208
1310
|
}
|
|
1209
1311
|
// add alpha if missing
|
|
1210
1312
|
if (hex.length === 6) {
|
|
1211
1313
|
hex = hex + 'FF';
|
|
1212
1314
|
}
|
|
1213
|
-
return
|
|
1315
|
+
return hex.toUpperCase();
|
|
1214
1316
|
}
|
|
1215
1317
|
static normalizeAlpha(alpha) {
|
|
1216
1318
|
if (alpha > 0 && alpha <= 1) {
|
|
@@ -1226,7 +1328,7 @@ class Color {
|
|
|
1226
1328
|
return Color.fromHex(newHex);
|
|
1227
1329
|
}
|
|
1228
1330
|
toJSON() {
|
|
1229
|
-
return this.hexadecimalString;
|
|
1331
|
+
return '#' + this.hexadecimalString;
|
|
1230
1332
|
}
|
|
1231
1333
|
}
|
|
1232
1334
|
|
|
@@ -1297,6 +1399,11 @@ var ScanIntention;
|
|
|
1297
1399
|
ScanIntention["SmartSelection"] = "smartSelection";
|
|
1298
1400
|
})(ScanIntention || (ScanIntention = {}));
|
|
1299
1401
|
|
|
1402
|
+
/**
|
|
1403
|
+
* Symbol returned by parseIfShouldHandle when an event should be skipped
|
|
1404
|
+
* (filtered out based on viewId/modeId mismatch).
|
|
1405
|
+
*/
|
|
1406
|
+
const SKIP = Symbol('EventDataParser.SKIP');
|
|
1300
1407
|
class EventDataParser {
|
|
1301
1408
|
static parse(data) {
|
|
1302
1409
|
if (data == null) {
|
|
@@ -1304,6 +1411,58 @@ class EventDataParser {
|
|
|
1304
1411
|
}
|
|
1305
1412
|
return JSON.parse(data);
|
|
1306
1413
|
}
|
|
1414
|
+
/**
|
|
1415
|
+
* Check if an event should be handled based on viewId/modeId filtering.
|
|
1416
|
+
* Used by React Native new architecture for pre-parse filtering to avoid
|
|
1417
|
+
* unnecessary JSON parsing of events not intended for this consumer.
|
|
1418
|
+
*
|
|
1419
|
+
* @param ev The event payload to check
|
|
1420
|
+
* @param ids Object containing optional viewId and/or modeId to match against
|
|
1421
|
+
* @returns true if the event should be handled, false if it should be skipped
|
|
1422
|
+
*/
|
|
1423
|
+
static shouldHandle(ev, ids) {
|
|
1424
|
+
// If event has no filter fields (old arch, Cordova, Capacitor), proceed to parse
|
|
1425
|
+
if (ev.viewId === undefined && ev.modeId === undefined) {
|
|
1426
|
+
return true;
|
|
1427
|
+
}
|
|
1428
|
+
// Check viewId match if both are specified
|
|
1429
|
+
if (ids.viewId !== undefined && ev.viewId !== undefined && ev.viewId !== ids.viewId) {
|
|
1430
|
+
return false;
|
|
1431
|
+
}
|
|
1432
|
+
// Check modeId match if both are specified
|
|
1433
|
+
if (ids.modeId !== undefined && ev.modeId !== undefined && ev.modeId !== ids.modeId) {
|
|
1434
|
+
return false;
|
|
1435
|
+
}
|
|
1436
|
+
return true;
|
|
1437
|
+
}
|
|
1438
|
+
/**
|
|
1439
|
+
* Parse event data if it should be handled, otherwise return SKIP.
|
|
1440
|
+
*
|
|
1441
|
+
* Filtering is performed in two stages:
|
|
1442
|
+
* 1. Pre-parse: if the event wrapper carries viewId/modeId, skip parsing entirely on mismatch.
|
|
1443
|
+
* 2. Post-parse: verify the parsed payload's viewId/modeId matches the expected ids.
|
|
1444
|
+
*
|
|
1445
|
+
* @param ev The event payload to check and parse
|
|
1446
|
+
* @param ids Object containing optional viewId and/or modeId to match against
|
|
1447
|
+
* @returns SKIP if filtered out, null if parse failed, or parsed data
|
|
1448
|
+
*/
|
|
1449
|
+
static parseIfShouldHandle(ev, ids) {
|
|
1450
|
+
if (!this.shouldHandle(ev, ids)) {
|
|
1451
|
+
return SKIP;
|
|
1452
|
+
}
|
|
1453
|
+
const parsed = this.parse(ev.data);
|
|
1454
|
+
if (parsed === null) {
|
|
1455
|
+
return null;
|
|
1456
|
+
}
|
|
1457
|
+
const data = parsed;
|
|
1458
|
+
if (ids.modeId !== undefined && data.modeId !== undefined && data.modeId !== ids.modeId) {
|
|
1459
|
+
return SKIP;
|
|
1460
|
+
}
|
|
1461
|
+
if (ids.viewId !== undefined && data.viewId !== undefined && data.viewId !== ids.viewId) {
|
|
1462
|
+
return SKIP;
|
|
1463
|
+
}
|
|
1464
|
+
return parsed;
|
|
1465
|
+
}
|
|
1307
1466
|
}
|
|
1308
1467
|
|
|
1309
1468
|
class Observable extends DefaultSerializeable {
|
|
@@ -1442,6 +1601,19 @@ class CoreProxyAdapter {
|
|
|
1442
1601
|
return result.data === 'true';
|
|
1443
1602
|
});
|
|
1444
1603
|
}
|
|
1604
|
+
/**
|
|
1605
|
+
* Checks if macro mode is available for the current device
|
|
1606
|
+
*/
|
|
1607
|
+
isMacroModeAvailable() {
|
|
1608
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1609
|
+
const result = yield this.proxy.$executeCore({
|
|
1610
|
+
moduleName: 'CoreModule',
|
|
1611
|
+
methodName: 'isMacroModeAvailable',
|
|
1612
|
+
isEventRegistration: false,
|
|
1613
|
+
});
|
|
1614
|
+
return result.data === 'true';
|
|
1615
|
+
});
|
|
1616
|
+
}
|
|
1445
1617
|
/**
|
|
1446
1618
|
* Registers a persistent listener for frame source state change events
|
|
1447
1619
|
*/
|
|
@@ -1468,6 +1640,58 @@ class CoreProxyAdapter {
|
|
|
1468
1640
|
return result;
|
|
1469
1641
|
});
|
|
1470
1642
|
}
|
|
1643
|
+
/**
|
|
1644
|
+
* Registers a persistent listener for torch state change events
|
|
1645
|
+
*/
|
|
1646
|
+
registerTorchStateListener() {
|
|
1647
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1648
|
+
const result = yield this.proxy.$executeCore({
|
|
1649
|
+
moduleName: 'CoreModule',
|
|
1650
|
+
methodName: 'registerTorchStateListener',
|
|
1651
|
+
isEventRegistration: true,
|
|
1652
|
+
});
|
|
1653
|
+
return result;
|
|
1654
|
+
});
|
|
1655
|
+
}
|
|
1656
|
+
/**
|
|
1657
|
+
* Unregisters the torch state event listener
|
|
1658
|
+
*/
|
|
1659
|
+
unregisterTorchStateListener() {
|
|
1660
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1661
|
+
const result = yield this.proxy.$executeCore({
|
|
1662
|
+
moduleName: 'CoreModule',
|
|
1663
|
+
methodName: 'unregisterTorchStateListener',
|
|
1664
|
+
isEventRegistration: false,
|
|
1665
|
+
});
|
|
1666
|
+
return result;
|
|
1667
|
+
});
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* Registers a persistent listener for macro mode change events
|
|
1671
|
+
*/
|
|
1672
|
+
registerMacroModeListener() {
|
|
1673
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1674
|
+
const result = yield this.proxy.$executeCore({
|
|
1675
|
+
moduleName: 'CoreModule',
|
|
1676
|
+
methodName: 'registerMacroModeListener',
|
|
1677
|
+
isEventRegistration: true,
|
|
1678
|
+
});
|
|
1679
|
+
return result;
|
|
1680
|
+
});
|
|
1681
|
+
}
|
|
1682
|
+
/**
|
|
1683
|
+
* Unregisters the macro mode event listener
|
|
1684
|
+
*/
|
|
1685
|
+
unregisterMacroModeListener() {
|
|
1686
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1687
|
+
const result = yield this.proxy.$executeCore({
|
|
1688
|
+
moduleName: 'CoreModule',
|
|
1689
|
+
methodName: 'unregisterMacroModeListener',
|
|
1690
|
+
isEventRegistration: false,
|
|
1691
|
+
});
|
|
1692
|
+
return result;
|
|
1693
|
+
});
|
|
1694
|
+
}
|
|
1471
1695
|
/**
|
|
1472
1696
|
* Gets the last frame data by frame ID as JSON
|
|
1473
1697
|
* @param frameId Unique frame identifier
|
|
@@ -1689,6 +1913,113 @@ class CoreProxyAdapter {
|
|
|
1689
1913
|
return result;
|
|
1690
1914
|
});
|
|
1691
1915
|
}
|
|
1916
|
+
/**
|
|
1917
|
+
* Registers a persistent listener for focus gesture events
|
|
1918
|
+
* @param viewId View identifier
|
|
1919
|
+
*/
|
|
1920
|
+
registerFocusGestureListener(_a) {
|
|
1921
|
+
return __awaiter(this, arguments, void 0, function* ({ viewId }) {
|
|
1922
|
+
const result = yield this.proxy.$executeCore({
|
|
1923
|
+
moduleName: 'CoreModule',
|
|
1924
|
+
methodName: 'registerFocusGestureListener',
|
|
1925
|
+
isEventRegistration: true,
|
|
1926
|
+
viewId,
|
|
1927
|
+
});
|
|
1928
|
+
return result;
|
|
1929
|
+
});
|
|
1930
|
+
}
|
|
1931
|
+
/**
|
|
1932
|
+
* Unregisters the focus gesture event listener
|
|
1933
|
+
* @param viewId View identifier
|
|
1934
|
+
*/
|
|
1935
|
+
unregisterFocusGestureListener(_a) {
|
|
1936
|
+
return __awaiter(this, arguments, void 0, function* ({ viewId }) {
|
|
1937
|
+
const result = yield this.proxy.$executeCore({
|
|
1938
|
+
moduleName: 'CoreModule',
|
|
1939
|
+
methodName: 'unregisterFocusGestureListener',
|
|
1940
|
+
isEventRegistration: false,
|
|
1941
|
+
viewId,
|
|
1942
|
+
});
|
|
1943
|
+
return result;
|
|
1944
|
+
});
|
|
1945
|
+
}
|
|
1946
|
+
/**
|
|
1947
|
+
* Triggers a focus as if the focus gesture was performed
|
|
1948
|
+
* @param viewId View identifier
|
|
1949
|
+
* @param pointJson Point in view coordinates as JSON string
|
|
1950
|
+
*/
|
|
1951
|
+
triggerFocus(_a) {
|
|
1952
|
+
return __awaiter(this, arguments, void 0, function* ({ viewId, pointJson }) {
|
|
1953
|
+
const result = yield this.proxy.$executeCore({
|
|
1954
|
+
moduleName: 'CoreModule',
|
|
1955
|
+
methodName: 'triggerFocus',
|
|
1956
|
+
isEventRegistration: false,
|
|
1957
|
+
viewId,
|
|
1958
|
+
pointJson,
|
|
1959
|
+
});
|
|
1960
|
+
return result;
|
|
1961
|
+
});
|
|
1962
|
+
}
|
|
1963
|
+
/**
|
|
1964
|
+
* Triggers a zoom in gesture as if the zoom gesture was performed
|
|
1965
|
+
* @param viewId View identifier
|
|
1966
|
+
*/
|
|
1967
|
+
triggerZoomIn(_a) {
|
|
1968
|
+
return __awaiter(this, arguments, void 0, function* ({ viewId }) {
|
|
1969
|
+
const result = yield this.proxy.$executeCore({
|
|
1970
|
+
moduleName: 'CoreModule',
|
|
1971
|
+
methodName: 'triggerZoomIn',
|
|
1972
|
+
isEventRegistration: false,
|
|
1973
|
+
viewId,
|
|
1974
|
+
});
|
|
1975
|
+
return result;
|
|
1976
|
+
});
|
|
1977
|
+
}
|
|
1978
|
+
/**
|
|
1979
|
+
* Triggers a zoom out gesture as if the zoom gesture was performed
|
|
1980
|
+
* @param viewId View identifier
|
|
1981
|
+
*/
|
|
1982
|
+
triggerZoomOut(_a) {
|
|
1983
|
+
return __awaiter(this, arguments, void 0, function* ({ viewId }) {
|
|
1984
|
+
const result = yield this.proxy.$executeCore({
|
|
1985
|
+
moduleName: 'CoreModule',
|
|
1986
|
+
methodName: 'triggerZoomOut',
|
|
1987
|
+
isEventRegistration: false,
|
|
1988
|
+
viewId,
|
|
1989
|
+
});
|
|
1990
|
+
return result;
|
|
1991
|
+
});
|
|
1992
|
+
}
|
|
1993
|
+
/**
|
|
1994
|
+
* Registers a persistent listener for zoom gesture events
|
|
1995
|
+
* @param viewId View identifier
|
|
1996
|
+
*/
|
|
1997
|
+
registerZoomGestureListener(_a) {
|
|
1998
|
+
return __awaiter(this, arguments, void 0, function* ({ viewId }) {
|
|
1999
|
+
const result = yield this.proxy.$executeCore({
|
|
2000
|
+
moduleName: 'CoreModule',
|
|
2001
|
+
methodName: 'registerZoomGestureListener',
|
|
2002
|
+
isEventRegistration: true,
|
|
2003
|
+
viewId,
|
|
2004
|
+
});
|
|
2005
|
+
return result;
|
|
2006
|
+
});
|
|
2007
|
+
}
|
|
2008
|
+
/**
|
|
2009
|
+
* Unregisters the zoom gesture event listener
|
|
2010
|
+
* @param viewId View identifier
|
|
2011
|
+
*/
|
|
2012
|
+
unregisterZoomGestureListener(_a) {
|
|
2013
|
+
return __awaiter(this, arguments, void 0, function* ({ viewId }) {
|
|
2014
|
+
const result = yield this.proxy.$executeCore({
|
|
2015
|
+
moduleName: 'CoreModule',
|
|
2016
|
+
methodName: 'unregisterZoomGestureListener',
|
|
2017
|
+
isEventRegistration: false,
|
|
2018
|
+
viewId,
|
|
2019
|
+
});
|
|
2020
|
+
return result;
|
|
2021
|
+
});
|
|
2022
|
+
}
|
|
1692
2023
|
/**
|
|
1693
2024
|
* Updates the DataCaptureView configuration
|
|
1694
2025
|
* @param viewJson Updated view configuration as JSON string
|
|
@@ -1767,7 +2098,10 @@ class ImageFrameSourceController extends BaseController {
|
|
|
1767
2098
|
this._proxy.dispose();
|
|
1768
2099
|
}
|
|
1769
2100
|
handleDidChangeStateEvent(ev) {
|
|
1770
|
-
const event = EventDataParser.
|
|
2101
|
+
const event = EventDataParser.parseIfShouldHandle(ev, {});
|
|
2102
|
+
if (event === SKIP) {
|
|
2103
|
+
return;
|
|
2104
|
+
}
|
|
1771
2105
|
if (event === null) {
|
|
1772
2106
|
console.error('ImageFrameSourceController didChangeState payload is null');
|
|
1773
2107
|
return;
|
|
@@ -1869,10 +2203,17 @@ class PrivateFrameData {
|
|
|
1869
2203
|
get imageBuffers() {
|
|
1870
2204
|
return this._imageBuffers;
|
|
1871
2205
|
}
|
|
2206
|
+
get imageBuffer() {
|
|
2207
|
+
return this._imageBuffers[0];
|
|
2208
|
+
}
|
|
1872
2209
|
get orientation() {
|
|
1873
2210
|
return this._orientation;
|
|
1874
2211
|
}
|
|
2212
|
+
get timestamp() {
|
|
2213
|
+
return this._timestamp;
|
|
2214
|
+
}
|
|
1875
2215
|
static fromJSON(json) {
|
|
2216
|
+
var _a;
|
|
1876
2217
|
const frameData = new PrivateFrameData();
|
|
1877
2218
|
frameData._imageBuffers = json.imageBuffers.map((imageBufferJSON) => {
|
|
1878
2219
|
const imageBuffer = new ImageBuffer();
|
|
@@ -1882,12 +2223,14 @@ class PrivateFrameData {
|
|
|
1882
2223
|
return imageBuffer;
|
|
1883
2224
|
});
|
|
1884
2225
|
frameData._orientation = json.orientation;
|
|
2226
|
+
frameData._timestamp = (_a = json.timestamp) !== null && _a !== void 0 ? _a : -1;
|
|
1885
2227
|
return frameData;
|
|
1886
2228
|
}
|
|
1887
2229
|
static empty() {
|
|
1888
2230
|
const frameData = new PrivateFrameData();
|
|
1889
2231
|
frameData._imageBuffers = [];
|
|
1890
2232
|
frameData._orientation = 90;
|
|
2233
|
+
frameData._timestamp = -1;
|
|
1891
2234
|
return frameData;
|
|
1892
2235
|
}
|
|
1893
2236
|
}
|
|
@@ -1972,14 +2315,18 @@ class Camera extends DefaultSerializeable {
|
|
|
1972
2315
|
this.settings = null;
|
|
1973
2316
|
this._desiredTorchState = TorchState.Off;
|
|
1974
2317
|
this._desiredState = FrameSourceState.Off;
|
|
2318
|
+
this._hasTorchStateListeners = false;
|
|
2319
|
+
this._hasMacroModeListeners = false;
|
|
1975
2320
|
this.currentCameraState = FrameSourceState.Off;
|
|
1976
2321
|
this.listeners = [];
|
|
2322
|
+
this.torchListeners = [];
|
|
2323
|
+
this.macroModeListeners = [];
|
|
1977
2324
|
this._context = null;
|
|
1978
2325
|
this.nativeReadyResolver = null;
|
|
1979
2326
|
this.nativeReadyRejecter = null;
|
|
1980
2327
|
this.nativeReadyPromise = null;
|
|
1981
2328
|
this.nativeReadyTimeout = null;
|
|
1982
|
-
this.
|
|
2329
|
+
this._position = position || Camera.coreDefaults.Camera.defaultPosition;
|
|
1983
2330
|
this.settings = settings || null;
|
|
1984
2331
|
this._desiredTorchState = desiredTorchState || TorchState.Off;
|
|
1985
2332
|
this._desiredState = desiredState || FrameSourceState.Off;
|
|
@@ -2027,6 +2374,58 @@ class Camera extends DefaultSerializeable {
|
|
|
2027
2374
|
}
|
|
2028
2375
|
this.listeners.splice(this.listeners.indexOf(listener), 1);
|
|
2029
2376
|
}
|
|
2377
|
+
addTorchListener(listener) {
|
|
2378
|
+
if (this.torchListeners.includes(listener)) {
|
|
2379
|
+
return;
|
|
2380
|
+
}
|
|
2381
|
+
this.torchListeners.push(listener);
|
|
2382
|
+
this._hasTorchStateListeners = this.torchListeners.length > 0;
|
|
2383
|
+
if (this.torchListeners.length === 1) {
|
|
2384
|
+
void this.controller.subscribeTorchListener();
|
|
2385
|
+
}
|
|
2386
|
+
if (this.isActiveCamera) {
|
|
2387
|
+
void this.didChange();
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
removeTorchListener(listener) {
|
|
2391
|
+
if (!this.torchListeners.includes(listener)) {
|
|
2392
|
+
return;
|
|
2393
|
+
}
|
|
2394
|
+
this.torchListeners.splice(this.torchListeners.indexOf(listener), 1);
|
|
2395
|
+
this._hasTorchStateListeners = this.torchListeners.length > 0;
|
|
2396
|
+
if (this.torchListeners.length === 0) {
|
|
2397
|
+
void this.controller.unsubscribeTorchListener();
|
|
2398
|
+
}
|
|
2399
|
+
if (this.isActiveCamera) {
|
|
2400
|
+
void this.didChange();
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
addMacroModeListener(listener) {
|
|
2404
|
+
if (this.macroModeListeners.includes(listener)) {
|
|
2405
|
+
return;
|
|
2406
|
+
}
|
|
2407
|
+
this.macroModeListeners.push(listener);
|
|
2408
|
+
this._hasMacroModeListeners = this.macroModeListeners.length > 0;
|
|
2409
|
+
if (this.macroModeListeners.length === 1) {
|
|
2410
|
+
void this.controller.subscribeMacroModeListener();
|
|
2411
|
+
}
|
|
2412
|
+
if (this.isActiveCamera) {
|
|
2413
|
+
void this.didChange();
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
removeMacroModeListener(listener) {
|
|
2417
|
+
if (!this.macroModeListeners.includes(listener)) {
|
|
2418
|
+
return;
|
|
2419
|
+
}
|
|
2420
|
+
this.macroModeListeners.splice(this.macroModeListeners.indexOf(listener), 1);
|
|
2421
|
+
this._hasMacroModeListeners = this.macroModeListeners.length > 0;
|
|
2422
|
+
if (this.macroModeListeners.length === 0) {
|
|
2423
|
+
void this.controller.unsubscribeMacroModeListener();
|
|
2424
|
+
}
|
|
2425
|
+
if (this.isActiveCamera) {
|
|
2426
|
+
void this.didChange();
|
|
2427
|
+
}
|
|
2428
|
+
}
|
|
2030
2429
|
applySettings(settings) {
|
|
2031
2430
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2032
2431
|
this.settings = settings;
|
|
@@ -2096,6 +2495,22 @@ class Camera extends DefaultSerializeable {
|
|
|
2096
2495
|
}
|
|
2097
2496
|
return Camera.atPosition(defaultPosition);
|
|
2098
2497
|
}
|
|
2498
|
+
static isMacroModeAvailable() {
|
|
2499
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2500
|
+
const proxy = FactoryMaker.getInstance('CoreProxy');
|
|
2501
|
+
if (!proxy) {
|
|
2502
|
+
return false;
|
|
2503
|
+
}
|
|
2504
|
+
const adapter = new CoreProxyAdapter(proxy);
|
|
2505
|
+
return yield adapter.isMacroModeAvailable();
|
|
2506
|
+
});
|
|
2507
|
+
}
|
|
2508
|
+
get position() {
|
|
2509
|
+
return this._position;
|
|
2510
|
+
}
|
|
2511
|
+
get isTorchAvailable() {
|
|
2512
|
+
return this.controller.getIsTorchAvailable();
|
|
2513
|
+
}
|
|
2099
2514
|
get desiredState() {
|
|
2100
2515
|
return this._desiredState;
|
|
2101
2516
|
}
|
|
@@ -2138,18 +2553,33 @@ __decorate([
|
|
|
2138
2553
|
__decorate([
|
|
2139
2554
|
serializationDefault({})
|
|
2140
2555
|
], Camera.prototype, "settings", void 0);
|
|
2556
|
+
__decorate([
|
|
2557
|
+
nameForSerialization('position')
|
|
2558
|
+
], Camera.prototype, "_position", void 0);
|
|
2141
2559
|
__decorate([
|
|
2142
2560
|
nameForSerialization('desiredTorchState')
|
|
2143
2561
|
], Camera.prototype, "_desiredTorchState", void 0);
|
|
2144
2562
|
__decorate([
|
|
2145
2563
|
nameForSerialization('desiredState')
|
|
2146
2564
|
], Camera.prototype, "_desiredState", void 0);
|
|
2565
|
+
__decorate([
|
|
2566
|
+
nameForSerialization('hasTorchStateListeners')
|
|
2567
|
+
], Camera.prototype, "_hasTorchStateListeners", void 0);
|
|
2568
|
+
__decorate([
|
|
2569
|
+
nameForSerialization('hasMacroModeListeners')
|
|
2570
|
+
], Camera.prototype, "_hasMacroModeListeners", void 0);
|
|
2147
2571
|
__decorate([
|
|
2148
2572
|
ignoreFromSerialization
|
|
2149
2573
|
], Camera.prototype, "currentCameraState", void 0);
|
|
2150
2574
|
__decorate([
|
|
2151
2575
|
ignoreFromSerialization
|
|
2152
2576
|
], Camera.prototype, "listeners", void 0);
|
|
2577
|
+
__decorate([
|
|
2578
|
+
ignoreFromSerialization
|
|
2579
|
+
], Camera.prototype, "torchListeners", void 0);
|
|
2580
|
+
__decorate([
|
|
2581
|
+
ignoreFromSerialization
|
|
2582
|
+
], Camera.prototype, "macroModeListeners", void 0);
|
|
2153
2583
|
__decorate([
|
|
2154
2584
|
ignoreFromSerialization
|
|
2155
2585
|
], Camera.prototype, "_context", void 0);
|
|
@@ -2466,6 +2896,14 @@ class CameraController extends BaseController {
|
|
|
2466
2896
|
this.handleDidChangeStateEventWrapper = (ev) => {
|
|
2467
2897
|
return this.handleDidChangeStateEvent(ev);
|
|
2468
2898
|
};
|
|
2899
|
+
// Arrow function wrapper to avoid .bind(this) and always use current class state
|
|
2900
|
+
this.handleDidChangeTorchToStateEventWrapper = (ev) => {
|
|
2901
|
+
return this.handleDidChangeTorchToStateEvent(ev);
|
|
2902
|
+
};
|
|
2903
|
+
// Arrow function wrapper to avoid .bind(this) and always use current class state
|
|
2904
|
+
this.handleDidChangeMacroModeEventWrapper = (ev) => {
|
|
2905
|
+
return this.handleDidChangeMacroModeEvent(ev);
|
|
2906
|
+
};
|
|
2469
2907
|
this.camera = camera;
|
|
2470
2908
|
this.adapter = new CoreProxyAdapter(this._proxy);
|
|
2471
2909
|
void this.subscribeListener();
|
|
@@ -2476,14 +2914,14 @@ class CameraController extends BaseController {
|
|
|
2476
2914
|
getCurrentState() {
|
|
2477
2915
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2478
2916
|
return yield this.adapter.getCameraState({
|
|
2479
|
-
cameraPosition: JSON.stringify(this.privateCamera.
|
|
2917
|
+
cameraPosition: JSON.stringify(this.privateCamera._position)
|
|
2480
2918
|
});
|
|
2481
2919
|
});
|
|
2482
2920
|
}
|
|
2483
2921
|
getIsTorchAvailable() {
|
|
2484
2922
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2485
2923
|
return yield this.adapter.isTorchAvailable({
|
|
2486
|
-
cameraPosition: JSON.stringify(this.privateCamera.
|
|
2924
|
+
cameraPosition: JSON.stringify(this.privateCamera._position)
|
|
2487
2925
|
});
|
|
2488
2926
|
});
|
|
2489
2927
|
}
|
|
@@ -2508,20 +2946,78 @@ class CameraController extends BaseController {
|
|
|
2508
2946
|
this._proxy.eventEmitter.off(FrameSourceListenerEvents.didChangeState, this.handleDidChangeStateEventWrapper);
|
|
2509
2947
|
});
|
|
2510
2948
|
}
|
|
2949
|
+
subscribeTorchListener() {
|
|
2950
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2951
|
+
yield this.adapter.registerTorchStateListener();
|
|
2952
|
+
this._proxy.subscribeForEvents([TorchListenerEvents.didChangeTorchToState]);
|
|
2953
|
+
this._proxy.eventEmitter.on(TorchListenerEvents.didChangeTorchToState, this.handleDidChangeTorchToStateEventWrapper);
|
|
2954
|
+
});
|
|
2955
|
+
}
|
|
2956
|
+
unsubscribeTorchListener() {
|
|
2957
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2958
|
+
yield this.adapter.unregisterTorchStateListener();
|
|
2959
|
+
this._proxy.unsubscribeFromEvents([TorchListenerEvents.didChangeTorchToState]);
|
|
2960
|
+
this._proxy.eventEmitter.off(TorchListenerEvents.didChangeTorchToState, this.handleDidChangeTorchToStateEventWrapper);
|
|
2961
|
+
});
|
|
2962
|
+
}
|
|
2963
|
+
subscribeMacroModeListener() {
|
|
2964
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2965
|
+
yield this.adapter.registerMacroModeListener();
|
|
2966
|
+
this._proxy.subscribeForEvents([MacroModeListenerEvents.didChangeMacroMode]);
|
|
2967
|
+
this._proxy.eventEmitter.on(MacroModeListenerEvents.didChangeMacroMode, this.handleDidChangeMacroModeEventWrapper);
|
|
2968
|
+
});
|
|
2969
|
+
}
|
|
2970
|
+
unsubscribeMacroModeListener() {
|
|
2971
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2972
|
+
yield this.adapter.unregisterMacroModeListener();
|
|
2973
|
+
this._proxy.unsubscribeFromEvents([MacroModeListenerEvents.didChangeMacroMode]);
|
|
2974
|
+
this._proxy.eventEmitter.off(MacroModeListenerEvents.didChangeMacroMode, this.handleDidChangeMacroModeEventWrapper);
|
|
2975
|
+
});
|
|
2976
|
+
}
|
|
2511
2977
|
dispose() {
|
|
2512
2978
|
void this.unsubscribeListener();
|
|
2979
|
+
void this.unsubscribeTorchListener();
|
|
2980
|
+
void this.unsubscribeMacroModeListener();
|
|
2513
2981
|
this._proxy.dispose();
|
|
2514
2982
|
}
|
|
2515
2983
|
handleDidChangeStateEvent(ev) {
|
|
2516
|
-
const event = EventDataParser.
|
|
2517
|
-
if (event) {
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2984
|
+
const event = EventDataParser.parseIfShouldHandle(ev, {});
|
|
2985
|
+
if (event === SKIP || event === null) {
|
|
2986
|
+
return;
|
|
2987
|
+
}
|
|
2988
|
+
if (event.cameraPosition !== this.privateCamera._position || !this.privateCamera.isActiveCamera) {
|
|
2989
|
+
return;
|
|
2990
|
+
}
|
|
2991
|
+
this.privateCamera.currentCameraState = event.state;
|
|
2992
|
+
this.privateCamera.listeners.forEach(listener => {
|
|
2993
|
+
var _a;
|
|
2994
|
+
(_a = listener === null || listener === void 0 ? void 0 : listener.didChangeState) === null || _a === void 0 ? void 0 : _a.call(listener, this.camera, this.privateCamera._desiredState);
|
|
2995
|
+
});
|
|
2996
|
+
}
|
|
2997
|
+
handleDidChangeTorchToStateEvent(ev) {
|
|
2998
|
+
const event = EventDataParser.parseIfShouldHandle(ev, {});
|
|
2999
|
+
if (event === SKIP || event === null) {
|
|
3000
|
+
return;
|
|
3001
|
+
}
|
|
3002
|
+
if (this.privateCamera.isActiveCamera) {
|
|
3003
|
+
const torchState = event.state;
|
|
3004
|
+
this.privateCamera.desiredTorchState = torchState;
|
|
3005
|
+
this.privateCamera.torchListeners.forEach(listener => {
|
|
2523
3006
|
var _a;
|
|
2524
|
-
(_a = listener === null || listener === void 0 ? void 0 : listener.
|
|
3007
|
+
(_a = listener === null || listener === void 0 ? void 0 : listener.didChangeTorchToState) === null || _a === void 0 ? void 0 : _a.call(listener, torchState);
|
|
3008
|
+
});
|
|
3009
|
+
}
|
|
3010
|
+
}
|
|
3011
|
+
handleDidChangeMacroModeEvent(ev) {
|
|
3012
|
+
const event = EventDataParser.parseIfShouldHandle(ev, {});
|
|
3013
|
+
if (event === SKIP || event === null) {
|
|
3014
|
+
return;
|
|
3015
|
+
}
|
|
3016
|
+
if (this.privateCamera.isActiveCamera) {
|
|
3017
|
+
const macroMode = event.macroMode;
|
|
3018
|
+
this.privateCamera.macroModeListeners.forEach(listener => {
|
|
3019
|
+
var _a;
|
|
3020
|
+
(_a = listener === null || listener === void 0 ? void 0 : listener.didChangeMacroMode) === null || _a === void 0 ? void 0 : _a.call(listener, macroMode);
|
|
2525
3021
|
});
|
|
2526
3022
|
}
|
|
2527
3023
|
}
|
|
@@ -2737,7 +3233,10 @@ class DataCaptureContextController extends BaseController {
|
|
|
2737
3233
|
});
|
|
2738
3234
|
}
|
|
2739
3235
|
handleDidChangeStatusEvent(eventPayload) {
|
|
2740
|
-
const event = EventDataParser.
|
|
3236
|
+
const event = EventDataParser.parseIfShouldHandle(eventPayload, {});
|
|
3237
|
+
if (event === SKIP) {
|
|
3238
|
+
return;
|
|
3239
|
+
}
|
|
2741
3240
|
if (event === null) {
|
|
2742
3241
|
console.error('DataCaptureContextController didChangeStatus payload is null');
|
|
2743
3242
|
return;
|
|
@@ -2994,11 +3493,23 @@ __decorate([
|
|
|
2994
3493
|
var DataCaptureViewEvents;
|
|
2995
3494
|
(function (DataCaptureViewEvents) {
|
|
2996
3495
|
DataCaptureViewEvents["didChangeSize"] = "DataCaptureViewListener.onSizeChanged";
|
|
3496
|
+
DataCaptureViewEvents["onFocusGesture"] = "FocusGestureListener.onFocusGesture";
|
|
2997
3497
|
})(DataCaptureViewEvents || (DataCaptureViewEvents = {}));
|
|
2998
3498
|
class DataCaptureViewController extends BaseController {
|
|
2999
3499
|
constructor(view) {
|
|
3000
3500
|
super('DataCaptureViewProxy');
|
|
3001
3501
|
this._listenerRegistered = false;
|
|
3502
|
+
this._focusGestureListenerRegistered = false;
|
|
3503
|
+
this._zoomGestureListenerRegistered = false;
|
|
3504
|
+
this.handleOnFocusGestureEventWrapper = (eventPayload) => {
|
|
3505
|
+
return this.handleOnFocusGestureEvent(eventPayload);
|
|
3506
|
+
};
|
|
3507
|
+
this.handleOnZoomInGestureEventWrapper = (eventPayload) => {
|
|
3508
|
+
return this.handleOnZoomInGestureEvent(eventPayload);
|
|
3509
|
+
};
|
|
3510
|
+
this.handleOnZoomOutGestureEventWrapper = (eventPayload) => {
|
|
3511
|
+
return this.handleOnZoomOutGestureEvent(eventPayload);
|
|
3512
|
+
};
|
|
3002
3513
|
// Arrow function wrapper to avoid .bind(this) and always use current class state
|
|
3003
3514
|
this.handleDidChangeSizeEventWrapper = (eventPayload) => {
|
|
3004
3515
|
return this.handleDidChangeSizeEvent(eventPayload);
|
|
@@ -3018,6 +3529,21 @@ class DataCaptureViewController extends BaseController {
|
|
|
3018
3529
|
return Quadrilateral['fromJSON'](JSON.parse(result));
|
|
3019
3530
|
});
|
|
3020
3531
|
}
|
|
3532
|
+
triggerFocus(point) {
|
|
3533
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3534
|
+
yield this.adapter.triggerFocus({ viewId: this.view.viewId, pointJson: JSON.stringify(point.toJSON()) });
|
|
3535
|
+
});
|
|
3536
|
+
}
|
|
3537
|
+
triggerZoomIn() {
|
|
3538
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3539
|
+
yield this.adapter.triggerZoomIn({ viewId: this.view.viewId });
|
|
3540
|
+
});
|
|
3541
|
+
}
|
|
3542
|
+
triggerZoomOut() {
|
|
3543
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3544
|
+
yield this.adapter.triggerZoomOut({ viewId: this.view.viewId });
|
|
3545
|
+
});
|
|
3546
|
+
}
|
|
3021
3547
|
setPositionAndSize(top, left, width, height, shouldBeUnderWebView) {
|
|
3022
3548
|
return this._proxy.$setDataCaptureViewPositionAndSize({ top, left, width, height, shouldBeUnderWebView });
|
|
3023
3549
|
}
|
|
@@ -3047,6 +3573,8 @@ class DataCaptureViewController extends BaseController {
|
|
|
3047
3573
|
}
|
|
3048
3574
|
dispose() {
|
|
3049
3575
|
void this.unsubscribeListener();
|
|
3576
|
+
void this.unsubscribeFocusGestureListener();
|
|
3577
|
+
void this.unsubscribeZoomGestureListener();
|
|
3050
3578
|
this._proxy.dispose();
|
|
3051
3579
|
}
|
|
3052
3580
|
subscribeListener() {
|
|
@@ -3071,16 +3599,168 @@ class DataCaptureViewController extends BaseController {
|
|
|
3071
3599
|
this._listenerRegistered = false;
|
|
3072
3600
|
});
|
|
3073
3601
|
}
|
|
3602
|
+
updateFocusGestureListenerSubscription(focusGesture, shouldSubscribe) {
|
|
3603
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3604
|
+
if (!focusGesture) {
|
|
3605
|
+
if (this._focusGestureListenerRegistered) {
|
|
3606
|
+
yield this.unsubscribeFocusGestureListener();
|
|
3607
|
+
}
|
|
3608
|
+
return;
|
|
3609
|
+
}
|
|
3610
|
+
const privateFocusGesture = focusGesture;
|
|
3611
|
+
const hasListeners = privateFocusGesture.listeners && privateFocusGesture.listeners.length > 0;
|
|
3612
|
+
if (shouldSubscribe && hasListeners && !this._focusGestureListenerRegistered) {
|
|
3613
|
+
yield this.subscribeFocusGestureListener();
|
|
3614
|
+
}
|
|
3615
|
+
else if (!hasListeners && this._focusGestureListenerRegistered) {
|
|
3616
|
+
yield this.unsubscribeFocusGestureListener();
|
|
3617
|
+
}
|
|
3618
|
+
});
|
|
3619
|
+
}
|
|
3620
|
+
subscribeFocusGestureListener() {
|
|
3621
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3622
|
+
if (this._focusGestureListenerRegistered || !this.isViewCreated()) {
|
|
3623
|
+
return;
|
|
3624
|
+
}
|
|
3625
|
+
yield this.adapter.registerFocusGestureListener({ viewId: this.view.viewId });
|
|
3626
|
+
this._proxy.subscribeForEvents([FocusGestureListenerEvents.onFocusGesture]);
|
|
3627
|
+
this._proxy.eventEmitter.on(FocusGestureListenerEvents.onFocusGesture, this.handleOnFocusGestureEventWrapper);
|
|
3628
|
+
this._focusGestureListenerRegistered = true;
|
|
3629
|
+
});
|
|
3630
|
+
}
|
|
3631
|
+
unsubscribeFocusGestureListener() {
|
|
3632
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3633
|
+
if (!this._focusGestureListenerRegistered) {
|
|
3634
|
+
return;
|
|
3635
|
+
}
|
|
3636
|
+
yield this.adapter.unregisterFocusGestureListener({ viewId: this.view.viewId });
|
|
3637
|
+
this._proxy.unsubscribeFromEvents([FocusGestureListenerEvents.onFocusGesture]);
|
|
3638
|
+
this._proxy.eventEmitter.off(FocusGestureListenerEvents.onFocusGesture, this.handleOnFocusGestureEventWrapper);
|
|
3639
|
+
this._focusGestureListenerRegistered = false;
|
|
3640
|
+
});
|
|
3641
|
+
}
|
|
3642
|
+
handleOnFocusGestureEvent(eventPayload) {
|
|
3643
|
+
const event = EventDataParser.parseIfShouldHandle(eventPayload, { viewId: this.view.viewId });
|
|
3644
|
+
if (event === SKIP) {
|
|
3645
|
+
return;
|
|
3646
|
+
}
|
|
3647
|
+
if (event === null) {
|
|
3648
|
+
console.error('DataCaptureViewController onFocusGesture payload is null');
|
|
3649
|
+
return;
|
|
3650
|
+
}
|
|
3651
|
+
const focusGesture = this.view.focusGesture;
|
|
3652
|
+
if (!focusGesture) {
|
|
3653
|
+
return;
|
|
3654
|
+
}
|
|
3655
|
+
const privateFocusGesture = focusGesture;
|
|
3656
|
+
if (!privateFocusGesture.listeners || privateFocusGesture.listeners.length === 0) {
|
|
3657
|
+
return;
|
|
3658
|
+
}
|
|
3659
|
+
const point = PointWithUnit['fromJSON'](event.point);
|
|
3660
|
+
privateFocusGesture.listeners.forEach(listener => {
|
|
3661
|
+
if (listener.didFocusGesture) {
|
|
3662
|
+
listener.didFocusGesture(focusGesture, point);
|
|
3663
|
+
}
|
|
3664
|
+
});
|
|
3665
|
+
}
|
|
3666
|
+
updateZoomGestureListenerSubscription(zoomGesture, shouldSubscribe) {
|
|
3667
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3668
|
+
if (!zoomGesture) {
|
|
3669
|
+
if (this._zoomGestureListenerRegistered) {
|
|
3670
|
+
yield this.unsubscribeZoomGestureListener();
|
|
3671
|
+
}
|
|
3672
|
+
return;
|
|
3673
|
+
}
|
|
3674
|
+
const privateZoomGesture = zoomGesture;
|
|
3675
|
+
const hasListeners = privateZoomGesture.listeners && privateZoomGesture.listeners.length > 0;
|
|
3676
|
+
if (shouldSubscribe && hasListeners && !this._zoomGestureListenerRegistered) {
|
|
3677
|
+
yield this.subscribeZoomGestureListener();
|
|
3678
|
+
}
|
|
3679
|
+
else if (!hasListeners && this._zoomGestureListenerRegistered) {
|
|
3680
|
+
yield this.unsubscribeZoomGestureListener();
|
|
3681
|
+
}
|
|
3682
|
+
});
|
|
3683
|
+
}
|
|
3684
|
+
subscribeZoomGestureListener() {
|
|
3685
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3686
|
+
if (this._zoomGestureListenerRegistered || !this.isViewCreated()) {
|
|
3687
|
+
return;
|
|
3688
|
+
}
|
|
3689
|
+
yield this.adapter.registerZoomGestureListener({ viewId: this.view.viewId });
|
|
3690
|
+
this._proxy.subscribeForEvents([ZoomGestureListenerEvents.onZoomInGesture, ZoomGestureListenerEvents.onZoomOutGesture]);
|
|
3691
|
+
this._proxy.eventEmitter.on(ZoomGestureListenerEvents.onZoomInGesture, this.handleOnZoomInGestureEventWrapper);
|
|
3692
|
+
this._proxy.eventEmitter.on(ZoomGestureListenerEvents.onZoomOutGesture, this.handleOnZoomOutGestureEventWrapper);
|
|
3693
|
+
this._zoomGestureListenerRegistered = true;
|
|
3694
|
+
});
|
|
3695
|
+
}
|
|
3696
|
+
unsubscribeZoomGestureListener() {
|
|
3697
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3698
|
+
if (!this._zoomGestureListenerRegistered) {
|
|
3699
|
+
return;
|
|
3700
|
+
}
|
|
3701
|
+
yield this.adapter.unregisterZoomGestureListener({ viewId: this.view.viewId });
|
|
3702
|
+
this._proxy.unsubscribeFromEvents([ZoomGestureListenerEvents.onZoomInGesture, ZoomGestureListenerEvents.onZoomOutGesture]);
|
|
3703
|
+
this._proxy.eventEmitter.off(ZoomGestureListenerEvents.onZoomInGesture, this.handleOnZoomInGestureEventWrapper);
|
|
3704
|
+
this._proxy.eventEmitter.off(ZoomGestureListenerEvents.onZoomOutGesture, this.handleOnZoomOutGestureEventWrapper);
|
|
3705
|
+
this._zoomGestureListenerRegistered = false;
|
|
3706
|
+
});
|
|
3707
|
+
}
|
|
3708
|
+
handleOnZoomInGestureEvent(eventPayload) {
|
|
3709
|
+
const event = EventDataParser.parseIfShouldHandle(eventPayload, { viewId: this.view.viewId });
|
|
3710
|
+
if (event === SKIP) {
|
|
3711
|
+
return;
|
|
3712
|
+
}
|
|
3713
|
+
if (event === null) {
|
|
3714
|
+
console.error('DataCaptureViewController onZoomInGesture payload is null');
|
|
3715
|
+
return;
|
|
3716
|
+
}
|
|
3717
|
+
const zoomGesture = this.view.zoomGesture;
|
|
3718
|
+
if (!zoomGesture) {
|
|
3719
|
+
return;
|
|
3720
|
+
}
|
|
3721
|
+
const privateZoomGesture = zoomGesture;
|
|
3722
|
+
if (!privateZoomGesture.listeners || privateZoomGesture.listeners.length === 0) {
|
|
3723
|
+
return;
|
|
3724
|
+
}
|
|
3725
|
+
privateZoomGesture.listeners.forEach(listener => {
|
|
3726
|
+
if (listener.didZoomInGesture) {
|
|
3727
|
+
listener.didZoomInGesture(zoomGesture);
|
|
3728
|
+
}
|
|
3729
|
+
});
|
|
3730
|
+
}
|
|
3731
|
+
handleOnZoomOutGestureEvent(eventPayload) {
|
|
3732
|
+
const event = EventDataParser.parseIfShouldHandle(eventPayload, { viewId: this.view.viewId });
|
|
3733
|
+
if (event === SKIP) {
|
|
3734
|
+
return;
|
|
3735
|
+
}
|
|
3736
|
+
if (event === null) {
|
|
3737
|
+
console.error('DataCaptureViewController onZoomOutGesture payload is null');
|
|
3738
|
+
return;
|
|
3739
|
+
}
|
|
3740
|
+
const zoomGesture = this.view.zoomGesture;
|
|
3741
|
+
if (!zoomGesture) {
|
|
3742
|
+
return;
|
|
3743
|
+
}
|
|
3744
|
+
const privateZoomGesture = zoomGesture;
|
|
3745
|
+
if (!privateZoomGesture.listeners || privateZoomGesture.listeners.length === 0) {
|
|
3746
|
+
return;
|
|
3747
|
+
}
|
|
3748
|
+
privateZoomGesture.listeners.forEach(listener => {
|
|
3749
|
+
if (listener.didZoomOutGesture) {
|
|
3750
|
+
listener.didZoomOutGesture(zoomGesture);
|
|
3751
|
+
}
|
|
3752
|
+
});
|
|
3753
|
+
}
|
|
3074
3754
|
createView() {
|
|
3075
3755
|
return this._proxy.$createDataCaptureView({ viewJson: JSON.stringify(this.view.toJSON()) });
|
|
3076
3756
|
}
|
|
3077
3757
|
handleDidChangeSizeEvent(eventPayload) {
|
|
3078
|
-
const event = EventDataParser.
|
|
3079
|
-
if (event ===
|
|
3080
|
-
console.error('DataCaptureViewController didChangeSize payload is null');
|
|
3758
|
+
const event = EventDataParser.parseIfShouldHandle(eventPayload, { viewId: this.view.viewId });
|
|
3759
|
+
if (event === SKIP) {
|
|
3081
3760
|
return;
|
|
3082
3761
|
}
|
|
3083
|
-
if (event
|
|
3762
|
+
if (event === null) {
|
|
3763
|
+
console.error('DataCaptureViewController didChangeSize payload is null');
|
|
3084
3764
|
return;
|
|
3085
3765
|
}
|
|
3086
3766
|
const size = Size['fromJSON'](event.size);
|
|
@@ -3152,14 +3832,42 @@ class BaseDataCaptureView extends DefaultSerializeable {
|
|
|
3152
3832
|
return this._focusGesture;
|
|
3153
3833
|
}
|
|
3154
3834
|
set focusGesture(newValue) {
|
|
3835
|
+
if (this._focusGesture) {
|
|
3836
|
+
const privateFocusGesture = this._focusGesture;
|
|
3837
|
+
privateFocusGesture.onListenersChanged = undefined;
|
|
3838
|
+
privateFocusGesture._controller = null;
|
|
3839
|
+
void this.controller.updateFocusGestureListenerSubscription(this._focusGesture, false);
|
|
3840
|
+
}
|
|
3155
3841
|
this._focusGesture = newValue;
|
|
3842
|
+
if (newValue) {
|
|
3843
|
+
const privateFocusGesture = newValue;
|
|
3844
|
+
privateFocusGesture._controller = this.controller;
|
|
3845
|
+
privateFocusGesture.onListenersChanged = () => {
|
|
3846
|
+
void this.controller.updateFocusGestureListenerSubscription(newValue, true);
|
|
3847
|
+
};
|
|
3848
|
+
void this.controller.updateFocusGestureListenerSubscription(newValue, true);
|
|
3849
|
+
}
|
|
3156
3850
|
void this.controller.updateView();
|
|
3157
3851
|
}
|
|
3158
3852
|
get zoomGesture() {
|
|
3159
3853
|
return this._zoomGesture;
|
|
3160
3854
|
}
|
|
3161
3855
|
set zoomGesture(newValue) {
|
|
3856
|
+
if (this._zoomGesture) {
|
|
3857
|
+
const privateZoomGesture = this._zoomGesture;
|
|
3858
|
+
privateZoomGesture.onListenersChanged = undefined;
|
|
3859
|
+
privateZoomGesture._controller = null;
|
|
3860
|
+
void this.controller.updateZoomGestureListenerSubscription(this._zoomGesture, false);
|
|
3861
|
+
}
|
|
3162
3862
|
this._zoomGesture = newValue;
|
|
3863
|
+
if (newValue) {
|
|
3864
|
+
const privateZoomGesture = newValue;
|
|
3865
|
+
privateZoomGesture._controller = this.controller;
|
|
3866
|
+
privateZoomGesture.onListenersChanged = () => {
|
|
3867
|
+
void this.controller.updateZoomGestureListenerSubscription(newValue, true);
|
|
3868
|
+
};
|
|
3869
|
+
void this.controller.updateZoomGestureListenerSubscription(newValue, true);
|
|
3870
|
+
}
|
|
3163
3871
|
void this.controller.updateView();
|
|
3164
3872
|
}
|
|
3165
3873
|
get logoStyle() {
|
|
@@ -3169,6 +3877,13 @@ class BaseDataCaptureView extends DefaultSerializeable {
|
|
|
3169
3877
|
this._logoStyle = newValue;
|
|
3170
3878
|
void this.controller.updateView();
|
|
3171
3879
|
}
|
|
3880
|
+
get shouldShowZoomNotification() {
|
|
3881
|
+
return this._shouldShowZoomNotification;
|
|
3882
|
+
}
|
|
3883
|
+
set shouldShowZoomNotification(newValue) {
|
|
3884
|
+
this._shouldShowZoomNotification = newValue;
|
|
3885
|
+
void this.controller.updateView();
|
|
3886
|
+
}
|
|
3172
3887
|
get privateContext() {
|
|
3173
3888
|
return this.context;
|
|
3174
3889
|
}
|
|
@@ -3178,6 +3893,7 @@ class BaseDataCaptureView extends DefaultSerializeable {
|
|
|
3178
3893
|
return view;
|
|
3179
3894
|
}
|
|
3180
3895
|
constructor(context) {
|
|
3896
|
+
var _a;
|
|
3181
3897
|
super();
|
|
3182
3898
|
this.parentId = null;
|
|
3183
3899
|
this.overlays = [];
|
|
@@ -3194,6 +3910,7 @@ class BaseDataCaptureView extends DefaultSerializeable {
|
|
|
3194
3910
|
this._focusGesture = this.coreDefaults.DataCaptureView.focusGesture;
|
|
3195
3911
|
this._zoomGesture = this.coreDefaults.DataCaptureView.zoomGesture;
|
|
3196
3912
|
this._logoStyle = this.coreDefaults.DataCaptureView.logoStyle;
|
|
3913
|
+
this._shouldShowZoomNotification = (_a = this.coreDefaults.DataCaptureView.shouldShowZoomNotification) !== null && _a !== void 0 ? _a : true;
|
|
3197
3914
|
this.controller = new DataCaptureViewController(this);
|
|
3198
3915
|
}
|
|
3199
3916
|
addOverlay(overlay) {
|
|
@@ -3243,6 +3960,15 @@ class BaseDataCaptureView extends DefaultSerializeable {
|
|
|
3243
3960
|
viewQuadrilateralForFrameQuadrilateral(quadrilateral) {
|
|
3244
3961
|
return this.controller.viewQuadrilateralForFrameQuadrilateral(quadrilateral);
|
|
3245
3962
|
}
|
|
3963
|
+
triggerFocus(point) {
|
|
3964
|
+
return this.controller.triggerFocus(point);
|
|
3965
|
+
}
|
|
3966
|
+
triggerZoomIn() {
|
|
3967
|
+
return this.controller.triggerZoomIn();
|
|
3968
|
+
}
|
|
3969
|
+
triggerZoomOut() {
|
|
3970
|
+
return this.controller.triggerZoomOut();
|
|
3971
|
+
}
|
|
3246
3972
|
addControl(control) {
|
|
3247
3973
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3248
3974
|
if (!this.controls.includes(control)) {
|
|
@@ -3326,6 +4052,10 @@ class BaseDataCaptureView extends DefaultSerializeable {
|
|
|
3326
4052
|
}
|
|
3327
4053
|
return this.controller.hide();
|
|
3328
4054
|
}
|
|
4055
|
+
setProperty(name, value) {
|
|
4056
|
+
this[name] = value;
|
|
4057
|
+
void this.controller.updateView();
|
|
4058
|
+
}
|
|
3329
4059
|
}
|
|
3330
4060
|
__decorate([
|
|
3331
4061
|
ignoreFromSerialization
|
|
@@ -3367,6 +4097,9 @@ __decorate([
|
|
|
3367
4097
|
__decorate([
|
|
3368
4098
|
nameForSerialization('logoStyle')
|
|
3369
4099
|
], BaseDataCaptureView.prototype, "_logoStyle", void 0);
|
|
4100
|
+
__decorate([
|
|
4101
|
+
nameForSerialization('shouldShowZoomNotification')
|
|
4102
|
+
], BaseDataCaptureView.prototype, "_shouldShowZoomNotification", void 0);
|
|
3370
4103
|
__decorate([
|
|
3371
4104
|
ignoreFromSerialization
|
|
3372
4105
|
], BaseDataCaptureView.prototype, "controller", void 0);
|
|
@@ -3376,7 +4109,7 @@ __decorate([
|
|
|
3376
4109
|
|
|
3377
4110
|
class ZoomSwitchControl extends DefaultSerializeable {
|
|
3378
4111
|
constructor() {
|
|
3379
|
-
super(
|
|
4112
|
+
super();
|
|
3380
4113
|
this.type = 'zoom';
|
|
3381
4114
|
this.icon = {
|
|
3382
4115
|
zoomedOut: { default: null, pressed: null },
|
|
@@ -3385,6 +4118,12 @@ class ZoomSwitchControl extends DefaultSerializeable {
|
|
|
3385
4118
|
this.view = null;
|
|
3386
4119
|
this.anchor = null;
|
|
3387
4120
|
this.offset = null;
|
|
4121
|
+
this.contentDescriptionWhenZoomedOut = null;
|
|
4122
|
+
this.contentDescriptionWhenZoomedIn = null;
|
|
4123
|
+
this.accessibilityLabelWhenZoomedOut = null;
|
|
4124
|
+
this.accessibilityLabelWhenZoomedIn = null;
|
|
4125
|
+
this.accessibilityHintWhenZoomedOut = null;
|
|
4126
|
+
this.accessibilityHintWhenZoomedIn = null;
|
|
3388
4127
|
}
|
|
3389
4128
|
get zoomedOutImage() {
|
|
3390
4129
|
var _a, _b;
|
|
@@ -3461,7 +4200,7 @@ __decorate([
|
|
|
3461
4200
|
|
|
3462
4201
|
class TorchSwitchControl extends DefaultSerializeable {
|
|
3463
4202
|
constructor() {
|
|
3464
|
-
super(
|
|
4203
|
+
super();
|
|
3465
4204
|
this.type = 'torch';
|
|
3466
4205
|
this.icon = {
|
|
3467
4206
|
on: { default: null, pressed: null },
|
|
@@ -3470,6 +4209,10 @@ class TorchSwitchControl extends DefaultSerializeable {
|
|
|
3470
4209
|
this.view = null;
|
|
3471
4210
|
this.anchor = null;
|
|
3472
4211
|
this.offset = null;
|
|
4212
|
+
this.accessibilityLabelWhenOff = null;
|
|
4213
|
+
this.accessibilityHintWhenOff = null;
|
|
4214
|
+
this.accessibilityLabelWhenOn = null;
|
|
4215
|
+
this.accessibilityHintWhenOn = null;
|
|
3473
4216
|
}
|
|
3474
4217
|
get torchOffImage() {
|
|
3475
4218
|
var _a, _b;
|
|
@@ -3551,6 +4294,18 @@ class TorchSwitchControl extends DefaultSerializeable {
|
|
|
3551
4294
|
__decorate([
|
|
3552
4295
|
ignoreFromSerialization
|
|
3553
4296
|
], TorchSwitchControl.prototype, "view", void 0);
|
|
4297
|
+
__decorate([
|
|
4298
|
+
nameForSerialization('accessibilityLabelWhenOff')
|
|
4299
|
+
], TorchSwitchControl.prototype, "accessibilityLabelWhenOff", void 0);
|
|
4300
|
+
__decorate([
|
|
4301
|
+
nameForSerialization('accessibilityHintWhenOff')
|
|
4302
|
+
], TorchSwitchControl.prototype, "accessibilityHintWhenOff", void 0);
|
|
4303
|
+
__decorate([
|
|
4304
|
+
nameForSerialization('accessibilityLabelWhenOn')
|
|
4305
|
+
], TorchSwitchControl.prototype, "accessibilityLabelWhenOn", void 0);
|
|
4306
|
+
__decorate([
|
|
4307
|
+
nameForSerialization('accessibilityHintWhenOn')
|
|
4308
|
+
], TorchSwitchControl.prototype, "accessibilityHintWhenOn", void 0);
|
|
3554
4309
|
|
|
3555
4310
|
var VideoResolution;
|
|
3556
4311
|
(function (VideoResolution) {
|
|
@@ -3605,13 +4360,19 @@ class CameraSettings extends DefaultSerializeable {
|
|
|
3605
4360
|
this.focus.shouldPreferSmoothAutoFocus = newShouldPreferSmoothAutoFocus;
|
|
3606
4361
|
}
|
|
3607
4362
|
static fromJSON(json) {
|
|
4363
|
+
var _a, _b, _c;
|
|
3608
4364
|
const settings = new CameraSettings();
|
|
3609
4365
|
settings.preferredResolution = json.preferredResolution;
|
|
3610
4366
|
settings.zoomFactor = json.zoomFactor;
|
|
3611
|
-
settings.focusRange = json.focusRange;
|
|
3612
4367
|
settings.zoomGestureZoomFactor = json.zoomGestureZoomFactor;
|
|
4368
|
+
settings.macroMode = ((_a = json.macroMode) !== null && _a !== void 0 ? _a : CameraSettings.coreDefaults.Camera.Settings.macroMode);
|
|
4369
|
+
settings.adaptiveExposure = (_b = json.adaptiveExposure) !== null && _b !== void 0 ? _b : CameraSettings.coreDefaults.Camera.Settings.adaptiveExposure;
|
|
4370
|
+
settings.torchLevel = (_c = json.torchLevel) !== null && _c !== void 0 ? _c : CameraSettings.coreDefaults.Camera.Settings.torchLevel;
|
|
4371
|
+
settings.focusRange = json.focusRange;
|
|
3613
4372
|
settings.focusGestureStrategy = json.focusGestureStrategy;
|
|
3614
4373
|
settings.shouldPreferSmoothAutoFocus = json.shouldPreferSmoothAutoFocus;
|
|
4374
|
+
// manualLensPosition, focusStrategy (and on iOS: range) arrive in the properties bag
|
|
4375
|
+
// and are routed to the focus bag by setProperty via focusHiddenProperties
|
|
3615
4376
|
if (json.properties !== undefined) {
|
|
3616
4377
|
for (const key of Object.keys(json.properties)) {
|
|
3617
4378
|
settings.setProperty(key, json.properties[key]);
|
|
@@ -3620,11 +4381,14 @@ class CameraSettings extends DefaultSerializeable {
|
|
|
3620
4381
|
return settings;
|
|
3621
4382
|
}
|
|
3622
4383
|
constructor(settings) {
|
|
3623
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4384
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
3624
4385
|
super();
|
|
3625
4386
|
this.preferredResolution = CameraSettings.coreDefaults.Camera.Settings.preferredResolution;
|
|
3626
4387
|
this.zoomFactor = CameraSettings.coreDefaults.Camera.Settings.zoomFactor;
|
|
3627
4388
|
this.zoomGestureZoomFactor = CameraSettings.coreDefaults.Camera.Settings.zoomGestureZoomFactor;
|
|
4389
|
+
this.torchLevel = CameraSettings.coreDefaults.Camera.Settings.torchLevel;
|
|
4390
|
+
this.macroMode = CameraSettings.coreDefaults.Camera.Settings.macroMode;
|
|
4391
|
+
this.adaptiveExposure = CameraSettings.coreDefaults.Camera.Settings.adaptiveExposure;
|
|
3628
4392
|
this.focusHiddenProperties = [
|
|
3629
4393
|
'range',
|
|
3630
4394
|
'manualLensPosition',
|
|
@@ -3635,15 +4399,22 @@ class CameraSettings extends DefaultSerializeable {
|
|
|
3635
4399
|
this.focus = {
|
|
3636
4400
|
range: CameraSettings.coreDefaults.Camera.Settings.focusRange,
|
|
3637
4401
|
focusGestureStrategy: CameraSettings.coreDefaults.Camera.Settings.focusGestureStrategy,
|
|
3638
|
-
shouldPreferSmoothAutoFocus: CameraSettings.coreDefaults.Camera.Settings.shouldPreferSmoothAutoFocus
|
|
4402
|
+
shouldPreferSmoothAutoFocus: CameraSettings.coreDefaults.Camera.Settings.shouldPreferSmoothAutoFocus,
|
|
4403
|
+
manualLensPosition: CameraSettings.coreDefaults.Camera.Settings.manualLensPosition,
|
|
4404
|
+
focusStrategy: CameraSettings.coreDefaults.Camera.Settings.focusStrategy,
|
|
3639
4405
|
};
|
|
3640
4406
|
this.preferredResolution = (_a = settings === null || settings === void 0 ? void 0 : settings.preferredResolution) !== null && _a !== void 0 ? _a : CameraSettings.coreDefaults.Camera.Settings.preferredResolution;
|
|
3641
4407
|
this.zoomFactor = (_b = settings === null || settings === void 0 ? void 0 : settings.zoomFactor) !== null && _b !== void 0 ? _b : CameraSettings.coreDefaults.Camera.Settings.zoomFactor;
|
|
3642
4408
|
this.zoomGestureZoomFactor = (_c = settings === null || settings === void 0 ? void 0 : settings.zoomGestureZoomFactor) !== null && _c !== void 0 ? _c : CameraSettings.coreDefaults.Camera.Settings.zoomGestureZoomFactor;
|
|
4409
|
+
this.torchLevel = (_d = settings === null || settings === void 0 ? void 0 : settings.torchLevel) !== null && _d !== void 0 ? _d : CameraSettings.coreDefaults.Camera.Settings.torchLevel;
|
|
4410
|
+
this.macroMode = (_e = settings === null || settings === void 0 ? void 0 : settings.macroMode) !== null && _e !== void 0 ? _e : CameraSettings.coreDefaults.Camera.Settings.macroMode;
|
|
4411
|
+
this.adaptiveExposure = (_f = settings === null || settings === void 0 ? void 0 : settings.adaptiveExposure) !== null && _f !== void 0 ? _f : CameraSettings.coreDefaults.Camera.Settings.adaptiveExposure;
|
|
3643
4412
|
this.focus = {
|
|
3644
|
-
range: (
|
|
3645
|
-
focusGestureStrategy: (
|
|
3646
|
-
shouldPreferSmoothAutoFocus: (
|
|
4413
|
+
range: (_g = settings === null || settings === void 0 ? void 0 : settings.focusRange) !== null && _g !== void 0 ? _g : CameraSettings.coreDefaults.Camera.Settings.focusRange,
|
|
4414
|
+
focusGestureStrategy: (_h = settings === null || settings === void 0 ? void 0 : settings.focusGestureStrategy) !== null && _h !== void 0 ? _h : CameraSettings.coreDefaults.Camera.Settings.focusGestureStrategy,
|
|
4415
|
+
shouldPreferSmoothAutoFocus: (_j = settings === null || settings === void 0 ? void 0 : settings.shouldPreferSmoothAutoFocus) !== null && _j !== void 0 ? _j : CameraSettings.coreDefaults.Camera.Settings.shouldPreferSmoothAutoFocus,
|
|
4416
|
+
manualLensPosition: (_k = settings === null || settings === void 0 ? void 0 : settings.focus) === null || _k === void 0 ? void 0 : _k.manualLensPosition,
|
|
4417
|
+
focusStrategy: (_l = settings === null || settings === void 0 ? void 0 : settings.focus) === null || _l === void 0 ? void 0 : _l.focusStrategy,
|
|
3647
4418
|
};
|
|
3648
4419
|
if (settings !== undefined && settings !== null) {
|
|
3649
4420
|
Object.getOwnPropertyNames(settings).forEach(propertyName => {
|
|
@@ -3665,10 +4436,26 @@ class CameraSettings extends DefaultSerializeable {
|
|
|
3665
4436
|
return this[name];
|
|
3666
4437
|
}
|
|
3667
4438
|
}
|
|
4439
|
+
__decorate([
|
|
4440
|
+
nameForSerialization('torchLevel')
|
|
4441
|
+
], CameraSettings.prototype, "torchLevel", void 0);
|
|
4442
|
+
__decorate([
|
|
4443
|
+
nameForSerialization('macroMode')
|
|
4444
|
+
], CameraSettings.prototype, "macroMode", void 0);
|
|
4445
|
+
__decorate([
|
|
4446
|
+
nameForSerialization('adaptiveExposure')
|
|
4447
|
+
], CameraSettings.prototype, "adaptiveExposure", void 0);
|
|
3668
4448
|
__decorate([
|
|
3669
4449
|
ignoreFromSerialization
|
|
3670
4450
|
], CameraSettings.prototype, "focusHiddenProperties", void 0);
|
|
3671
4451
|
|
|
4452
|
+
var MacroMode;
|
|
4453
|
+
(function (MacroMode) {
|
|
4454
|
+
MacroMode["Auto"] = "auto";
|
|
4455
|
+
MacroMode["Off"] = "off";
|
|
4456
|
+
MacroMode["On"] = "on";
|
|
4457
|
+
})(MacroMode || (MacroMode = {}));
|
|
4458
|
+
|
|
3672
4459
|
const NoViewfinder = { type: 'none' };
|
|
3673
4460
|
|
|
3674
4461
|
class RectangularViewfinderAnimation extends DefaultSerializeable {
|
|
@@ -3833,6 +4620,7 @@ class LaserlineViewfinder extends DefaultSerializeable {
|
|
|
3833
4620
|
}
|
|
3834
4621
|
|
|
3835
4622
|
function parseDefaults(jsonDefaults) {
|
|
4623
|
+
var _a, _b, _c, _d, _e;
|
|
3836
4624
|
const coreDefaults = {
|
|
3837
4625
|
Camera: {
|
|
3838
4626
|
Settings: {
|
|
@@ -3842,6 +4630,11 @@ function parseDefaults(jsonDefaults) {
|
|
|
3842
4630
|
zoomGestureZoomFactor: jsonDefaults.Camera.Settings.zoomGestureZoomFactor,
|
|
3843
4631
|
focusGestureStrategy: jsonDefaults.Camera.Settings.focusGestureStrategy,
|
|
3844
4632
|
shouldPreferSmoothAutoFocus: jsonDefaults.Camera.Settings.shouldPreferSmoothAutoFocus,
|
|
4633
|
+
torchLevel: (_a = jsonDefaults.Camera.Settings.torchLevel) !== null && _a !== void 0 ? _a : 1.0,
|
|
4634
|
+
macroMode: ((_b = jsonDefaults.Camera.Settings.macroMode) !== null && _b !== void 0 ? _b : 'auto'),
|
|
4635
|
+
adaptiveExposure: (_c = jsonDefaults.Camera.Settings.adaptiveExposure) !== null && _c !== void 0 ? _c : false,
|
|
4636
|
+
manualLensPosition: (_d = jsonDefaults.Camera.Settings.manualLensPosition) !== null && _d !== void 0 ? _d : 0,
|
|
4637
|
+
focusStrategy: (_e = jsonDefaults.Camera.Settings.focusStrategy) !== null && _e !== void 0 ? _e : 'auto',
|
|
3845
4638
|
properties: jsonDefaults.Camera.Settings.properties,
|
|
3846
4639
|
},
|
|
3847
4640
|
defaultPosition: (jsonDefaults.Camera.defaultPosition || null),
|
|
@@ -3855,6 +4648,7 @@ function parseDefaults(jsonDefaults) {
|
|
|
3855
4648
|
focusGesture: PrivateFocusGestureDeserializer['fromJSON'](JSON.parse(jsonDefaults.DataCaptureView.focusGesture)),
|
|
3856
4649
|
zoomGesture: PrivateZoomGestureDeserializer['fromJSON'](JSON.parse(jsonDefaults.DataCaptureView.zoomGesture)),
|
|
3857
4650
|
logoStyle: jsonDefaults.DataCaptureView.logoStyle,
|
|
4651
|
+
shouldShowZoomNotification: jsonDefaults.DataCaptureView.shouldShowZoomNotification,
|
|
3858
4652
|
},
|
|
3859
4653
|
RectangularViewfinder: Object
|
|
3860
4654
|
.keys(jsonDefaults.RectangularViewfinder.styles)
|
|
@@ -4298,5 +5092,13 @@ function generateIdentifier() {
|
|
|
4298
5092
|
});
|
|
4299
5093
|
}
|
|
4300
5094
|
|
|
4301
|
-
|
|
5095
|
+
var ClusteringMode;
|
|
5096
|
+
(function (ClusteringMode) {
|
|
5097
|
+
ClusteringMode["Disabled"] = "disabled";
|
|
5098
|
+
ClusteringMode["Manual"] = "manual";
|
|
5099
|
+
ClusteringMode["Auto"] = "auto";
|
|
5100
|
+
ClusteringMode["AutoWithManualCorrection"] = "autoWithManualCorrection";
|
|
5101
|
+
})(ClusteringMode || (ClusteringMode = {}));
|
|
5102
|
+
|
|
5103
|
+
export { AimerViewfinder, Anchor, BaseController, BaseDataCaptureView, Brush, CORE_PROXY_TYPE_NAMES, Camera, CameraController, CameraOwnershipHelper, CameraOwnershipManager, CameraPosition, CameraSettings, ClusteringMode, Color, ContextStatus, ControlImage, CoreProxyAdapter, DataCaptureContext, DataCaptureContextEvents, DataCaptureContextSettings, DataCaptureViewController, DataCaptureViewEvents, DefaultSerializeable, Direction, EventDataParser, EventEmitter, Expiration, FactoryMaker, Feedback, FocusGestureListenerEvents, FocusGestureStrategy, FocusRange, FontFamily, FrameDataController, FrameDataSettings, FrameDataSettingsBuilder, FrameSourceListenerEvents, FrameSourceState, HTMLElementState, HtmlElementPosition, HtmlElementSize, ImageBuffer, ImageFrameSource, LaserlineViewfinder, LicenseInfo, LogoStyle, MacroMode, MacroModeListenerEvents, MarginsWithUnit, MeasureUnit, NativeProxy, NoViewfinder, NoneLocationSelection, NumberWithUnit, Observable, OpenSourceSoftwareLicenseInfo, Orientation, Point, PointWithUnit, PrivateFocusGestureDeserializer, PrivateFrameData, PrivateZoomGestureDeserializer, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, SKIP, ScanIntention, ScanditIcon, ScanditIconBuilder, ScanditIconShape, ScanditIconType, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, SizingMode, Sound, SwipeToZoom, TapToFocus, TextAlignment, TorchListenerEvents, TorchState, TorchSwitchControl, Vibration, VibrationType, VideoResolution, WaveFormVibration, ZoomGestureListenerEvents, ZoomSwitchControl, createNativeProxy, ensureCoreDefaults, generateIdentifier, getCoreDefaults, ignoreFromSerialization, ignoreFromSerializationIfNull, loadCoreDefaults, nameForSerialization, registerCoreProxies, registerProxies, serializationDefault, setCoreDefaultsLoader };
|
|
4302
5104
|
//# sourceMappingURL=index.js.map
|