Scanner Performance Update

This commit is contained in:
Lorenz Hilpert
2022-05-16 15:20:10 +02:00
parent d3cd6f415b
commit 094c881e7f
5 changed files with 56 additions and 50 deletions

View File

@@ -1 +1 @@
<div #scanContainer></div>
<div class="scanner-container" #scanContainer></div>

View File

@@ -1,3 +1,4 @@
div {
.scanner-container {
@apply mt-8;
max-height: calc(100vh - 10rem);
}

View File

@@ -1,4 +1,4 @@
import { Component, ChangeDetectionStrategy, ViewChild, ElementRef, AfterViewInit, NgZone, Inject } from '@angular/core';
import { Component, ChangeDetectionStrategy, ViewChild, ElementRef, AfterViewInit, NgZone, Inject, OnDestroy } from '@angular/core';
import { UiMessageModalComponent, UiModalRef, UiModalService } from '@ui/modal';
import { Barcode, BarcodePicker, ScanSettings } from 'scandit-sdk';
@@ -8,7 +8,7 @@ import { Barcode, BarcodePicker, ScanSettings } from 'scandit-sdk';
styleUrls: ['scandit-modal.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ScanditModalComponent implements AfterViewInit {
export class ScanditModalComponent implements AfterViewInit, OnDestroy {
private _barcodePicker: BarcodePicker;
@ViewChild('scanContainer', { read: ElementRef, static: true }) scanContainer: ElementRef;
@@ -25,6 +25,8 @@ export class ScanditModalComponent implements AfterViewInit {
this._barcodePicker = picker;
var scanSettings = new ScanSettings({
blurryRecognition: false,
enabledSymbologies: [
Barcode.Symbology.EAN8,
Barcode.Symbology.EAN13,
@@ -71,8 +73,11 @@ export class ScanditModalComponent implements AfterViewInit {
}
cancel() {
this._barcodePicker?.pauseCameraAccess();
this._barcodePicker?.destroy();
this._modalRef.close();
}
ngOnDestroy(): void {
console.log('destroy');
this._barcodePicker?.destroy(true);
}
}

View File

@@ -2,35 +2,35 @@
* A configuration object to define the properties of an image to be scanned.
*/
export interface ImageSettings {
/**
* The width of the image (columns of pixels).
*/
readonly width: number;
/**
* The height of the image (rows of pixels).
*/
readonly height: number;
/**
* The format of the pixel data, meaning the mapping of array bytes to image pixels.
*/
readonly format: ImageSettings.Format;
/**
* The width of the image (columns of pixels).
*/
readonly width: number;
/**
* The height of the image (rows of pixels).
*/
readonly height: number;
/**
* The format of the pixel data, meaning the mapping of array bytes to image pixels.
*/
readonly format: ImageSettings.Format;
}
export declare namespace ImageSettings {
/**
* Image bytes format/layout.
*/
enum Format {
/**
* Single-channel 8-bit gray scale image.
* Image bytes format/layout.
*/
GRAY_8U = 0,
/**
* RGB image with 8 bits per color channel.
*/
RGB_8U = 1,
/**
* RGBA image with 8 bits per color channel.
*/
RGBA_8U = 2,
}
enum Format {
/**
* Single-channel 8-bit gray scale image.
*/
GRAY_8U = 0,
/**
* RGB image with 8 bits per color channel.
*/
RGB_8U = 1,
/**
* RGBA image with 8 bits per color channel.
*/
RGBA_8U = 2
}
}

View File

@@ -1,22 +1,22 @@
import { ParserField } from './parserField';
import { ParserField } from "./parserField";
/**
* A result of a successfully parsed data string.
*/
export interface ParserResult {
/**
* The result object as a serialized JSON string.
*/
readonly jsonString: string;
/**
* The fields contained in the result as an array of [[ParserField]] objects.
* The order of the fields in array depends on the order of the fields in the input data.
*/
readonly fields: ParserField[];
/**
* The fields contained in the result as a map of [[ParserField]] objects.
* The entries in the map are field names pointing to the parser field.
*/
readonly fieldsByName: {
[fieldName: string]: ParserField;
};
/**
* The result object as a serialized JSON string.
*/
readonly jsonString: string;
/**
* The fields contained in the result as an array of [[ParserField]] objects.
* The order of the fields in array depends on the order of the fields in the input data.
*/
readonly fields: ParserField[];
/**
* The fields contained in the result as a map of [[ParserField]] objects.
* The entries in the map are field names pointing to the parser field.
*/
readonly fieldsByName: {
[fieldName: string]: ParserField;
};
}