Files
fad_oa/ruoyi-ui/public/file-viewer/assets/rough.esm-DjrMDdlL.js

1 line
26 KiB
JavaScript
Raw Normal View History

import{k as e}from"./package-Bop5TfAT.js";var t=e({default:()=>se});function n(e,t,n){if(e&&e.length){let[r,i]=t,a=Math.PI/180*n,o=Math.cos(a),s=Math.sin(a);for(let t of e){let[e,n]=t;t[0]=(e-r)*o-(n-i)*s+r,t[1]=(e-r)*s+(n-i)*o+i}}}function r(e,t){return e[0]===t[0]&&e[1]===t[1]}function i(e,t,i,a=1){let o=i,s=Math.max(t,.1),c=e[0]&&e[0][0]&&typeof e[0][0]==`number`?[e]:e,l=[0,0];if(o)for(let e of c)n(e,l,o);let u=function(e,t,n){let i=[];for(let t of e){let e=[...t];r(e[0],e[e.length-1])||e.push([e[0][0],e[0][1]]),e.length>2&&i.push(e)}let a=[];t=Math.max(t,.1);let o=[];for(let e of i)for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1];if(n[1]!==r[1]){let e=Math.min(n[1],r[1]);o.push({ymin:e,ymax:Math.max(n[1],r[1]),x:e===n[1]?n[0]:r[0],islope:(r[0]-n[0])/(r[1]-n[1])})}}if(o.sort(((e,t)=>e.ymin<t.ymin?-1:e.ymin>t.ymin?1:e.x<t.x?-1:e.x>t.x?1:e.ymax===t.ymax?0:(e.ymax-t.ymax)/Math.abs(e.ymax-t.ymax))),!o.length)return a;let s=[],c=o[0].ymin,l=0;for(;s.length||o.length;){if(o.length){let e=-1;for(let t=0;t<o.length&&!(o[t].ymin>c);t++)e=t;o.splice(0,e+1).forEach((e=>{s.push({s:c,edge:e})}))}if(s=s.filter((e=>!(e.edge.ymax<=c))),s.sort(((e,t)=>e.edge.x===t.edge.x?0:(e.edge.x-t.edge.x)/Math.abs(e.edge.x-t.edge.x))),(n!==1||l%t==0)&&s.length>1)for(let e=0;e<s.length;e+=2){let t=e+1;if(t>=s.length)break;let n=s[e].edge,r=s[t].edge;a.push([[Math.round(n.x),c],[Math.round(r.x),c]])}c+=n,s.forEach((e=>{e.edge.x=e.edge.x+n*e.edge.islope})),l++}return a}(c,s,a);if(o){for(let e of c)n(e,l,-o);(function(e,t,r){let i=[];e.forEach((e=>i.push(...e))),n(i,t,r)})(u,l,-o)}return u}function a(e,t){let n=t.hachureAngle+90,r=t.hachureGap;r<0&&(r=4*t.strokeWidth),r=Math.round(Math.max(r,.1));let a=1;return t.roughness>=1&&(t.randomizer?.next()||Math.random())>.7&&(a=r),i(e,r,n,a||1)}var o=class{constructor(e){this.helper=e}fillPolygons(e,t){return this._fillPolygons(e,t)}_fillPolygons(e,t){let n=a(e,t);return{type:`fillSketch`,ops:this.renderLines(n,t)}}renderLines(e,t){let n=[];for(let r of e)n.push(...this.helper.doubleLineOps(r[0][0],r[0][1],r[1][0],r[1][1],t));return n}};function s(e){let t=e[0],n=e[1];return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2)}var c=class extends o{fillPolygons(e,t){let n=t.hachureGap;n<0&&(n=4*t.strokeWidth),n=Math.max(n,.1);let r=a(e,Object.assign({},t,{hachureGap:n})),i=Math.PI/180*t.hachureAngle,o=[],c=.5*n*Math.cos(i),l=.5*n*Math.sin(i);for(let[e,t]of r)s([e,t])&&o.push([[e[0]-c,e[1]+l],[...t]],[[e[0]+c,e[1]-l],[...t]]);return{type:`fillSketch`,ops:this.renderLines(o,t)}}},l=class extends o{fillPolygons(e,t){let n=this._fillPolygons(e,t),r=Object.assign({},t,{hachureAngle:t.hachureAngle+90}),i=this._fillPolygons(e,r);return n.ops=n.ops.concat(i.ops),n}},u=class{constructor(e){this.helper=e}fillPolygons(e,t){let n=a(e,t=Object.assign({},t,{hachureAngle:0}));return this.dotsOnLines(n,t)}dotsOnLines(e,t){let n=[],r=t.hachureGap;r<0&&(r=4*t.strokeWidth),r=Math.max(r,.1);let i=t.fillWeight;i<0&&(i=t.strokeWidth/2);let a=r/4;for(let o of e){let e=s(o),c=e/r,l=Math.ceil(c)-1,u=e-l*r,d=(o[0][0]+o[1][0])/2-r/4,f=Math.min(o[0][1],o[1][1]);for(let e=0;e<l;e++){let o=f+u+e*r,s=d-a+2*Math.random()*a,c=o-a+2*Math.random()*a,l=this.helper.ellipse(s,c,i,i,t);n.push(...l.ops)}}return{type:`fillSketch`,ops:n}}},d=class{constructor(e){this.helper=e}fillPolygons(e,t){let n=a(e,t);return{type:`fillSketch`,ops:this.dashedLine(n,t)}}dashedLine(e,t){let n=t.dashOffset<0?t.hachureGap<0?4*t.strokeWidth:t.hachureGap:t.dashOffset,r=t.dashGap<0?t.hachureGap<0?4*t.strokeWidth:t.hachureGap:t.dashGap,i=[];return e.forEach((e=>{let a=s(e),o=Math.floor(a/(n+r)),c=(a+r-o*(n+r))/2,l=e[0],u=e[1];l[0]>u[0]&&(l=e[1],u=e[0]);let d=Math.atan((u[1]-l[1])/(u[0]-l[0]));for(let e=0;e<o;e++){let a=e*(n+r),o=a+n,s=[l[0]+a*Math.cos(d)+c*Math.cos(d),l[1]+a*Math.sin(d)+c*Math.sin(d)],u=[l[0]+o*Math.cos(d)+c*Math.cos(d),l[1]+o*Math.sin(d)+c*Math.sin(d)];i.push(...this.helper.doubleLineOps(s[0],s[1],u[0],u[1],t))}})),i}},f=class{constructor(e){this.helper=e}fillPolygons(e,t){let n=t.hachureGap<0?4*t.strokeWidth:t.hachureGap,r=t.zigzagOffset<0?n:t.zigzagOffset,i=a(