@maro-tech/form 0.1.7 → 0.1.8
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.
|
@@ -219,6 +219,7 @@ class InputBarcodeControlComponent {
|
|
|
219
219
|
cameraStream = null;
|
|
220
220
|
scanLoopId = null;
|
|
221
221
|
autoOpenQueued = false;
|
|
222
|
+
autoOpenAttempted = false;
|
|
222
223
|
openToken = 0;
|
|
223
224
|
ngOnChanges(changes) {
|
|
224
225
|
if (changes['disabled']?.currentValue === true) {
|
|
@@ -245,6 +246,10 @@ class InputBarcodeControlComponent {
|
|
|
245
246
|
if (this.disabled() || this.isCameraStarting() || this.isCameraOpen()) {
|
|
246
247
|
return;
|
|
247
248
|
}
|
|
249
|
+
// The value emitted by a successful scan updates the parent form and
|
|
250
|
+
// triggers ngOnChanges. Do not treat that value update as a request to
|
|
251
|
+
// start the camera again after it has already been opened once.
|
|
252
|
+
this.autoOpenAttempted = true;
|
|
248
253
|
this.cameraError.set('');
|
|
249
254
|
this.cameraStatus.set('Запускаємо камеру…');
|
|
250
255
|
this.isCameraStarting.set(true);
|
|
@@ -297,13 +302,13 @@ class InputBarcodeControlComponent {
|
|
|
297
302
|
this.stopCamera();
|
|
298
303
|
}
|
|
299
304
|
scheduleAutoOpen() {
|
|
300
|
-
if (typeof window === 'undefined' || this.disabled() || this.isCameraOpen() || this.isCameraStarting() || this.autoOpenQueued) {
|
|
305
|
+
if (typeof window === 'undefined' || this.disabled() || this.autoOpenAttempted || this.isCameraOpen() || this.isCameraStarting() || this.autoOpenQueued) {
|
|
301
306
|
return;
|
|
302
307
|
}
|
|
303
308
|
this.autoOpenQueued = true;
|
|
304
309
|
window.requestAnimationFrame(() => {
|
|
305
310
|
this.autoOpenQueued = false;
|
|
306
|
-
if (this.disabled() || this.isCameraOpen() || this.isCameraStarting()) {
|
|
311
|
+
if (this.disabled() || this.autoOpenAttempted || this.isCameraOpen() || this.isCameraStarting()) {
|
|
307
312
|
return;
|
|
308
313
|
}
|
|
309
314
|
void this.openCamera();
|