UNPKG

mmjs-core

Version:
2 lines (1 loc) 661 B
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var c,o;let e={w:1920,h:1080,clientWidth:((c=document==null?void 0:document.documentElement)==null?void 0:c.clientWidth)??1920,clientHeight:((o=document==null?void 0:document.documentElement)==null?void 0:o.clientHeight)??879};function s(){return{x:e.clientWidth/e.w,y:e.clientHeight/e.h}}function u(t){Object.assign(e,t)}function a(){return{...e}}function f(t,l="y"){const i=s()[l];if(typeof t=="number")return i*t;const n=parseFloat(t);if(Number.isNaN(n))return t;const r=t.replace(n.toString(),"");return i*n+r}exports.getScaleOption=a;exports.scale=f;exports.setScaleOption=u;