You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pingAnQiYeWeb/public/modules/drawbycanvas_544q2u.js

1 line
3.7 KiB

/**/_jsload2 && _jsload2('drawbycanvas', 'function zh(a){this.D=a;this.gR={strokeweight:"lineWidth",strokecolor:"strokeStyle",fillcolor:"fillStyle",strokeopacity:"globalAlpha",fillopacity:"globalAlpha"};this.Lb="canvas"}zh.prototype=new B.Gz;var Ah=zh.prototype;Ah.To=function(){if(!this.canvas||this.canvas&&!Cb(this.canvas)){var a=this.canvas=H("canvas");this.D.Rf().Vt.appendChild(a);a.style.position="absolute";a=a.getContext("2d");a.lineCap="round";a.lineJoin="round";a.save();this.QU(this.canvas)}return this.canvas}; Ah.me=function(a,b,c){if(a&&0!==b[0].length){var d=a.getContext("2d");this.ta(a);var e=parseInt(a.style.top),f=parseInt(a.style.left);d.beginPath();x.kc.Fb(b,function(a){if(0!==a.length){d.moveTo(a[0].x-f,a[0].y-e);for(var b=1,c=a.length;b<c;b++)d.lineTo(a[b].x-f,a[b].y-e)}});this.ZR(a,c);"dashed"===c.strokeStyle&&this.aS(d,b,f,e,c)}}; Ah.aS=function(a,b,c,d,e){var f=this;a.beginPath();x.kc.Fb(b,function(b){if(0!==b.length){for(var i=[],j=0,l=b.length;j<l;j++)i.push({x:b[j].x-c,y:b[j].y-d});a.strokeStyle=e.strokeColor||"#3a6bdb";f.$R(a,i,{lineWidth:e.mc||5,interval:2*e.mc||10,lineLength:2*e.mc||10,strokeStyle:f.bT(a.strokeStyle,e.td)})}})}; Ah.$R=function(a,b,c){for(var c=c||{},d=c.ny||10,e=c.lineWidth||5,f=c.v4||10,c=c.strokeStyle||"#3a6bdb",g=b.length-1,i=0,j=f+d,l=0,m=0;m<g;m++)var n=b[m].x,s=b[m].y,u=b[m+1].x,w=b[m+1].y,l=l+Math.sqrt((u-n)*(u-n)+(w-s)*(w-s));if(l<f)a.strokeStyle=c,a.lineWidth=e,a.lineJoin="round",a.lineCap="round",a.beginPath(),a.moveTo(b[0].x,b[0].y),a.lineTo(b[g].x,b[g].y),a.stroke();else for(l=0;l<g;l++){var n=b[l].x,s=b[l].y,u=b[l+1].x,w=b[l+1].y,m=Math.sqrt((u-n)*(u-n)+(w-s)*(w-s))+i+f,y=j-Math.abs(i);if(i<= j){var D=parseInt(m/j),C=d*(u-n)/m,F=d*(w-s)/m;xMove=f*(u-n)/m;yMove=f*(w-s)/m;startX=n+y*(u-n)/m;startY=s+y*(w-s)/m;tailX=n+(f-Math.abs(i))*(u-n)/m;tailY=s+(f-Math.abs(i))*(w-s)/m;a.beginPath();a.strokeStyle=c;a.lineJoin="round";a.lineCap="round";a.lineWidth=e;A?a.moveTo(A,z):a.moveTo(n,s);0>=i&&a.lineTo(n,s);a.lineTo(tailX,tailY);a.moveTo(startX,startY);A=0;for(z=2*D;A<z;A++)if(A%2)startX+=C,startY+=F,a.moveTo(startX,startY);else{startX+=xMove;startY+=yMove;if(0>(u-startX)*xMove)break;a.lineTo(startX, startY)}a.stroke()}var i=parseInt(m-j*D)-f,A=u-Math.abs(i)*(u-n)/m,z=w-Math.abs(i)*(w-s)/m;l===g-1&&0<i&&(a.beginPath(),a.strokeStyle=c,n=u-i*(u-n)/m,leftY=w-i*(w-s)/m,i<=f?(a.moveTo(n,leftY),a.lineTo(u,w)):(a.moveTo(n,leftY),a.moveTo(n+xMove,leftY+yMove)),a.stroke())}}; Ah.bT=function(a,b){if(4===a.length)var c=parseInt(a.substr(1,1)+a.substr(1,1),16),d=parseInt(a.substr(2,1)+a.substr(2,1),16),e=parseInt(a.substr(3,1)+a.substr(3,1),16);else c=parseInt(a.substr(1,2),16),d=parseInt(a.substr(3,2),16),e=parseInt(a.substr(5,2),16);return c="rgba("+c+","+d+","+e+","+b+")"};Ah.setAttribute=function(a,b,c){if(a){var d=a.getContext("2d"),e=this.ur(b);try{d[e]=c}catch(f){}a.setAttribute("_"+b,c||"");d.save()}};Ah.ur=function(a){return this.gR[a]||a}; Ah.QU=function(a){var b=this.D,c=b.B.Cx,d=b.width+2*c,e=b.height+2*c,f=-b.offsetX-c,b=-b.offsetY-c,c=a.getContext("2d"),g={strokeStyle:c.strokeStyle,fillStyle:c.fillStyle,globalAlpha:c.globalAlpha,lineWidth:c.lineWidth,lineCap:"round",lineJoin:"round"};a.setAttribute("width",d);a.setAttribute("height",e);for(var i in g)c[i]=g[i];c.save();a=a.style;a.top=b+"px";a.left=f+"px"};Ah.qR=function(a){a.clearRect(0,0,9999,9999)}; Ah.ZR=function(a,b){var c=a.getContext("2d");c.globalAlpha=a.getAttribute("_fillopacity");0!==c.globalAlpha&&a.getAttribute("_fillcolor")&&c.fill();c.globalAlpha=a.getAttribute("_strokeopacity");0!==c.globalAlpha&&(a.getAttribute("_strokecolor")&&"dashed"!==b.strokeStyle)&&c.stroke()};Ah.ta=function(a){var b=this.D,c=b.B.Cx,d=-b.offsetX-c,a=a.style;a.top=-b.offsetY-c+"px";a.left=d+"px"};B.UP=zh; ');