1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-14 15:20:06 +02:00
copilot/legacy/spikes/architecture/sigmajs/vendor/plugins/sigma.renderers.parallelEdges.min.js
Sérgio Ramos 8295bd6882 chore: initial lerna setup
this shall be a progressive process
2017-05-25 10:56:50 +01:00

1 line
5.3 KiB
JavaScript

!function(){"use strict";sigma.utils.pkg("sigma.canvas.edgehovers"),sigma.canvas.edgehovers.curve=function(a,b,c,d,e){var f=a.color,g=e("prefix")||"",h=e("edgeHoverSizeRatio")*(a[g+"size"]||1),i=a.count||0,j=e("edgeColor"),k=e("defaultNodeColor"),l=e("defaultEdgeColor"),m={},n=b[g+"size"],o=b[g+"x"],p=b[g+"y"],q=c[g+"x"],r=c[g+"y"];if(m=b.id===c.id?sigma.utils.getSelfLoopControlPoints(o,p,n,i):sigma.utils.getQuadraticControlPoint(o,p,q,r,i),!f)switch(j){case"source":f=b.color||k;break;case"target":f=c.color||k;break;default:f=l}f="edge"===e("edgeHoverColor")?a.hover_color||f:a.hover_color||e("defaultEdgeHoverColor")||f,d.strokeStyle=f,d.lineWidth=h,d.beginPath(),d.moveTo(o,p),b.id===c.id?d.bezierCurveTo(m.x1,m.y1,m.x2,m.y2,q,r):d.quadraticCurveTo(m.x,m.y,q,r),d.stroke()}}(),function(){"use strict";sigma.utils.pkg("sigma.canvas.edgehovers"),sigma.canvas.edgehovers.curvedArrow=function(a,b,c,d,e){var f,g,h,i,j,k,l=a.color,m=e("prefix")||"",n=e("edgeColor"),o=e("defaultNodeColor"),p=e("defaultEdgeColor"),q={},r=e("edgeHoverSizeRatio")*(a[m+"size"]||1),s=a.count||0,t=c[m+"size"],u=b[m+"x"],v=b[m+"y"],w=c[m+"x"],x=c[m+"y"];if(q=b.id===c.id?sigma.utils.getSelfLoopControlPoints(u,v,t,s):sigma.utils.getQuadraticControlPoint(u,v,w,x,s),b.id===c.id?(f=Math.sqrt(Math.pow(w-q.x1,2)+Math.pow(x-q.y1,2)),g=2.5*r,h=q.x1+(w-q.x1)*(f-g-t)/f,i=q.y1+(x-q.y1)*(f-g-t)/f,j=(w-q.x1)*g/f,k=(x-q.y1)*g/f):(f=Math.sqrt(Math.pow(w-q.x,2)+Math.pow(x-q.y,2)),g=2.5*r,h=q.x+(w-q.x)*(f-g-t)/f,i=q.y+(x-q.y)*(f-g-t)/f,j=(w-q.x)*g/f,k=(x-q.y)*g/f),!l)switch(n){case"source":l=b.color||o;break;case"target":l=c.color||o;break;default:l=p}l="edge"===e("edgeHoverColor")?a.hover_color||l:a.hover_color||e("defaultEdgeHoverColor")||l,d.strokeStyle=l,d.lineWidth=r,d.beginPath(),d.moveTo(u,v),b.id===c.id?d.bezierCurveTo(q.x2,q.y2,q.x1,q.y1,h,i):d.quadraticCurveTo(q.x,q.y,h,i),d.stroke(),d.fillStyle=l,d.beginPath(),d.moveTo(h+j,i+k),d.lineTo(h+.6*k,i-.6*j),d.lineTo(h-.6*k,i+.6*j),d.lineTo(h+j,i+k),d.closePath(),d.fill()}}(),function(){"use strict";sigma.utils.pkg("sigma.canvas.edges"),sigma.canvas.edges.curve=function(a,b,c,d,e){var f=a.color,g=e("prefix")||"",h=a[g+"size"]||1,i=a.count||0,j=e("edgeColor"),k=e("defaultNodeColor"),l=e("defaultEdgeColor"),m={},n=b[g+"size"],o=b[g+"x"],p=b[g+"y"],q=c[g+"x"],r=c[g+"y"];if(m=b.id===c.id?sigma.utils.getSelfLoopControlPoints(o,p,n,i):sigma.utils.getQuadraticControlPoint(o,p,q,r,i),!f)switch(j){case"source":f=b.color||k;break;case"target":f=c.color||k;break;default:f=l}d.strokeStyle=f,d.lineWidth=h,d.beginPath(),d.moveTo(o,p),b.id===c.id?d.bezierCurveTo(m.x1,m.y1,m.x2,m.y2,q,r):d.quadraticCurveTo(m.x,m.y,q,r),d.stroke()}}(),function(){"use strict";sigma.utils.pkg("sigma.canvas.edges"),sigma.canvas.edges.curvedArrow=function(a,b,c,d,e){var f,g,h,i,j,k=a.color,l=e("prefix")||"",m=e("edgeColor"),n=e("defaultNodeColor"),o=e("defaultEdgeColor"),p={},q=a[l+"size"]||1,r=a.count||0,s=c[l+"size"],t=b[l+"x"],u=b[l+"y"],v=c[l+"x"],w=c[l+"y"],x=Math.max(2.5*q,e("minArrowSize"));if(p=b.id===c.id?sigma.utils.getSelfLoopControlPoints(t,u,s,r):sigma.utils.getQuadraticControlPoint(t,u,v,w,r),b.id===c.id?(f=Math.sqrt(Math.pow(v-p.x1,2)+Math.pow(w-p.y1,2)),g=p.x1+(v-p.x1)*(f-x-s)/f,h=p.y1+(w-p.y1)*(f-x-s)/f,i=(v-p.x1)*x/f,j=(w-p.y1)*x/f):(f=Math.sqrt(Math.pow(v-p.x,2)+Math.pow(w-p.y,2)),g=p.x+(v-p.x)*(f-x-s)/f,h=p.y+(w-p.y)*(f-x-s)/f,i=(v-p.x)*x/f,j=(w-p.y)*x/f),!k)switch(m){case"source":k=b.color||n;break;case"target":k=c.color||n;break;default:k=o}d.strokeStyle=k,d.lineWidth=q,d.beginPath(),d.moveTo(t,u),b.id===c.id?d.bezierCurveTo(p.x2,p.y2,p.x1,p.y1,g,h):d.quadraticCurveTo(p.x,p.y,g,h),d.stroke(),d.fillStyle=k,d.beginPath(),d.moveTo(g+i,h+j),d.lineTo(g+.6*j,h-.6*i),d.lineTo(g-.6*j,h+.6*i),d.lineTo(g+i,h+j),d.closePath(),d.fill()}}(),function(a){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.canvas.edges.labels"),sigma.canvas.edges.labels.curve=function(a,b,c,d,e){if("string"==typeof a.label){var f=e("prefix")||"",g=a[f+"size"]||1;if(!(g<e("edgeLabelThreshold"))){var h,i,j,k=b[f+"size"],l=a.count||0,m=b[f+"x"],n=b[f+"y"],o=c[f+"x"],p=c[f+"y"],q=o-m,r=p-n,s=m<o?1:-1,t={},u=.5;b.id===c.id?(t=sigma.utils.getSelfLoopControlPoints(m,n,k,l),i=sigma.utils.getPointOnBezierCurve(u,m,n,o,p,t.x1,t.y1,t.x2,t.y2),j=Math.atan2(1,1)):(t=sigma.utils.getQuadraticControlPoint(m,n,o,p,l),i=sigma.utils.getPointOnQuadraticCurve(u,m,n,o,p,t.x,t.y),j=Math.atan2(r*s,q*s)),h="fixed"===e("edgeLabelSize")?e("defaultEdgeLabelSize"):e("defaultEdgeLabelSize")*g*Math.pow(g,-1/e("edgeLabelSizePowRatio")),d.save(),a.active?(d.font=[e("activeFontStyle"),h+"px",e("activeFont")||e("font")].join(" "),d.fillStyle="edge"===e("edgeActiveColor")?a.active_color||e("defaultEdgeActiveColor"):e("defaultEdgeLabelActiveColor")):(d.font=[e("fontStyle"),h+"px",e("font")].join(" "),d.fillStyle="edge"===e("edgeLabelColor")?a.color||e("defaultEdgeColor"):e("defaultEdgeLabelColor")),d.textAlign="center",d.textBaseline="alphabetic",d.translate(i.x,i.y),d.rotate(j),d.fillText(a.label,0,-g/2-3),d.restore()}}}}.call(this),function(a){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils=sigma.utils||{},sigma.utils.getQuadraticControlPoint=function(a,b,c,d,e){return e=e||0,{x:(a+c)/2+(d-b)/(60/(15+e)),y:(b+d)/2+(a-c)/(60/(15+e))}},sigma.utils.getSelfLoopControlPoints=function(a,b,c,d){return d=d||0,{x1:a-7*(c+d),y1:b,x2:a,y2:b+7*(c+d)}}}.call(this);