UNPKG

@jizirui/auto-fix-vue3

Version:
3 lines (2 loc) 1.76 kB
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).autoFix={},e.Vue)}(this,(function(e,n){"use strict";function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{width:1920,height:1080},t=n.ref(e.width),a=n.ref(e.height),i=n.reactive({transform:"scale(1, 1)",transformOrigin:"left top"}),r=function(){t.value=1920,a.value=1080,i.transform="scale(1, 1)",i.transformOrigin="left top",function(){var e=window.innerWidth,n=window.innerHeight,r=e/n,o=t.value/a.value,c=0,l=0;o>r?(c=e,l=e/o):(l=n,c=n*o);var s=c/t.value,u=l/a.value,f=(e-c)/2/s,d=(n-l)/2/u;i.transform="scale(".concat(s,", ").concat(u,") translate(").concat(f,"px, ").concat(d,"px)")}()};return n.watchEffect((function(){r()})),window.addEventListener("resize",(function(){r()})),{canvasStyle:i,canvasWidth:t,canvasHeight:a}}var a=n.defineComponent({name:"FullScreenContainer",props:{width:{type:Number,required:!0,default:1920},height:{type:Number,required:!0,default:1080}},setup(e){const{canvasStyle:n,canvasWidth:a,canvasHeight:i}=t({width:e.width,height:e.height});return{canvasStyle:n,canvasWidth:a,canvasHeight:i}}});a.render=function(e,t,a,i,r,o){return n.openBlock(),n.createElementBlock("div",{class:"full-screen-container",style:n.normalizeStyle({width:e.canvasWidth+"px",height:e.canvasHeight+"px",...e.canvasStyle})},[n.renderSlot(e.$slots,"default")],4)},a.__file="src/components/full-screen-container/full-screen-container.vue";var i=[a],r={install:function(e){i.forEach((function(n){e.component(n.name,n)}))}};e.AutoFix=r,e.FullScreenContainer=a,e.useAutoFix=t})); //# sourceMappingURL=index.js.map