import{W as m}from"./vue-cropper.es.389d4055.js";import{e as l}from"./emitter.ca07dcc1.js";import{_ as C}from"./lodash.c4b32342.js";import{r as i,p as x,a9 as _,o as w,c as B,a as u,A as M,M as d,u as h,G as W,K as y,F as H}from"./vue.65d9dadc.js";import"./index.373e4c1e.js";import"./elementPlus.c5b0e04f.js";import"./echarts.72dc8373.js";const S={style:{"padding-top":"8px"}},z=["src"],k={__name:"CropperLogo",setup(F){const s=i(),r=i({width:100,height:100}),e=i({img:"",size:1,info:!1,autoCrop:!0,autoCropWidth:600,autoCropHeight:100,canScale:!1,full:!1,fixedBox:!0,centerBox:!0,canMove:!1,enlarge:1,mode:"contain",original:!1,outputType:"png"}),p=i();let t=1;l.on("logo-src",o=>{e.value.img=o}),l.on("logo-data",o=>{e.value.autoCropWidth=600,e.value.autoCropHeight=100,o.width==600&&o.height==100?t=1:t=Math.min(p.value.offsetWidth/o.width,1);const n=o.width*t,a=o.height*t;r.value.width=n,r.value.height=a,e.value.autoCropWidth=e.value.autoCropWidth*t,e.value.autoCropHeight=e.value.autoCropHeight*t});const c=i("");function f(o){const n=parseInt((o.axis.x1/t).toFixed(0)),a=parseInt((o.axis.y1/t).toFixed(0));l.emit("send-logo-leftTop",{left:n,top:a,width:600,height:100}),s.value.getCropData(v=>{c.value=v})}const g=C.debounce(f,100);return x(()=>{l.all.clear()}),(o,n)=>{const a=_("el-text");return w(),B(H,null,[u("div",{ref_key:"outContianer",ref:p,style:{width:"100%"}},[u("div",{style:M({width:r.value.width+"px",height:r.value.height+"px"})},[d(h(m),{ref_key:"cropper",ref:s,img:e.value.img,canScale:e.value.canScale,full:e.value.full,outputSize:e.value.size,centerBox:e.value.centerBox,autoCrop:e.value.autoCrop,autoCropWidth:e.value.autoCropWidth,autoCropHeight:e.value.autoCropHeight,fixedBox:e.value.fixedBox,canMove:e.value.canMove,mode:e.value.mode,info:e.value.info,onCropMoving:h(g)},null,8,["img","canScale","full","outputSize","centerBox","autoCrop","autoCropWidth","autoCropHeight","fixedBox","canMove","mode","info","onCropMoving"])],4)],512),u("div",S,[d(a,{class:"mx-1"},{default:W(()=>[y("预览:")]),_:1}),u("img",{src:c.value,style:{width:"40%"}},null,8,z)])],64)}}},A=k;export{A as default};
