UNPKG

@scandit/web-datacapture-barcode

Version:

Scandit Data Capture SDK for the Web

1 lines 1.94 kB
import{defaultSparkScan as e}from"../defaults/DefaultsSparkScan.js";import{SparkScanTargetAimerViewfinder as t}from"./SparkScanTargetAimerViewfinder.js";var n=class n{constructor(){this.type=`sparkScan`,this._shouldShowScanAreaGuides=!1,this._shouldRemoveLocationsAfterScan=!0,this._shouldDrawViewfinder=!1,this._style=e.SparkScanOverlay.defaultStyle,this._viewfinder=new t}get style(){return this._style}static async withSparkScanForView(t,r){let i=new n;return i.sparkScan=t,await i.setBrush(e.SparkScanOverlay.DefaultBrush.clone()),r&&await r.addOverlay(i),i}setRadius(e){this._viewfinder.radius=e}getBrush(){return this._brush}async setBrush(e){this._brush=e,await this.sparkScan.notifyContext()}async overlayReadyForDraw(){await this.sparkScan.workerCommand(`sparkScanOverlayReadyForDraw`,{})}async discardEnqueuedData(){await this.sparkScan.workerCommand(`sparkScanOverlayDiscardEnqueuedData`,{})}async setErrorBrush(e){this._errorBrush=e,await this.sparkScan.notifyContext()}getErrorBrush(){return this._errorBrush??this._brush}async setShouldShowScanAreaGuides(e){this._shouldShowScanAreaGuides=e,await this.sparkScan.notifyContext()}async setShouldRemoveLocationsAfterScan(e){this._shouldRemoveLocationsAfterScan=e,await this.sparkScan.notifyContext()}async setShouldDrawViewfinder(e){this._shouldDrawViewfinder=e,await this.sparkScan.notifyContext()}shouldShowScanAreaGuides(){return this._shouldShowScanAreaGuides}shouldRemoveLocationsAfterScan(){return this._shouldRemoveLocationsAfterScan}toJSONObject(){var e;return{type:this.type,brush:this._brush.toJSONObject(),errorBrush:((e=this._errorBrush)==null?void 0:e.toJSONObject())??this._brush.toJSONObject(),shouldShowScanAreaGuides:this._shouldShowScanAreaGuides,shouldRemoveLocationsAfterScan:this._shouldRemoveLocationsAfterScan,viewfinder:this._viewfinder.toJSONObject(),style:this.style,shouldDrawViewfinder:this._shouldDrawViewfinder}}};export{n as SparkScanOverlay};