@scandit/web-datacapture-core
Version:
Scandit Data Capture SDK for the Web
1 lines • 2.37 kB
JavaScript
import {a as a$1}from'./chunk-FR24G4R7.js';import {a as a$2}from'./chunk-F2GMW4LP.js';import {a as a$3}from'./chunk-ENYHCJGH.js';var a=class n{constructor(){this._shorterDimensionAndAspectRatio=null;}get widthAndHeight(){return this._widthAndHeight}get widthAndAspectRatio(){return this._widthAndAspectRatio}get heightAndAspectRatio(){return this._heightAndAspectRatio}get shorterDimensionAndAspectRatio(){return this._shorterDimensionAndAspectRatio}get sizingMode(){return this.widthAndAspectRatio?"widthAndAspectRatio":this.heightAndAspectRatio?"heightAndAspectRatio":this.shorterDimensionAndAspectRatio?"shorterDimensionAndAspectRatio":"widthAndHeight"}static sizeWithWidthAndHeight(t){let i=new n;return i._widthAndHeight=t,i}static sizeWithWidthAndAspectRatio(t,i){let e=new n;return e._widthAndAspectRatio=new a$1(t,i),e}static sizeWithHeightAndAspectRatio(t,i){let e=new n;return e._heightAndAspectRatio=new a$1(t,i),e}static sizeWithShorterDimensionAndAspectRatio(t,i){let e=new n;return e._shorterDimensionAndAspectRatio=new a$1(t,i),e}static fromJSON(t){if(t.width&&t.height)return n.sizeWithWidthAndHeight(new a$2(a$3.fromJSON(t.width),a$3.fromJSON(t.height)));if(t.width&&typeof t.aspect=="number")return n.sizeWithWidthAndAspectRatio(a$3.fromJSON(t.width),t.aspect);if(t.height&&typeof t.aspect=="number")return n.sizeWithHeightAndAspectRatio(a$3.fromJSON(t.height),t.aspect);if(t.shorterDimension&&typeof t.aspect=="number")return n.sizeWithShorterDimensionAndAspectRatio(a$3.fromJSON(t.shorterDimension),t.aspect);throw new Error(`SizeWithUnitAndAspectJSON is malformed: ${JSON.stringify(t)}`)}toJSONObject(){var t,i,e,r,A,p,c,d;switch(this.sizingMode){case "widthAndAspectRatio":return {width:(t=this.widthAndAspectRatio)==null?void 0:t.size.toJSONObject(),aspect:(i=this.widthAndAspectRatio)==null?void 0:i.aspect};case "heightAndAspectRatio":return {height:(e=this.heightAndAspectRatio)==null?void 0:e.size.toJSONObject(),aspect:(r=this.heightAndAspectRatio)==null?void 0:r.aspect};case "shorterDimensionAndAspectRatio":return {shorterDimension:(A=this.shorterDimensionAndAspectRatio)==null?void 0:A.size.toJSONObject(),aspect:(p=this.shorterDimensionAndAspectRatio)==null?void 0:p.aspect};default:return {width:(c=this.widthAndHeight)==null?void 0:c.width.toJSONObject(),height:(d=this.widthAndHeight)==null?void 0:d.height.toJSONObject()}}}};export{a};