drill.define(async e=>{let t=$("body");const{getUnit:n,getUnitPx:i,refreshText:a}=await e("./unit"),o=(e,t,a,o=1,s)=>{if(void 0===a)return;let l=a,r=n(e[t]),c=i(e,s);switch(r){case"px":l+="px";break;case"%":l=parseFloat(a/(o?c.percentW:c.percentH)).toFixed(3)+"%";break;default:let e=c[r];l=parseFloat(a/e).toFixed(3)+r}return l};$.register({tag:"pre-size",temp:'\n        <div class="presize_con" xv-tar="precon">\n            <div class="point" point-name="0"></div>\n            <div class="point" point-name="1" line-name="left top"></div>\n            <div class="point" point-name="2"></div>\n            <div class="point" point-name="3" line-name="right top"></div>\n            <div class="point" point-name="4"></div>\n            <div class="point" point-name="5" line-name="right bottom"></div>\n            <div class="point" point-name="6"></div>\n            <div class="point" point-name="7" line-name="left bottom"></div>\n            <div class="point" point-name="8"></div>\n            <div class="line" line-name="top"></div>\n            <div class="line" line-name="right"></div>\n            <div class="line" line-name="bottom"></div>\n            <div class="line" line-name="left"></div>\n        </div>\n        <div class="movearea" xv-tar="movearea"></div>\n        <div xv-content style="display:none;"></div>\n        ',inited(){l.call(this),s.call(this)}});const s=function(){let e,i,s,l,r,c,p,d,v,m,h=this.parent,f=h.parent;this.$precon.on("mousedown","[line-name]",n=>{let{originalEvent:a,delegateTarget:o}=n;0===a.button&&(i=a.clientX,s=a.clientY,l=h.width,r=h.height,e=e||h.parents(".pre_ele_outer")[0],d=e.hor,v=e.ver,m=o.attr("line-name"),c=h.position.left,p=-h.position.top,t.on("mousemove",u),t.on("mouseup",b))});let u=t=>{let{tarW:n,tarX:i,tarH:o,tarY:s}=x(t);h.style.left=i+"px",h.style.bottom=s+"px",f.style.width=n+"px",f.style.height=o+"px",a(e,{tarWidth:n})},x=t=>{let{clientX:n,clientY:a}=t.originalEvent,o=n-i,h=a-s,f=l,u=r,x=c,b=p;if(m.search("right")>-1){switch(f=l+o,d){case"start":break;case"center":x=c+o/2;break;case"end":x=c+o}e.lockbox&&(h=m.search("top")>-1?-r/l*o:r/l*o,h=Math.floor(h))}else if(m.search("left")>-1){switch(f=l-o,d){case"start":x=c+o;break;case"center":x=c+o/2}e.lockbox&&(h=m.search("top")>-1?r/l*o:-r/l*o,h=Math.floor(h))}if(m.search("top")>-1)switch(u=r-h,v){case"start":b=p-h;break;case"center":b=p-h/2}else if(m.search("bottom")>-1)switch(u=r+h,v){case"start":break;case"center":b=p-h/2;break;case"end":b=p-h}return{tarW:f,tarX:x,tarH:u,tarY:b}},b=a=>{let{tarW:l,tarX:r,tarH:c,tarY:p}=x(a);p=o(e,"y",p,0,l),c=o(e,"h",c,0,l),r=o(e,"x",r,1,l),(l=o(e,"w",l,1))&&(e.w=l),r&&(e.x=r),p&&(e.y=p),"bw"!==n(e.h)&&c&&(e.h=c),t.off("mousemove",u),t.off("mouseup",b),m=i=s=null}},l=function(){let e,n,i,a,s=this.parent;this.$movearea.on("mousedown",o=>{let{originalEvent:c}=o;0===c.button&&(e=c.clientX,n=c.clientY,t.on("mousemove",l),t.on("mouseup",r),i=s.position.left,a=-s.position.top)});let l=t=>{let{clientX:o,clientY:l}=t.originalEvent,r=o-e,c=l-n;s.style.left=i+r+"px",s.style.bottom=a-c+"px"},r=c=>{let{clientX:p,clientY:d}=c.originalEvent,v=p-e,m=d-n,h=s.parents(".pre_ele_outer")[0],f=i+v,u=a-m;f=o(h,"x",f),u=o(h,"y",u,0),h.x=f,h.y=u,t.off("mousemove",l),t.off("mouseup",r),e=n=i=a=null}}});