UNPKG

@scandit/web-datacapture-barcode

Version:

Scandit Data Capture SDK for the Web

1 lines 1.87 kB
import {b}from'./chunk-OLJXVUYE.js';import {Brush,NoViewfinder}from'@scandit/web-datacapture-core';var l=(e=>(e.Frame="frame",e))(l||{}),i=class o{constructor(){this.type="barcodeCapture";this._brush=new Brush(b.BarcodeCapture.BarcodeCaptureOverlay.DefaultBrush.fillColor,b.BarcodeCapture.BarcodeCaptureOverlay.DefaultBrush.strokeColor,b.BarcodeCapture.BarcodeCaptureOverlay.DefaultBrush.strokeWidth);this._shouldShowScanAreaGuides=false;this._shouldRemoveLocationsAfterScan=true;this._style="frame";this._viewfinder=null;}get style(){return this._style}static async withBarcodeCapture(e){return o.withBarcodeCaptureForView(e,null)}static async withBarcodeCaptureForView(e,r){let a=new o;return a.barcodeCapture=e,await a.setBrush(a._brush),await(r==null?void 0:r.addOverlay(a)),a}static async withBarcodeCaptureForViewWithStyle(e,r,a){return await o.withBarcodeCaptureForView(e,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,r;return {type:this.type,brush:this._brush.toJSONObject(),drawLocalizedOnlyBarcodes:false,shouldShowScanAreaGuides:this._shouldShowScanAreaGuides,shouldRemoveLocationsAfterScan:this._shouldRemoveLocationsAfterScan,viewfinder:(r=(e=this._viewfinder)==null?void 0:e.toJSONObject())!=null?r:NoViewfinder.toJSONObject(),style:this.style}}};export{l as a,i as b};