@scandit/web-datacapture-barcode
Version:
Scandit Data Capture SDK for the Web
1 lines • 1.53 kB
JavaScript
import{defaultBarcodeCapture as e}from"./defaults/DefaultsBarcodeCapture.js";import{NoViewfinder as t}from"@scandit/web-datacapture-core";var n=class n{constructor(){this.type=`barcodeCapture`,this._brush=e.BarcodeCaptureOverlay.DefaultBrush.clone(),this._shouldShowScanAreaGuides=!1,this._shouldRemoveLocationsAfterScan=!0,this._viewfinder=null}static async withBarcodeCapture(e){return n.withBarcodeCaptureForView(e,null)}static async withBarcodeCaptureForView(e,t){let r=new n;return r.barcodeCapture=e,await r.setBrush(r._brush),await(t==null?void 0:t.addOverlay(r)),r}getBrush(){return this._brush}getViewfinder(){return this._viewfinder}async setBrush(e){this._brush=e,await this.barcodeCapture.notifyContext()}async setShouldShowScanAreaGuides(e){this._shouldShowScanAreaGuides=e,await this.barcodeCapture.notifyContext()}async setShouldRemoveLocationsAfterScan(e){this._shouldRemoveLocationsAfterScan=e,await this.barcodeCapture.notifyContext()}async setViewfinder(e){this._viewfinder=e,await this.barcodeCapture.notifyContext()}shouldShowScanAreaGuides(){return this._shouldShowScanAreaGuides}shouldRemoveLocationsAfterScan(){return this._shouldRemoveLocationsAfterScan}toJSONObject(){var e;return{type:this.type,brush:this._brush.toJSONObject(),drawLocalizedOnlyBarcodes:!1,shouldShowScanAreaGuides:this._shouldShowScanAreaGuides,shouldRemoveLocationsAfterScan:this._shouldRemoveLocationsAfterScan,viewfinder:((e=this._viewfinder)==null?void 0:e.toJSONObject())??t.toJSONObject()}}};export{n as BarcodeCaptureOverlay};