import{k as Q,j as c,t as B,m as V,n as H,p as u,i as h,v as Z,B as P,A as ee,z as te,x as I,s as ne}from"./web.Os7kOAdY.js";import{g as N,t as le}from"./i18n-runtime._BAkvU05.js";var ie=ee('<div class=tool-container><div style=display:flex;gap:12px;align-items:center;flex-wrap:wrap><button class=btn><!$><!/> <!$><!/></button><label class=field style=margin:0><span class=field-label></span><input type=number class=input min=100 max=2000 style=width:100px></label><label class=field style=margin:0><span class=field-label></span><input type=number class=input min=30 max=200 style=width:100px></label></div><p style=margin-top:12px;color:var(--text-2);font-size:13px></p><div style="position:relative;width:100%;height:400px;border:1px dashed var(--border);border-radius:8px;margin-top:12px;overflow:hidden"><canvas>');function oe(){const[X,b]=c(N(),{equals:!1}),p=t=>le(t,X());B(()=>{const t=l=>{const i=l.detail?.locale;i&&b(i)};window.addEventListener("taitan:locale-change",t),b(N()),ne(()=>window.removeEventListener("taitan:locale-change",t))});const[d,Y]=c(!0),[y,j]=c(600),[_,q]=c(60);let w,x,g=!1,$={x:0,y:0};const[m,D]=c({x:20,y:20});function v(){const t=x;if(!t)return;const l=d(),i=y(),s=_();t.width=l?i:s,t.height=l?s:i;const e=t.getContext("2d");e.fillStyle="rgba(255,255,100,0.85)",e.fillRect(0,0,t.width,t.height),e.strokeStyle="#333",e.fillStyle="#333",e.lineWidth=1,e.font="10px monospace";for(let n=0;n<=i;n+=1){if(n%10!==0)continue;const a=n%50===0?s*.5:s*.25;e.beginPath(),l?(e.moveTo(n,0),e.lineTo(n,a)):(e.moveTo(0,n),e.lineTo(a,n)),e.stroke(),n%50===0&&(e.textAlign="center",e.textBaseline="top",l?e.fillText(String(n),n,a+2):(e.save(),e.translate(a+2,n),e.textAlign="left",e.textBaseline="middle",e.fillText(String(n),0,0),e.restore()))}e.strokeStyle="#666",e.strokeRect(0,0,t.width,t.height)}B(()=>{v()});function O(t){g=!0;const l=m();$={x:t.clientX-l.x,y:t.clientY-l.y}}function U(t){g&&D({x:t.clientX-$.x,y:t.clientY-$.y})}function S(){g=!1}function W(){Y(!d()),setTimeout(v,0)}function T(){setTimeout(v,0)}return(()=>{var t=V(ie),l=t.firstChild,i=l.firstChild,s=i.firstChild,[e,n]=H(s.nextSibling),a=e.nextSibling,F=a.nextSibling,[G,J]=H(F.nextSibling),k=i.nextSibling,C=k.firstChild,R=C.nextSibling,K=k.nextSibling,L=K.firstChild,E=L.nextSibling,M=l.nextSibling,o=M.nextSibling,f=o.firstChild;i.$$click=W,u(i,()=>d()?"水平模式":"垂直模式",e,n),u(i,()=>p("→ 切换"),G,J),u(C,()=>p("长度 (px)")),R.$$input=r=>{j(parseInt(r.currentTarget.value)||600),T()},u(L,()=>p("厚度 (px)")),E.$$input=r=>{q(parseInt(r.currentTarget.value)||60),T()},u(M,()=>p("拖动标尺移动位置。")),o.addEventListener("mouseleave",S),o.$$mouseup=S,o.$$mousemove=U;var z=w;typeof z=="function"?P(z,o):w=o,f.$$mousedown=O;var A=x;return typeof A=="function"?P(A,f):x=f,h(r=>te(f,`position:absolute;left:${m().x}px;top:${m().y}px;cursor:move;`,r)),h(()=>I(R,"value",y())),h(()=>I(E,"value",_())),Z(),t})()}Q(["click","input","mousemove","mouseup","mousedown"]);export{oe as default};
