@scandit/web-datacapture-barcode
Version:
Scandit Data Capture SDK for the Web
8 lines (5 loc) • 1.96 kB
JavaScript
import { a } from './chunk-W3YHPFLY.js';
import { b } from './chunk-XCZGCZ5K.js';
import { Brush } from '@scandit/web-datacapture-core';
var h=(a=>(a.Frame="frame",a.Dot="dot",a))(h||{}),o=class s{constructor(){this.type="barcodeTrackingBasic";this._style=b.BarcodeBatch.BarcodeBatchBasicOverlay.defaultStyle;this._shouldShowScanAreaGuides=!1;this._brushesForBarcodes=new Map;}get style(){return this._style}get listener(){return this._listener}set listener(e){this._listener=e;}get brush(){return this._brush}static async withBarcodeBatch(e){return s.withBarcodeBatchForView(e,null)}static async withBarcodeBatchForView(e,a){return this.withBarcodeBatchForViewWithStyle(e,a,b.BarcodeBatch.BarcodeBatchBasicOverlay.defaultStyle)}static async withBarcodeBatchForViewWithStyle(e,a$1,c){let r=new s;return r.barcodeBatch=e,r._style=c,r._brush=new Brush(b.BarcodeBatch.BarcodeBatchBasicOverlay.styles[r.style].DefaultBrush.fillColor,b.BarcodeBatch.BarcodeBatchBasicOverlay.styles[r.style].DefaultBrush.strokeColor,b.BarcodeBatch.BarcodeBatchBasicOverlay.styles[r.style].DefaultBrush.strokeWidth),a$1&&await a$1.addOverlay(r),r.privateListener=new a(r),e.addPrivateListener(r.privateListener),r}async setBrush(e){this._brush=e,await this.barcodeBatch.notifyContext();}shouldShowScanAreaGuides(){return this._shouldShowScanAreaGuides}async setShouldShowScanAreaGuides(e){this._shouldShowScanAreaGuides=e,await this.barcodeBatch.notifyContext();}async setBrushForTrackedBarcode(e,a){this._brushesForBarcodes.set(a.identifier,e),await this.barcodeBatch.notifyContext();}async clearTrackedBarcodeBrushes(){this._brushesForBarcodes.clear(),await this.barcodeBatch.notifyContext();}toJSONObject(){return {type:this.type,brush:this._brush.toJSONObject(),shouldShowScanAreaGuides:this._shouldShowScanAreaGuides,style:this._style,brushesForBarcodes:[...this._brushesForBarcodes.entries()].reduce((e,[a,c])=>(e[a]=c.toJSONObject(),e),{})}}};
export { h as a, o as b };