@scandit/web-datacapture-barcode
Version:
Scandit Data Capture SDK for the Web
7 lines (4 loc) • 2.01 kB
JavaScript
import { b } from './chunk-XCZGCZ5K.js';
import { Brush, NoViewfinder } from '@scandit/web-datacapture-core';
var c=(e=>(e.Frame="frame",e))(c||{}),i=class o{constructor(){this.type="barcodeCapture";this._shouldShowScanAreaGuides=!1;this._shouldRemoveLocationsAfterScan=!0;this._style=b.BarcodeCapture.BarcodeCaptureOverlay.defaultStyle;this._viewfinder=null;}get style(){return this._style}static async withBarcodeCapture(e){return o.withBarcodeCaptureForView(e,null)}static async withBarcodeCaptureForView(e,a){return o.withBarcodeCaptureForViewWithStyle(e,a,b.BarcodeCapture.BarcodeCaptureOverlay.defaultStyle)}static async withBarcodeCaptureForViewWithStyle(e,a,u){let r=new o;return r.barcodeCapture=e,r._style=u,await r.setBrush(new Brush(b.BarcodeCapture.BarcodeCaptureOverlay.styles[r.style].DefaultBrush.fillColor,b.BarcodeCapture.BarcodeCaptureOverlay.styles[r.style].DefaultBrush.strokeColor,b.BarcodeCapture.BarcodeCaptureOverlay.styles[r.style].DefaultBrush.strokeWidth)),a&&await a.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,a;return {type:this.type,brush:this._brush.toJSONObject(),drawLocalizedOnlyBarcodes:!1,shouldShowScanAreaGuides:this._shouldShowScanAreaGuides,shouldRemoveLocationsAfterScan:this._shouldRemoveLocationsAfterScan,viewfinder:(a=(e=this._viewfinder)==null?void 0:e.toJSONObject())!=null?a:NoViewfinder.toJSONObject(),style:this.style}}};
export { c as a, i as b };