scandit-web-datacapture-barcode
Version:
Scandit Data Capture SDK for the Web
8 lines (5 loc) • 2.03 kB
JavaScript
import { a } from './chunk-243AFMEZ.js';
import { b } from './chunk-TRWFJYCT.js';
import { Brush } from 'scandit-web-datacapture-core';
var d=(i=>(i.Frame="frame",i.Dot="dot",i.Legacy="legacy",i))(d||{}),o=class t{constructor(){this.type="barcodeTrackingBasic";this._style=b.BarcodeTracking.BarcodeTrackingBasicOverlay.defaultStyle;this._shouldShowScanAreaGuides=!1;this._brushesForBarcodes=new Map;}get style(){return this._style}get listener(){return this._listener}set listener(r){this._listener=r;}get brush(){return this._brush}static async withBarcodeTracking(r){return t.withBarcodeTrackingForView(r,null)}static async withBarcodeTrackingForView(r,a){return this.withBarcodeTrackingForViewWithStyle(r,a,b.BarcodeTracking.BarcodeTrackingBasicOverlay.defaultStyle)}static async withBarcodeTrackingForViewWithStyle(r,a$1,i){let e=new t;return e.barcodeTracking=r,e._style=i,e._brush=new Brush(b.BarcodeTracking.BarcodeTrackingBasicOverlay.styles[e.style].DefaultBrush.fillColor,b.BarcodeTracking.BarcodeTrackingBasicOverlay.styles[e.style].DefaultBrush.strokeColor,b.BarcodeTracking.BarcodeTrackingBasicOverlay.styles[e.style].DefaultBrush.strokeWidth),a$1&&await a$1.addOverlay(e),e.privateListener=new a(e),r.addPrivateListener(e.privateListener),e}async setBrush(r){this._brush=r,await this.barcodeTracking.notifyContext();}shouldShowScanAreaGuides(){return this._shouldShowScanAreaGuides}async setShouldShowScanAreaGuides(r){this._shouldShowScanAreaGuides=r,await this.barcodeTracking.notifyContext();}async setBrushForTrackedBarcode(r,a){this._brushesForBarcodes.set(a.identifier,r),await this.barcodeTracking.notifyContext();}async clearTrackedBarcodeBrushes(){this._brushesForBarcodes.clear(),await this.barcodeTracking.notifyContext();}toJSONObject(){return {type:this.type,brush:this._brush.toJSONObject(),shouldShowScanAreaGuides:this._shouldShowScanAreaGuides,style:this._style,brushesForBarcodes:[...this._brushesForBarcodes.entries()].reduce((r,[a,i])=>(r[a]=i.toJSONObject(),r),{})}}};
export { d as a, o as b };