gojs插件源码
p&&r--}else{q=(a+c)/2;u=(b+d)/2;var v=(c+e)/2,w=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+v)/2;c=(u+w)/2;v=(v+e)/2;w=(w+f)/2;var y=(d+v)/2,z=(c+w)/2;r+=I.Vp(a,b,q,u,d,c,y,z,k,l,m,n,p);r+=I.Vp(y,z,v,w,e,f,g,h,k,l,m,n,p)}return r},Xi:function(a,b,c,d,e,f,g){if(I.Z(a,c)){b this.ke||w.height*p>this.ke?u.tb(f,this):ii(f,u))}f.globalAlpha=k}f.restore();f.Qc(!0);this.gi&&wj(this.gi,this)&&this.kr();this.nc=this.hi=!1;this.tt()}Fa(e);Fa(a);this.$b=!1}}else this.ud();M.free(d);c&&(Ve(this),this.ud(),lf(this,!0))}else c?(Ve(this),this.ud(),lf(this,!0)):this.ud()}};function Xi(a){!1===a.oj&&(a.oj=!0)}function Ri(a){!1===a.hi&&(a.hi=!0)}function uj(a){!1!==a.Pn&&(a.Pn=!1,Dj(a,a.va,a.ua))}
function Dj(a,b,c){var d=a.Pb;a.Ba.resize(b*d,c*d,b,c)&&(a.nc=!0,a.Xc.Qc(!0))}
function Pi(a){var b=a.Ba;if(null===b)return!0;var c=a.Fa,d=a.va,e=a.ua,f=a.ax.copy();if(isNaN(f.width)||isNaN(f.height))return!0;var g=!1,h=a.Rf?a.qb:0,k=a.Ne?a.qb:0,l=c.clientWidth||d+h,m=c.clientHeight||e+k;if(l!==d+h||m!==e+k)a.Rf=!1,a.Ne=!1,k=h=0,a.va=l,a.ua=m,g=a.Pn=!0;if(!(g||a.Rf||a.Ne||a.$k||a.al))return!0;a.oj=!1;var n=a.viewportBounds,p=a.documentBounds,r=0,q=0,u=0,v=0;c=n.width;var w=n.height,y=a.zi;a.contentAlignment.eb()?(p.width>c&&(r=y.left,q=y.right),p.height>w&&(u=y.top,v=y.bottom)):
(r=y.left,q=y.right,u=y.top,v=y.bottom);y=p.width+r+q;var z=p.height+u+v;r=p.x-r;var A=n.x;q=p.right+q;var C=n.right+h;u=p.y-u;var J=n.y;p=p.bottom+v;n=n.bottom+k;var K="1px",L="1px";v=a.scale;l=y>l/v;m=z>m/v;a.scrollMode===Vh&&(l||m)&&(l&&a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(l=1,r+1C+1&&(l=Math.max((q-C)*v+a.va,l)),c+h+1 f&&(g=-g),g=(0>e?-1:1)*g+b,h=p*(g-b)+c),this.ue(d),this.lf(g,h)):this.ue(d),this.ue(a)}else{n=this.isAvoiding;p&&(m&&n||l)&&this.Uj();var z=l?this.computeCurviness():0;n=this.getLinkPoint(b,c,d,!0,m,e,f);r=u=q=0;if(m||!h||l)v=this.computeEndSegmentLength(b,c,d,!0),r=this.getLinkDirection(b,c,n,d,!0,m,e,f),l&&(h||d.A(a)||!m&&1===d.x+
a.x&&1===d.y+a.y)&&(r-=m?90:30,0>z&&(r-=180)),0>r?r+=360:360<=r&&(r-=360),l&&(v+=Math.abs(z)*(m?1:2)),0===r?q=v:90===r?u=v:180===r?q=-v:270===r?u=-v:(q=v*Math.cos(r*Math.PI/180),u=v*Math.sin(r*Math.PI/180)),d.jc()&&l&&(v=c.ga(Bc,H.alloc()),w=H.allocAt(v.x+1E3*q,v.y+1E3*u),this.getLinkPointFromPoint(b,c,v,w,!0,n),H.free(v),H.free(w));v=this.getLinkPoint(e,f,a,!1,m,b,c);var A=y=w=0;if(m||!k||l){var C=this.computeEndSegmentLength(e,f,a,!1);A=this.getLinkDirection(e,f,v,a,!1,m,b,c);l&&(k||d.A(a)||!m&&
1===d.x+a.x&&1===d.y+a.y)&&(A+=m?0:30,0>z&&(A+=180));0>A?A+=360:360<=A&&(A-=360);l&&(C+=Math.abs(z)*(m?1:2));0===A?w=C:90===A?y=C:180===A?w=-C:270===A?y=-C:(w=C*Math.cos(A*Math.PI/180),y=C*Math.sin(A*Math.PI/180));a.jc()&&l&&(a=f.ga(Bc,H.alloc()),d=H.allocAt(a.x+1E3*w,a.y+1E3*y),this.getLinkPointFromPoint(e,f,a,d,!1,v),H.free(a),H.free(d))}a=n;if(m||!h||l)a=new H(n.x+q,n.y+u);d=v;if(m||!k||l)d=new H(v.x+w,v.y+y);!p&&!m&&h&&3e*w*c))){v=A.opacity;y=1;if(1!==v){if(0===v)continue;y=b.globalAlpha;b.globalAlpha=y*v}z=p[u];var C=!1,J=A.strokeDashArray;null!==J&&(C=!0,b.Ts(J,A.strokeDashOffset));if("LineV"===A.figure&&null!==A.stroke){b.lineWidth=A.strokeWidth;ji(a,b,A.stroke,!1,!1,f,g);b.beginPath();for(J=A=Math.floor(-n.x/e);J<=A+l;J++){var K=J*e+n.x;0<=K&&K<=h&&Jm(J,w,z)&&(b.moveTo(K,0),b.lineTo(K,k))}b.stroke()}else if("LineH"===A.figure&&null!==A.stroke){b.lineWidth=A.strokeWidth;ji(a,b,
A.stroke,!1,!1,f,g);b.beginPath();for(J=A=Math.floor(-n.y/d);J<=A+m;J++)K=J*d+n.y,0<=K&&K<=k&&Jm(J,w,z)&&(b.moveTo(0,K),b.lineTo(h,K));b.stroke()}else if("BarV"===A.figure&&null!==A.fill)for(ji(a,b,A.fill,!0,!1,f,g),A=A.width,isNaN(A)&&(A=e),K=J=Math.floor(-n.x/e);K<=J+l;K++){var L=K*e+n.x;0<=L&&L<=h&&Jm(K,w,z)&&b.fillRect(L,0,A,k)}else if("BarH"===A.figure&&null!==A.fill)for(ji(a,b,A.fill,!0,!1,f,g),A=A.height,isNaN(A)&&(A=d),K=J=Math.floor(-n.y/d);K<=J+m;K++)L=K*d+n.y,0<=L&&L<=k&&Jm(K,w,z)&&b.fillRect(0,
L,h,A);C&&b.Rs();1!==v&&(b.globalAlpha=y)}}b.restore();b.Qc(!1)};function Jm(a,b,c){if(0!==a%b)return!1;b=c.length;for(var d=0;df)w.measure(Infinity,Infinity,0,0),y=w.measuredBounds,b.Hc(y),a.l.push(y);else{var z=w.segmentIndex;y=w.segmentFraction;var A=w.alignmentFocus;A.jc()&&(A=Bc);var C=w.segmentOrientation,J=w.segmentOffset;if(z<-f||z>=f){y=k.midPoint;var K=k.midAngle;if(C!==pg){var L=k.computeAngle(w,C,
K);w.cc=L}L=y.x-m.x;var V=y.y-m.y}else{L=0;if(0<=z){V=n.L(z);var R=z
w*w)for(null===v.Ji&&(po(v,4,k,l,c),po(v,16,k,l,c)),k=v.Ji,l=k.length,q=0;q