a.y)}function m(a,b,c,d,e){var f=-3*b+9*c-9*d+3*e,g=a*f+6*b-12*c+6*d;return a*g-3*b+3*c}function n(a,b,c,d,e,f,g,h,i){null==i&&(i=1),i=i>1?1:0>i?0:i;for(var j=i/2,k=12,l=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],n=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],o=0,p=0;k>p;p++){var q=j*l[p]+j,r=m(q,a,c,e,g),s=m(q,b,d,f,h),t=r*r+s*s;o+=n[p]*N.sqrt(t)}return j*o}function o(a,b,c,d,e,f,g,h,i){if(!(0>i||n(a,b,c,d,e,f,g,h)o;)l/=2,m+=(i>j?1:-1)*l,j=n(a,b,c,d,e,f,g,h,m);return m}}function p(a,b,c,d,e,f,g,h){if(!(Q(a,c)Q(e,g)||Q(b,d)
Q(f,h))){var i=(a*d-b*c)*(e-g)-(a-c)*(e*h-f*g),j=(a*d-b*c)*(f-h)-(b-d)*(e*h-f*g),k=(a-c)*(f-h)-(b-d)*(e-g);if(k){var l=i/k,m=j/k,n=+l.toFixed(2),o=+m.toFixed(2);if(!(n<+P(a,c).toFixed(2)||n>+Q(a,c).toFixed(2)||n<+P(e,g).toFixed(2)||n>+Q(e,g).toFixed(2)||o<+P(b,d).toFixed(2)||o>+Q(b,d).toFixed(2)||o<+P(f,h).toFixed(2)||o>+Q(f,h).toFixed(2)))return{x:l,y:m}}}}function q(a,b,c){var d=j(a),e=j(b);if(!l(d,e))return c?0:[];for(var f=n.apply(0,a),g=n.apply(0,b),h=~~(f/5),k=~~(g/5),m=[],o=[],q={},r=c?0:[],s=0;h+1>s;s++){var t=i.apply(0,a.concat(s/h));m.push({x:t.x,y:t.y,t:s/h})}for(s=0;k+1>s;s++)t=i.apply(0,b.concat(s/k)),o.push({x:t.x,y:t.y,t:s/k});for(s=0;h>s;s++)for(var u=0;k>u;u++){var v=m[s],w=m[s+1],x=o[u],y=o[u+1],z=S(w.x-v.x)<.001?"y":"x",A=S(y.x-x.x)<.001?"y":"x",B=p(v.x,v.y,w.x,w.y,x.x,x.y,y.x,y.y);if(B){if(q[B.x.toFixed(4)]==B.y.toFixed(4))continue;q[B.x.toFixed(4)]=B.y.toFixed(4);var C=v.t+S((B[z]-v[z])/(w[z]-v[z]))*(w.t-v.t),D=x.t+S((B[A]-x[A])/(y[A]-x[A]))*(y.t-x.t);C>=0&&1>=C&&D>=0&&1>=D&&(c?r++:r.push({x:B.x,y:B.y,t1:C,t2:D}))}}return r}function r(a,b){return t(a,b)}function s(a,b){return t(a,b,1)}function t(a,b,c){a=E(a),b=E(b);for(var d,e,f,g,h,i,j,k,l,m,n=c?0:[],o=0,p=a.length;p>o;o++){var r=a[o];if("M"==r[0])d=h=r[1],e=i=r[2];else{"C"==r[0]?(l=[d,e].concat(r.slice(1)),d=l[6],e=l[7]):(l=[d,e,d,e,h,i,h,i],d=h,e=i);for(var s=0,t=b.length;t>s;s++){var u=b[s];if("M"==u[0])f=j=u[1],g=k=u[2];else{"C"==u[0]?(m=[f,g].concat(u.slice(1)),f=m[6],g=m[7]):(m=[f,g,f,g,j,k,j,k],f=j,g=k);var v=q(l,m,c);if(c)n+=v;else{for(var w=0,x=v.length;x>w;w++)v[w].segment1=o,v[w].segment2=s,v[w].bez1=l,v[w].bez2=m;n=n.concat(v)}}}}}return n}function u(a,b,c){var d=v(a);return k(d,b,c)&&t(a,[["M",b,c],["H",d.x2+10]],1)%2==1}function v(a){var b=c(a);if(b.bbox)return J(b.bbox);if(!a)return d();a=E(a);for(var e,f=0,g=0,h=[],i=[],j=0,k=a.length;k>j;j++)if(e=a[j],"M"==e[0])f=e[1],g=e[2],h.push(f),i.push(g);else{var l=D(f,g,e[1],e[2],e[3],e[4],e[5],e[6]);h=h.concat(l.min.x,l.max.x),i=i.concat(l.min.y,l.max.y),f=e[5],g=e[6]}var m=P.apply(0,h),n=P.apply(0,i),o=Q.apply(0,h),p=Q.apply(0,i),q=d(m,n,o-m,p-n);return b.bbox=J(q),q}function w(a,b,c,d,f){if(f)return[["M",+a+ +f,b],["l",c-2*f,0],["a",f,f,0,0,1,f,f],["l",0,d-2*f],["a",f,f,0,0,1,-f,f],["l",2*f-c,0],["a",f,f,0,0,1,-f,-f],["l",0,2*f-d],["a",f,f,0,0,1,f,-f],["z"]];var g=[["M",a,b],["l",c,0],["l",0,d],["l",-c,0],["z"]];return g.toString=e,g}function x(a,b,c,d,f){if(null==f&&null==d&&(d=c),a=+a,b=+b,c=+c,d=+d,null!=f)var g=Math.PI/180,h=a+c*Math.cos(-d*g),i=a+c*Math.cos(-f*g),j=b+c*Math.sin(-d*g),k=b+c*Math.sin(-f*g),l=[["M",h,j],["A",c,c,0,+(f-d>180),0,i,k]];else l=[["M",a,b],["m",0,-d],["a",c,d,0,1,1,0,2*d],["a",c,d,0,1,1,0,-2*d],["z"]];return l.toString=e,l}function y(b){var d=c(b),g=String.prototype.toLowerCase;if(d.rel)return f(d.rel);a.is(b,"array")&&a.is(b&&b[0],"array")||(b=a.parsePathString(b));var h=[],i=0,j=0,k=0,l=0,m=0;"M"==b[0][0]&&(i=b[0][1],j=b[0][2],k=i,l=j,m++,h.push(["M",i,j]));for(var n=m,o=b.length;o>n;n++){var p=h[n]=[],q=b[n];if(q[0]!=g.call(q[0]))switch(p[0]=g.call(q[0]),p[0]){case"a":p[1]=q[1],p[2]=q[2],p[3]=q[3],p[4]=q[4],p[5]=q[5],p[6]=+(q[6]-i).toFixed(3),p[7]=+(q[7]-j).toFixed(3);break;case"v":p[1]=+(q[1]-j).toFixed(3);break;case"m":k=q[1],l=q[2];default:for(var r=1,s=q.length;s>r;r++)p[r]=+(q[r]-(r%2?i:j)).toFixed(3)}else{p=h[n]=[],"m"==q[0]&&(k=q[1]+i,l=q[2]+j);for(var t=0,u=q.length;u>t;t++)h[n][t]=q[t]}var v=h[n].length;switch(h[n][0]){case"z":i=k,j=l;break;case"h":i+=+h[n][v-1];break;case"v":j+=+h[n][v-1];break;default:i+=+h[n][v-2],j+=+h[n][v-1]}}return h.toString=e,d.rel=f(h),h}function z(b){var d=c(b);if(d.abs)return f(d.abs);if(I(b,"array")&&I(b&&b[0],"array")||(b=a.parsePathString(b)),!b||!b.length)return[["M",0,0]];var g,h=[],i=0,j=0,k=0,l=0,m=0;"M"==b[0][0]&&(i=+b[0][1],j=+b[0][2],k=i,l=j,m++,h[0]=["M",i,j]);for(var n,o,p=3==b.length&&"M"==b[0][0]&&"R"==b[1][0].toUpperCase()&&"Z"==b[2][0].toUpperCase(),q=m,r=b.length;r>q;q++){if(h.push(n=[]),o=b[q],g=o[0],g!=g.toUpperCase())switch(n[0]=g.toUpperCase(),n[0]){case"A":n[1]=o[1],n[2]=o[2],n[3]=o[3],n[4]=o[4],n[5]=o[5],n[6]=+o[6]+i,n[7]=+o[7]+j;break;case"V":n[1]=+o[1]+j;break;case"H":n[1]=+o[1]+i;break;case"R":for(var s=[i,j].concat(o.slice(1)),t=2,u=s.length;u>t;t++)s[t]=+s[t]+i,s[++t]=+s[t]+j;h.pop(),h=h.concat(G(s,p));break;case"O":h.pop(),s=x(i,j,o[1],o[2]),s.push(s[0]),h=h.concat(s);break;case"U":h.pop(),h=h.concat(x(i,j,o[1],o[2],o[3])),n=["U"].concat(h[h.length-1].slice(-2));break;case"M":k=+o[1]+i,l=+o[2]+j;default:for(t=1,u=o.length;u>t;t++)n[t]=+o[t]+(t%2?i:j)}else if("R"==g)s=[i,j].concat(o.slice(1)),h.pop(),h=h.concat(G(s,p)),n=["R"].concat(o.slice(-2));else if("O"==g)h.pop(),s=x(i,j,o[1],o[2]),s.push(s[0]),h=h.concat(s);else if("U"==g)h.pop(),h=h.concat(x(i,j,o[1],o[2],o[3])),n=["U"].concat(h[h.length-1].slice(-2));else for(var v=0,w=o.length;w>v;v++)n[v]=o[v];if(g=g.toUpperCase(),"O"!=g)switch(n[0]){case"Z":i=+k,j=+l;break;case"H":i=n[1];break;case"V":j=n[1];break;case"M":k=n[n.length-2],l=n[n.length-1];default:i=n[n.length-2],j=n[n.length-1]}}return h.toString=e,d.abs=f(h),h}function A(a,b,c,d){return[a,b,c,d,c,d]}function B(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]}function C(b,c,d,e,f,g,h,i,j,k){var l,m=120*O/180,n=O/180*(+f||0),o=[],p=a._.cacher(function(a,b,c){var d=a*N.cos(c)-b*N.sin(c),e=a*N.sin(c)+b*N.cos(c);return{x:d,y:e}});if(k)y=k[0],z=k[1],w=k[2],x=k[3];else{l=p(b,c,-n),b=l.x,c=l.y,l=p(i,j,-n),i=l.x,j=l.y;var q=(N.cos(O/180*f),N.sin(O/180*f),(b-i)/2),r=(c-j)/2,s=q*q/(d*d)+r*r/(e*e);s>1&&(s=N.sqrt(s),d=s*d,e=s*e);var t=d*d,u=e*e,v=(g==h?-1:1)*N.sqrt(S((t*u-t*r*r-u*q*q)/(t*r*r+u*q*q))),w=v*d*r/e+(b+i)/2,x=v*-e*q/d+(c+j)/2,y=N.asin(((c-x)/e).toFixed(9)),z=N.asin(((j-x)/e).toFixed(9));y=w>b?O-y:y,z=w>i?O-z:z,0>y&&(y=2*O+y),0>z&&(z=2*O+z),h&&y>z&&(y-=2*O),!h&&z>y&&(z-=2*O)}var A=z-y;if(S(A)>m){var B=z,D=i,E=j;z=y+m*(h&&z>y?1:-1),i=w+d*N.cos(z),j=x+e*N.sin(z),o=C(i,j,d,e,f,0,h,D,E,[z,B,w,x])}A=z-y;var F=N.cos(y),G=N.sin(y),H=N.cos(z),I=N.sin(z),J=N.tan(A/4),K=4/3*d*J,L=4/3*e*J,M=[b,c],P=[b+K*G,c-L*F],Q=[i+K*I,j-L*H],R=[i,j];if(P[0]=2*M[0]-P[0],P[1]=2*M[1]-P[1],k)return[P,Q,R].concat(o);o=[P,Q,R].concat(o).join().split(",");for(var T=[],U=0,V=o.length;V>U;U++)T[U]=U%2?p(o[U-1],o[U],n).y:p(o[U],o[U+1],n).x;return T}function D(a,b,c,d,e,f,g,h){for(var i,j,k,l,m,n,o,p,q=[],r=[[],[]],s=0;2>s;++s)if(0==s?(j=6*a-12*c+6*e,i=-3*a+9*c-9*e+3*g,k=3*c-3*a):(j=6*b-12*d+6*f,i=-3*b+9*d-9*f+3*h,k=3*d-3*b),S(i)<1e-12){if(S(j)<1e-12)continue;l=-k/j,l>0&&1>l&&q.push(l)}else o=j*j-4*k*i,p=N.sqrt(o),0>o||(m=(-j+p)/(2*i),m>0&&1>m&&q.push(m),n=(-j-p)/(2*i),n>0&&1>n&&q.push(n));for(var t,u=q.length,v=u;u--;)l=q[u],t=1-l,r[0][u]=t*t*t*a+3*t*t*l*c+3*t*l*l*e+l*l*l*g,r[1][u]=t*t*t*b+3*t*t*l*d+3*t*l*l*f+l*l*l*h;return r[0][v]=a,r[1][v]=b,r[0][v+1]=g,r[1][v+1]=h,r[0].length=r[1].length=v+2,{min:{x:P.apply(0,r[0]),y:P.apply(0,r[1])},max:{x:Q.apply(0,r[0]),y:Q.apply(0,r[1])}}}function E(a,b){var d=!b&&c(a);if(!b&&d.curve)return f(d.curve);for(var e=z(a),g=b&&z(b),h={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},j=(function(a,b,c){var d,e;if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];switch(!(a[0]in{T:1,Q:1})&&(b.qx=b.qy=null),a[0]){case"M":b.X=a[1],b.Y=a[2];break;case"A":a=["C"].concat(C.apply(0,[b.x,b.y].concat(a.slice(1))));break;case"S":"C"==c||"S"==c?(d=2*b.x-b.bx,e=2*b.y-b.by):(d=b.x,e=b.y),a=["C",d,e].concat(a.slice(1));break;case"T":"Q"==c||"T"==c?(b.qx=2*b.x-b.qx,b.qy=2*b.y-b.qy):(b.qx=b.x,b.qy=b.y),a=["C"].concat(B(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case"Q":b.qx=a[1],b.qy=a[2],a=["C"].concat(B(b.x,b.y,a[1],a[2],a[3],a[4]));break;case"L":a=["C"].concat(A(b.x,b.y,a[1],a[2]));break;case"H":a=["C"].concat(A(b.x,b.y,a[1],b.y));break;case"V":a=["C"].concat(A(b.x,b.y,b.x,a[1]));break;case"Z":a=["C"].concat(A(b.x,b.y,b.X,b.Y))}return a}),k=function(a,b){if(a[b].length>7){a[b].shift();for(var c=a[b];c.length;)m[b]="A",g&&(n[b]="A"),a.splice(b++,0,["C"].concat(c.splice(0,6)));a.splice(b,1),r=Q(e.length,g&&g.length||0)}},l=function(a,b,c,d,f){a&&b&&"M"==a[f][0]&&"M"!=b[f][0]&&(b.splice(f,0,["M",d.x,d.y]),c.bx=0,c.by=0,c.x=a[f][1],c.y=a[f][2],r=Q(e.length,g&&g.length||0))},m=[],n=[],o="",p="",q=0,r=Q(e.length,g&&g.length||0);r>q;q++){e[q]&&(o=e[q][0]),"C"!=o&&(m[q]=o,q&&(p=m[q-1])),e[q]=j(e[q],h,p),"A"!=m[q]&&"C"==o&&(m[q]="C"),k(e,q),g&&(g[q]&&(o=g[q][0]),"C"!=o&&(n[q]=o,q&&(p=n[q-1])),g[q]=j(g[q],i,p),"A"!=n[q]&&"C"==o&&(n[q]="C"),k(g,q)),l(e,g,h,i,q),l(g,e,i,h,q);var s=e[q],t=g&&g[q],u=s.length,v=g&&t.length;h.x=s[u-2],h.y=s[u-1],h.bx=M(s[u-4])||h.x,h.by=M(s[u-3])||h.y,i.bx=g&&(M(t[v-4])||i.x),i.by=g&&(M(t[v-3])||i.y),i.x=g&&t[v-2],i.y=g&&t[v-1]}return g||(d.curve=f(e)),g?[e,g]:e}function F(a,b){if(!b)return a;var c,d,e,f,g,h,i;for(a=E(a),e=0,g=a.length;g>e;e++)for(i=a[e],f=1,h=i.length;h>f;f+=2)c=b.x(i[f],i[f+1]),d=b.y(i[f],i[f+1]),i[f]=c,i[f+1]=d;return a}function G(a,b){for(var c=[],d=0,e=a.length;e-2*!b>d;d+=2){var f=[{x:+a[d-2],y:+a[d-1]},{x:+a[d],y:+a[d+1]},{x:+a[d+2],y:+a[d+3]},{x:+a[d+4],y:+a[d+5]}];b?d?e-4==d?f[3]={x:+a[0],y:+a[1]}:e-2==d&&(f[2]={x:+a[0],y:+a[1]},f[3]={x:+a[2],y:+a[3]}):f[0]={x:+a[e-2],y:+a[e-1]}:e-4==d?f[3]=f[2]:d||(f[0]={x:+a[d],y:+a[d+1]}),c.push(["C",(-f[0].x+6*f[1].x+f[2].x)/6,(-f[0].y+6*f[1].y+f[2].y)/6,(f[1].x+6*f[2].x-f[3].x)/6,(f[1].y+6*f[2].y-f[3].y)/6,f[2].x,f[2].y])}return c}var H=b.prototype,I=a.is,J=a._.clone,K="hasOwnProperty",L=/,?([a-z]),?/gi,M=parseFloat,N=Math,O=N.PI,P=N.min,Q=N.max,R=N.pow,S=N.abs,T=h(1),U=h(),V=h(0,1),W=a._unit2px,X={path:function(a){return a.attr("path")},circle:function(a){var b=W(a);return x(b.cx,b.cy,b.r)},ellipse:function(a){var b=W(a);return x(b.cx||0,b.cy||0,b.rx,b.ry)},rect:function(a){var b=W(a);return w(b.x||0,b.y||0,b.width,b.height,b.rx,b.ry)},image:function(a){var b=W(a);return w(b.x||0,b.y||0,b.width,b.height)},text:function(a){var b=a.node.getBBox();return w(b.x,b.y,b.width,b.height)},g:function(a){var b=a.node.getBBox();return w(b.x,b.y,b.width,b.height)},symbol:function(a){var b=a.getBBox();return w(b.x,b.y,b.width,b.height)},line:function(a){return"M"+[a.attr("x1")||0,a.attr("y1")||0,a.attr("x2"),a.attr("y2")]},polyline:function(a){return"M"+a.attr("points")},polygon:function(a){return"M"+a.attr("points")+"z"},svg:function(a){var b=a.node.getBBox();return w(b.x,b.y,b.width,b.height)},deflt:function(a){var b=a.node.getBBox();return w(b.x,b.y,b.width,b.height)}};a.path=c,a.path.getTotalLength=T,a.path.getPointAtLength=U,a.path.getSubpath=function(a,b,c){if(this.getTotalLength(a)-c<1e-6)return V(a,b).end;var d=V(a,c,1);return b?V(d,b).end:d},H.getTotalLength=function(){return this.node.getTotalLength?this.node.getTotalLength():void 0},H.getPointAtLength=function(a){return U(this.attr("d"),a)},H.getSubpath=function(b,c){return a.path.getSubpath(this.attr("d"),b,c)},a._.box=d,a.path.findDotsAtSegment=i,a.path.bezierBBox=j,a.path.isPointInsideBBox=k,a.path.isBBoxIntersect=l,a.path.intersection=r,a.path.intersectionNumber=s,a.path.isPointInside=u,a.path.getBBox=v,a.path.get=X,a.path.toRelative=y,a.path.toAbsolute=z,a.path.toCubic=E,a.path.map=F,a.path.toString=e,a.path.clone=f}),d.plugin(function(a){var d=Math.max,e=Math.min,f=function(a){if(this.items=[],this.bindings={},this.length=0,this.type="set",a)for(var b=0,c=a.length;c>b;b++)a[b]&&(this[this.items.length]=this.items[this.items.length]=a[b],this.length++)},g=f.prototype;g.push=function(){for(var a,b,c=0,d=arguments.length;d>c;c++)a=arguments[c],a&&(b=this.items.length,this[b]=this.items[b]=a,this.length++);return this},g.pop=function(){return this.length&&delete this[this.length--],this.items.pop()},g.forEach=function(a,b){for(var c=0,d=this.items.length;d>c;c++)if(a.call(b,this.items[c],c)===!1)return this;return this},g.animate=function(d,e,f,g){"function"!=typeof f||f.length||(g=f,f=c.linear),d instanceof a._.Animation&&(g=d.callback,f=d.easing,e=f.dur,d=d.attr);var h,i=function(){h?this.b=h:h=this.b},j=0,k=g&&function(){j++==this.length&&g.call(this)};return this.forEach(function(a){b.once("snap.animcreated."+a.id,i),a.animate(d,e,f,k)})},g.animateEach=function(){var a,c=0,d=this,e=function(){a?this.b=a:a=this.b},f=arguments,g=function(a){var f=d[c++];return f&&(f.animate.apply(f,arguments.length>1?arguments:a),b.once("snap.animcreated."+f.id,e)),d[c]?g:d};return g(f)},g.remove=function(){for(;this.length;)this.pop().remove();return this},g.bind=function(a,b,c){var d={};if("function"==typeof b)this.bindings[a]=b;else{var e=c||a;this.bindings[a]=function(a){d[e]=a,b.attr(d)}}return this},g.attr=function(a){var b={};for(var c in a)this.bindings[c]?this.bindings[c](a[c]):b[c]=a[c];for(var d=0,e=this.items.length;e>d;d++)this.items[d].attr(b);return this},g.clear=function(){for(;this.length;)this.pop()},g.splice=function(a,b){a=0>a?d(this.length+a,0):a,b=d(0,e(this.length-a,b));var c,g=[],h=[],i=[];for(c=2;cc;c++)h.push(this[a+c]);for(;cc?i[c]:g[c-j];for(c=this.items.length=this.length-=b-j;this[c];)delete this[c++];return new f(h)},g.exclude=function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]==a)return this.splice(b,1),!0;return!1},g.insertAfter=function(a){for(var b=this.items.length;b--;)this.items[b].insertAfter(a);return this},g.getBBox=function(){for(var a=[],b=[],c=[],f=[],g=this.items.length;g--;)if(!this.items[g].removed){var h=this.items[g].getBBox();a.push(h.x),b.push(h.y),c.push(h.x+h.width),f.push(h.y+h.height)}return a=e.apply(0,a),b=e.apply(0,b),c=d.apply(0,c),f=d.apply(0,f),{x:a,y:b,x2:c,y2:f,width:c-a,height:f-b,cx:a+(c-a)/2,cy:b+(f-b)/2}},g.clone=function(a){a=new f;for(var b=0,c=this.items.length;c>b;b++)a.push(this.items[b].clone());return a},g.toString=function(){return"Snap‘s set"},g.type="set",a.set=function(){var a=new f;return arguments.length&&a.push.apply(a,Array.prototype.slice.call(arguments,0)),a}}),d.plugin(function(a,b){function c(a){var b=a[0];switch(b.toLowerCase()){case"t":return[b,0,0];case"m":return[b,1,0,0,1,0,0];case"r":return 4==a.length?[b,0,a[2],a[3]]:[b,0];case"s":return 5==a.length?[b,1,1,a[3],a[4]]:3==a.length?[b,1,1]:[b,1]}}function d(b,d,e){d=l(d).replace(/\.{3}|\u2026/g,b),b=a.parseTransformString(b)||[],d=a.parseTransformString(d)||[];for(var f,g,j,k,m=Math.max(b.length,d.length),n=[],o=[],p=0;m>p;p++){if(j=b[p]||c(d[p]),k=d[p]||c(j),j[0]!=k[0]||"r"==j[0].toLowerCase()&&(j[2]!=k[2]||j[3]!=k[3])||"s"==j[0].toLowerCase()&&(j[3]!=k[3]||j[4]!=k[4])){b=a._.transform2matrix(b,e()),d=a._.transform2matrix(d,e()),n=[["m",b.a,b.b,b.c,b.d,b.e,b.f]],o=[["m",d.a,d.b,d.c,d.d,d.e,d.f]];break}for(n[p]=[],o[p]=[],f=0,g=Math.max(j.length,k.length);g>f;f++)f in j&&(n[p][f]=j[f]),f in k&&(o[p][f]=k[f])}return{from:i(n),to:i(o),f:h(n)}}function e(a){return a}function f(a){return function(b){return+b.toFixed(3)+a}}function g(b){return a.rgb(b[0],b[1],b[2])}function h(a){var b,c,d,e,f,g,h=0,i=[];for(b=0,c=a.length;c>b;b++){for(f="[",g=['"'+a[b][0]+'"'],d=1,e=a[b].length;e>d;d++)g[d]="val["+h++ +"]";f+=g+"]",i[b]=f}return Function("val","return Snap.path.toString.call(["+i+"])")}function i(a){for(var b=[],c=0,d=a.length;d>c;c++)for(var e=1,f=a[c].length;f>e;e++)b.push(a[c][e]);return b}var j={},k=/[a-z]+$/i,l=String;j.stroke=j.fill="colour",b.prototype.equal=function(b,c){var m,n,o=l(this.attr(b)||""),p=this;if(o==+o&&c==+c)return{from:+o,to:+c,f:e};if("colour"==j[b])return m=a.color(o),n=a.color(c),{from:[m.r,m.g,m.b,m.opacity],to:[n.r,n.g,n.b,n.opacity],f:g};if("transform"==b||"gradientTransform"==b||"patternTransform"==b)return c instanceof a.Matrix&&(c=c.toTransformString()),a._.rgTransform.test(c)||(c=a._.svgTransform2string(c)),d(o,c,function(){return p.getBBox(1)});if("d"==b||"path"==b)return m=a.path.toCubic(o,c),{from:i(m[0]),to:i(m[1]),f:h(m[0])};if("points"==b)return m=l(o).split(","),n=l(c).split(","),{from:m,to:n,f:function(a){return a}};var q=o.match(k),r=l(c).match(k);return q&&q==r?{from:parseFloat(o),to:parseFloat(c),f:f(q)}:{from:this.asPX(b),to:this.asPX(b,c),f:e}}}),d.plugin(function(a,c,d,e){for(var f=c.prototype,g="hasOwnProperty",h=("createTouch"in e.doc),i=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","touchstart","touchmove","touchend","touchcancel"],j={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},k=function(a){var b="y"==a?"scrollTop":"scrollLeft";return e.doc.documentElement[b]||e.doc.body[b]},l=function(){this.returnValue=!1
-},m=function(){return this.originalEvent.preventDefault()},n=function(){this.cancelBubble=!0},o=function(){return this.originalEvent.stopPropagation()},p=function(){return e.doc.addEventListener?function(a,b,c,d){var e=h&&j[b]?j[b]:b,f=function(e){var f=k("y"),i=k("x");if(h&&j[g](b))for(var l=0,n=e.targetTouches&&e.targetTouches.length;n>l;l++)if(e.targetTouches[l].target==a||a.contains(e.targetTouches[l].target)){var p=e;e=e.targetTouches[l],e.originalEvent=p,e.preventDefault=m,e.stopPropagation=o;break}var q=e.clientX+i,r=e.clientY+f;return c.call(d,e,q,r)};return b!==e&&a.addEventListener(b,f,!1),a.addEventListener(e,f,!1),function(){return b!==e&&a.removeEventListener(b,f,!1),a.removeEventListener(e,f,!1),!0}}:e.doc.attachEvent?function(a,b,c,d){var f=function(a){a=a||e.win.event;var b=k("y"),f=k("x"),g=a.clientX+f,h=a.clientY+b;return a.preventDefault=a.preventDefault||l,a.stopPropagation=a.stopPropagation||n,c.call(d,a,g,h)};a.attachEvent("on"+b,f);var g=function(){return a.detachEvent("on"+b,f),!0};return g}:void 0}(),q=[],r=function(c){for(var d,e=c.clientX,f=c.clientY,g=k("y"),i=k("x"),j=q.length;j--;){if(d=q[j],h){for(var l,m=c.touches&&c.touches.length;m--;)if(l=c.touches[m],l.identifier==d.el._drag.id||d.el.node.contains(l.target)){e=l.clientX,f=l.clientY,(c.originalEvent?c.originalEvent:c).preventDefault();break}}else c.preventDefault();{var n=d.el.node;a._.glob,n.nextSibling,n.parentNode,n.style.display}e+=i,f+=g,b("snap.drag.move."+d.el.id,d.move_scope||d.el,e-d.el._drag.x,f-d.el._drag.y,e,f,c)}},s=function(c){a.unmousemove(r).unmouseup(s);for(var d,e=q.length;e--;)d=q[e],d.el._drag={},b("snap.drag.end."+d.el.id,d.end_scope||d.start_scope||d.move_scope||d.el,c);q=[]},t=i.length;t--;)!function(b){a[b]=f[b]=function(c,d){return a.is(c,"function")&&(this.events=this.events||[],this.events.push({name:b,f:c,unbind:p(this.shape||this.node||e.doc,b,c,d||this)})),this},a["un"+b]=f["un"+b]=function(a){for(var c=this.events||[],d=c.length;d--;)if(c[d].name==b&&(c[d].f==a||!a))return c[d].unbind(),c.splice(d,1),!c.length&&delete this.events,this;return this}}(i[t]);f.hover=function(a,b,c,d){return this.mouseover(a,c).mouseout(b,d||c)},f.unhover=function(a,b){return this.unmouseover(a).unmouseout(b)};var u=[];f.drag=function(c,d,e,f,g,h){function i(i,j,k){(i.originalEvent||i).preventDefault(),this._drag.x=j,this._drag.y=k,this._drag.id=i.identifier,!q.length&&a.mousemove(r).mouseup(s),q.push({el:this,move_scope:f,start_scope:g,end_scope:h}),d&&b.on("snap.drag.start."+this.id,d),c&&b.on("snap.drag.move."+this.id,c),e&&b.on("snap.drag.end."+this.id,e),b("snap.drag.start."+this.id,g||f||this,j,k,i)}if(!arguments.length){var j;return this.drag(function(a,b){this.attr({transform:j+(j?"T":"t")+[a,b]})},function(){j=this.transform().local})}return this._drag={},u.push({el:this,start:i}),this.mousedown(i),this},f.undrag=function(){for(var c=u.length;c--;)u[c].el==this&&(this.unmousedown(u[c].start),u.splice(c,1),b.unbind("snap.drag.*."+this.id));return!u.length&&a.unmousemove(r).unmouseup(s),this}}),d.plugin(function(a,c,d){var e=(c.prototype,d.prototype),f=/^\s*url\((.+)\)/,g=String,h=a._.$;a.filter={},e.filter=function(b){var d=this;"svg"!=d.type&&(d=d.paper);var e=a.parse(g(b)),f=a._.id(),i=(d.node.offsetWidth,d.node.offsetHeight,h("filter"));return h(i,{id:f,filterUnits:"userSpaceOnUse"}),i.appendChild(e.node),d.defs.appendChild(i),new c(i)},b.on("snap.util.getattr.filter",function(){b.stop();var c=h(this.node,"filter");if(c){var d=g(c).match(f);return d&&a.select(d[1])}}),b.on("snap.util.attr.filter",function(d){if(d instanceof c&&"filter"==d.type){b.stop();var e=d.node.id;e||(h(d.node,{id:d.id}),e=d.id),h(this.node,{filter:a.url(e)})}d&&"none"!=d||(b.stop(),this.node.removeAttribute("filter"))}),a.filter.blur=function(b,c){null==b&&(b=2);var d=null==c?b:[b,c];return a.format('',{def:d})},a.filter.blur.toString=function(){return this()},a.filter.shadow=function(b,c,d,e,f){return"string"==typeof d&&(e=d,f=e,d=4),"string"!=typeof e&&(f=e,e="#000"),e=e||"#000",null==d&&(d=4),null==f&&(f=1),null==b&&(b=0,c=2),null==c&&(c=b),e=a.color(e),a.format('',{color:e,dx:b,dy:c,blur:d,opacity:f})},a.filter.shadow.toString=function(){return this()},a.filter.grayscale=function(b){return null==b&&(b=1),a.format('',{a:.2126+.7874*(1-b),b:.7152-.7152*(1-b),c:.0722-.0722*(1-b),d:.2126-.2126*(1-b),e:.7152+.2848*(1-b),f:.0722-.0722*(1-b),g:.2126-.2126*(1-b),h:.0722+.9278*(1-b)})},a.filter.grayscale.toString=function(){return this()},a.filter.sepia=function(b){return null==b&&(b=1),a.format('',{a:.393+.607*(1-b),b:.769-.769*(1-b),c:.189-.189*(1-b),d:.349-.349*(1-b),e:.686+.314*(1-b),f:.168-.168*(1-b),g:.272-.272*(1-b),h:.534-.534*(1-b),i:.131+.869*(1-b)})},a.filter.sepia.toString=function(){return this()},a.filter.saturate=function(b){return null==b&&(b=1),a.format('',{amount:1-b})},a.filter.saturate.toString=function(){return this()},a.filter.hueRotate=function(b){return b=b||0,a.format('',{angle:b})},a.filter.hueRotate.toString=function(){return this()},a.filter.invert=function(b){return null==b&&(b=1),a.format('',{amount:b,amount2:1-b})},a.filter.invert.toString=function(){return this()},a.filter.brightness=function(b){return null==b&&(b=1),a.format('',{amount:b})},a.filter.brightness.toString=function(){return this()},a.filter.contrast=function(b){return null==b&&(b=1),a.format('',{amount:b,amount2:.5-b/2})},a.filter.contrast.toString=function(){return this()}}),d});
\ No newline at end of file
+},c.rotate=function(b,c,d){b=a.rad(b),c=c||0,d=d||0;var f=+e.cos(b).toFixed(9),g=+e.sin(b).toFixed(9);return this.add(f,g,-g,f,c,d),this.add(1,0,0,1,-c,-d)},c.x=function(a,b){return a*this.a+b*this.c+this.e},c.y=function(a,b){return a*this.b+b*this.d+this.f},c.get=function(a){return+this[d.fromCharCode(97+a)].toFixed(4)},c.toString=function(){return"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")"},c.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},c.determinant=function(){return this.a*this.d-this.b*this.c},c.split=function(){var b={};b.dx=this.e,b.dy=this.f;var c=[[this.a,this.c],[this.b,this.d]];b.scalex=e.sqrt(g(c[0])),h(c[0]),b.shear=c[0][0]*c[1][0]+c[0][1]*c[1][1],c[1]=[c[1][0]-c[0][0]*b.shear,c[1][1]-c[0][1]*b.shear],b.scaley=e.sqrt(g(c[1])),h(c[1]),b.shear/=b.scaley,this.determinant()<0&&(b.scalex=-b.scalex);var d=-c[0][1],f=c[1][1];return 0>f?(b.rotate=a.deg(e.acos(f)),0>d&&(b.rotate=360-b.rotate)):b.rotate=a.deg(e.asin(d)),b.isSimple=!(+b.shear.toFixed(9)||b.scalex.toFixed(9)!=b.scaley.toFixed(9)&&b.rotate),b.isSuperSimple=!+b.shear.toFixed(9)&&b.scalex.toFixed(9)==b.scaley.toFixed(9)&&!b.rotate,b.noRotation=!+b.shear.toFixed(9)&&!b.rotate,b},c.toTransformString=function(a){var b=a||this.split();return+b.shear.toFixed(9)?"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]:(b.scalex=+b.scalex.toFixed(4),b.scaley=+b.scaley.toFixed(4),b.rotate=+b.rotate.toFixed(4),(b.dx||b.dy?"t"+[+b.dx.toFixed(4),+b.dy.toFixed(4)]:f)+(1!=b.scalex||1!=b.scaley?"s"+[b.scalex,b.scaley,0,0]:f)+(b.rotate?"r"+[+b.rotate.toFixed(4),0,0]:f))}}(b.prototype),a.Matrix=b}),d.plugin(function(a,c,d,e,f){function g(d){return function(e){if(b.stop(),e instanceof f&&1==e.node.childNodes.length&&("radialGradient"==e.node.firstChild.tagName||"linearGradient"==e.node.firstChild.tagName||"pattern"==e.node.firstChild.tagName)&&(e=e.node.firstChild,m(this).appendChild(e),e=k(e)),e instanceof c)if("radialGradient"==e.type||"linearGradient"==e.type||"pattern"==e.type){e.node.id||o(e.node,{id:e.id});var g=p(e.node.id)}else g=e.attr(d);else if(g=a.color(e),g.error){var h=a(m(this).ownerSVGElement).gradient(e);h?(h.node.id||o(h.node,{id:h.id}),g=p(h.node.id)):g=e}else g=q(g);var i={};i[d]=g,o(this.node,i),this.node.style[d]=s}}function h(a){for(var b=[],c=a.childNodes,d=0,e=c.length;e>d;d++){var f=c[d];3==f.nodeType&&b.push(f.nodeValue),"tspan"==f.tagName&&b.push(1==f.childNodes.length&&3==f.firstChild.nodeType?f.firstChild.nodeValue:h(f))}return b}function i(){return b.stop(),this.node.style.fontSize}var j=a._.make,k=a._.wrap,l=a.is,m=a._.getSomeDefs,n=/^url\(#?([^)]+)\)$/,o=a._.$,p=a.url,q=String,r=a._.separator,s="";b.on("snap.util.attr.mask",function(a){if(a instanceof c||a instanceof f){if(b.stop(),a instanceof f&&1==a.node.childNodes.length&&(a=a.node.firstChild,m(this).appendChild(a),a=k(a)),"mask"==a.type)var d=a;else d=j("mask",m(this)),d.node.appendChild(a.node),!d.node.id&&o(d.node,{id:d.id});o(this.node,{mask:p(d.id)})}}),function(a){b.on("snap.util.attr.clip",a),b.on("snap.util.attr.clip-path",a),b.on("snap.util.attr.clipPath",a)}(function(a){if(a instanceof c||a instanceof f){if(b.stop(),"clipPath"==a.type)var d=a;else d=j("clipPath",m(this)),d.node.appendChild(a.node),!d.node.id&&o(d.node,{id:d.id});o(this.node,{"clip-path":p(d.id)})}}),b.on("snap.util.attr.fill",g("fill")),b.on("snap.util.attr.stroke",g("stroke"));var t=/^([lr])(?:\(([^)]*)\))?(.*)$/i;b.on("snap.util.grad.parse",function(a){a=q(a);var b=a.match(t);if(!b)return null;var c=b[1],d=b[2],e=b[3];return d=d.split(/\s*,\s*/).map(function(a){return+a==a?+a:a}),1==d.length&&0==d[0]&&(d=[]),e=e.split("-"),e=e.map(function(a){a=a.split(":");var b={color:a[0]};return a[1]&&(b.offset=parseFloat(a[1])),b}),{type:c,params:d,stops:e}}),b.on("snap.util.attr.d",function(c){b.stop(),l(c,"array")&&l(c[0],"array")&&(c=a.path.toString.call(c)),c=q(c),c.match(/[ruo]/i)&&(c=a.path.toAbsolute(c)),o(this.node,{d:c})})(-1),b.on("snap.util.attr.#text",function(a){b.stop(),a=q(a);for(var c=e.doc.createTextNode(a);this.node.firstChild;)this.node.removeChild(this.node.firstChild);this.node.appendChild(c)})(-1),b.on("snap.util.attr.path",function(a){b.stop(),this.attr({d:a})})(-1),b.on("snap.util.attr.class",function(a){b.stop(),this.node.className.baseVal=a})(-1),b.on("snap.util.attr.viewBox",function(a){var c;c=l(a,"object")&&"x"in a?[a.x,a.y,a.width,a.height].join(" "):l(a,"array")?a.join(" "):a,o(this.node,{viewBox:c}),b.stop()})(-1),b.on("snap.util.attr.transform",function(a){this.transform(a),b.stop()})(-1),b.on("snap.util.attr.r",function(a){"rect"==this.type&&(b.stop(),o(this.node,{rx:a,ry:a}))})(-1),b.on("snap.util.attr.textpath",function(a){if(b.stop(),"text"==this.type){var d,e,f;if(!a&&this.textPath){for(e=this.textPath;e.node.firstChild;)this.node.appendChild(e.node.firstChild);return e.remove(),void delete this.textPath}if(l(a,"string")){var g=m(this),h=k(g.parentNode).path(a);g.appendChild(h.node),d=h.id,h.attr({id:d})}else a=k(a),a instanceof c&&(d=a.attr("id"),d||(d=a.id,a.attr({id:d})));if(d)if(e=this.textPath,f=this.node,e)e.attr({"xlink:href":"#"+d});else{for(e=o("textPath",{"xlink:href":"#"+d});f.firstChild;)e.appendChild(f.firstChild);f.appendChild(e),this.textPath=k(e)}}})(-1),b.on("snap.util.attr.text",function(a){if("text"==this.type){for(var c=this.node,d=function(a){var b=o("tspan");if(l(a,"array"))for(var c=0;c1&&(a=Array.prototype.slice.call(arguments,0));var b={};return g(a,"object")&&!g(a,"array")?b=a:null!=a&&(b={points:a}),this.el("polyline",b)},f.polygon=function(a){arguments.length>1&&(a=Array.prototype.slice.call(arguments,0));var b={};return g(a,"object")&&!g(a,"array")?b=a:null!=a&&(b={points:a}),this.el("polygon",b)},function(){function c(){return this.selectAll("stop")}function d(b,c){var d=k("stop"),e={offset:+c+"%"};return b=a.color(b),e["stop-color"]=b.hex,b.opacity<1&&(e["stop-opacity"]=b.opacity),k(d,e),this.node.appendChild(d),this}function e(){if("linearGradient"==this.type){var b=k(this.node,"x1")||0,c=k(this.node,"x2")||1,d=k(this.node,"y1")||0,e=k(this.node,"y2")||0;return a._.box(b,d,math.abs(c-b),math.abs(e-d))}var f=this.node.cx||.5,g=this.node.cy||.5,h=this.node.r||0;return a._.box(f-h,g-h,2*h,2*h)}function g(a){for(var b,c=0,d=a.length;d>c;c++)if(b=b||a[c])return b}function h(a,c){function d(a,b){for(var c=(b-m)/(a-n),d=n;a>d;d++)h[d].offset=+(+m+c*(d-n)).toFixed(2);n=a,m=b}var e,f=g(b("snap.util.grad.parse",null,c));if(!f)return null;f.params.unshift(a),e="l"==f.type.toLowerCase()?i.apply(0,f.params):j.apply(0,f.params),f.type!=f.type.toLowerCase()&&k(e.node,{gradientUnits:"userSpaceOnUse"});var h=f.stops,l=h.length,m=0,n=0;l--;for(var o=0;l>o;o++)"offset"in h[o]&&d(o,h[o].offset);for(h[l].offset=h[l].offset||100,d(l,h[l].offset),o=0;l>=o;o++){var p=h[o];e.addStop(p.color,p.offset)}return e}function i(b,f,g,h,i){var j=a._.make("linearGradient",b);return j.stops=c,j.addStop=d,j.getBBox=e,null!=f&&k(j.node,{x1:f,y1:g,x2:h,y2:i}),j}function j(b,f,g,h,i,j){var l=a._.make("radialGradient",b);return l.stops=c,l.addStop=d,l.getBBox=e,null!=f&&k(l.node,{cx:f,cy:g,r:h}),null!=i&&null!=j&&k(l.node,{fx:i,fy:j}),l}var k=a._.$;f.gradient=function(a){return h(this.defs,a)},f.gradientLinear=function(a,b,c,d){return i(this.defs,a,b,c,d)},f.gradientRadial=function(a,b,c,d,e){return j(this.defs,a,b,c,d,e)},f.toString=function(){var b,c=this.node.ownerDocument,d=c.createDocumentFragment(),e=c.createElement("div"),f=this.node.cloneNode(!0);return d.appendChild(e),e.appendChild(f),a._.$(f,{xmlns:"http://www.w3.org/2000/svg"}),b=e.innerHTML,d.removeChild(d.firstChild),b},f.clear=function(){for(var a,b=this.node.firstChild;b;)a=b.nextSibling,"defs"!=b.tagName?b.parentNode.removeChild(b):f.clear.call({node:b}),b=a}}()}),d.plugin(function(a,b){function c(a){var b=c.ps=c.ps||{};return b[a]?b[a].sleep=100:b[a]={sleep:100},setTimeout(function(){for(var c in b)b[K](c)&&c!=a&&(b[c].sleep--,!b[c].sleep&&delete b[c])}),b[a]}function d(a,b,c,d){return null==a&&(a=b=c=d=0),null==b&&(b=a.y,c=a.width,d=a.height,a=a.x),{x:a,y:b,width:c,w:c,height:d,h:d,x2:a+c,y2:b+d,cx:a+c/2,cy:b+d/2,r1:N.min(c,d)/2,r2:N.max(c,d)/2,r0:N.sqrt(c*c+d*d)/2,path:w(a,b,c,d),vb:[a,b,c,d].join(" ")}}function e(){return this.join(",").replace(L,"$1")}function f(a){var b=J(a);return b.toString=e,b}function g(a,b,c,d,e,f,g,h,j){return null==j?n(a,b,c,d,e,f,g,h):i(a,b,c,d,e,f,g,h,o(a,b,c,d,e,f,g,h,j))}function h(c,d){function e(a){return+(+a).toFixed(3)}return a._.cacher(function(a,f,h){a instanceof b&&(a=a.attr("d")),a=E(a);for(var j,k,l,m,n,o="",p={},q=0,r=0,s=a.length;s>r;r++){if(l=a[r],"M"==l[0])j=+l[1],k=+l[2];else{if(m=g(j,k,l[1],l[2],l[3],l[4],l[5],l[6]),q+m>f){if(d&&!p.start){if(n=g(j,k,l[1],l[2],l[3],l[4],l[5],l[6],f-q),o+=["C"+e(n.start.x),e(n.start.y),e(n.m.x),e(n.m.y),e(n.x),e(n.y)],h)return o;p.start=o,o=["M"+e(n.x),e(n.y)+"C"+e(n.n.x),e(n.n.y),e(n.end.x),e(n.end.y),e(l[5]),e(l[6])].join(),q+=m,j=+l[5],k=+l[6];continue}if(!c&&!d)return n=g(j,k,l[1],l[2],l[3],l[4],l[5],l[6],f-q)}q+=m,j=+l[5],k=+l[6]}o+=l.shift()+l}return p.end=o,n=c?q:d?p:i(j,k,l[0],l[1],l[2],l[3],l[4],l[5],1)},null,a._.clone)}function i(a,b,c,d,e,f,g,h,i){var j=1-i,k=R(j,3),l=R(j,2),m=i*i,n=m*i,o=k*a+3*l*i*c+3*j*i*i*e+n*g,p=k*b+3*l*i*d+3*j*i*i*f+n*h,q=a+2*i*(c-a)+m*(e-2*c+a),r=b+2*i*(d-b)+m*(f-2*d+b),s=c+2*i*(e-c)+m*(g-2*e+c),t=d+2*i*(f-d)+m*(h-2*f+d),u=j*a+i*c,v=j*b+i*d,w=j*e+i*g,x=j*f+i*h,y=90-180*N.atan2(q-s,r-t)/O;return{x:o,y:p,m:{x:q,y:r},n:{x:s,y:t},start:{x:u,y:v},end:{x:w,y:x},alpha:y}}function j(b,c,e,f,g,h,i,j){a.is(b,"array")||(b=[b,c,e,f,g,h,i,j]);var k=D.apply(null,b);return d(k.min.x,k.min.y,k.max.x-k.min.x,k.max.y-k.min.y)}function k(a,b,c){return b>=a.x&&b<=a.x+a.width&&c>=a.y&&c<=a.y+a.height}function l(a,b){return a=d(a),b=d(b),k(b,a.x,a.y)||k(b,a.x2,a.y)||k(b,a.x,a.y2)||k(b,a.x2,a.y2)||k(a,b.x,b.y)||k(a,b.x2,b.y)||k(a,b.x,b.y2)||k(a,b.x2,b.y2)||(a.xb.x||b.xa.x)&&(a.yb.y||b.ya.y)}function m(a,b,c,d,e){var f=-3*b+9*c-9*d+3*e,g=a*f+6*b-12*c+6*d;return a*g-3*b+3*c}function n(a,b,c,d,e,f,g,h,i){null==i&&(i=1),i=i>1?1:0>i?0:i;for(var j=i/2,k=12,l=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],n=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],o=0,p=0;k>p;p++){var q=j*l[p]+j,r=m(q,a,c,e,g),s=m(q,b,d,f,h),t=r*r+s*s;o+=n[p]*N.sqrt(t)}return j*o}function o(a,b,c,d,e,f,g,h,i){if(!(0>i||n(a,b,c,d,e,f,g,h)o;)l/=2,m+=(i>j?1:-1)*l,j=n(a,b,c,d,e,f,g,h,m);return m}}function p(a,b,c,d,e,f,g,h){if(!(Q(a,c)Q(e,g)||Q(b,d)
Q(f,h))){var i=(a*d-b*c)*(e-g)-(a-c)*(e*h-f*g),j=(a*d-b*c)*(f-h)-(b-d)*(e*h-f*g),k=(a-c)*(f-h)-(b-d)*(e-g);if(k){var l=i/k,m=j/k,n=+l.toFixed(2),o=+m.toFixed(2);if(!(n<+P(a,c).toFixed(2)||n>+Q(a,c).toFixed(2)||n<+P(e,g).toFixed(2)||n>+Q(e,g).toFixed(2)||o<+P(b,d).toFixed(2)||o>+Q(b,d).toFixed(2)||o<+P(f,h).toFixed(2)||o>+Q(f,h).toFixed(2)))return{x:l,y:m}}}}function q(a,b,c){var d=j(a),e=j(b);if(!l(d,e))return c?0:[];for(var f=n.apply(0,a),g=n.apply(0,b),h=~~(f/5),k=~~(g/5),m=[],o=[],q={},r=c?0:[],s=0;h+1>s;s++){var t=i.apply(0,a.concat(s/h));m.push({x:t.x,y:t.y,t:s/h})}for(s=0;k+1>s;s++)t=i.apply(0,b.concat(s/k)),o.push({x:t.x,y:t.y,t:s/k});for(s=0;h>s;s++)for(var u=0;k>u;u++){var v=m[s],w=m[s+1],x=o[u],y=o[u+1],z=S(w.x-v.x)<.001?"y":"x",A=S(y.x-x.x)<.001?"y":"x",B=p(v.x,v.y,w.x,w.y,x.x,x.y,y.x,y.y);if(B){if(q[B.x.toFixed(4)]==B.y.toFixed(4))continue;q[B.x.toFixed(4)]=B.y.toFixed(4);var C=v.t+S((B[z]-v[z])/(w[z]-v[z]))*(w.t-v.t),D=x.t+S((B[A]-x[A])/(y[A]-x[A]))*(y.t-x.t);C>=0&&1>=C&&D>=0&&1>=D&&(c?r++:r.push({x:B.x,y:B.y,t1:C,t2:D}))}}return r}function r(a,b){return t(a,b)}function s(a,b){return t(a,b,1)}function t(a,b,c){a=E(a),b=E(b);for(var d,e,f,g,h,i,j,k,l,m,n=c?0:[],o=0,p=a.length;p>o;o++){var r=a[o];if("M"==r[0])d=h=r[1],e=i=r[2];else{"C"==r[0]?(l=[d,e].concat(r.slice(1)),d=l[6],e=l[7]):(l=[d,e,d,e,h,i,h,i],d=h,e=i);for(var s=0,t=b.length;t>s;s++){var u=b[s];if("M"==u[0])f=j=u[1],g=k=u[2];else{"C"==u[0]?(m=[f,g].concat(u.slice(1)),f=m[6],g=m[7]):(m=[f,g,f,g,j,k,j,k],f=j,g=k);var v=q(l,m,c);if(c)n+=v;else{for(var w=0,x=v.length;x>w;w++)v[w].segment1=o,v[w].segment2=s,v[w].bez1=l,v[w].bez2=m;n=n.concat(v)}}}}}return n}function u(a,b,c){var d=v(a);return k(d,b,c)&&t(a,[["M",b,c],["H",d.x2+10]],1)%2==1}function v(a){var b=c(a);if(b.bbox)return J(b.bbox);if(!a)return d();a=E(a);for(var e,f=0,g=0,h=[],i=[],j=0,k=a.length;k>j;j++)if(e=a[j],"M"==e[0])f=e[1],g=e[2],h.push(f),i.push(g);else{var l=D(f,g,e[1],e[2],e[3],e[4],e[5],e[6]);h=h.concat(l.min.x,l.max.x),i=i.concat(l.min.y,l.max.y),f=e[5],g=e[6]}var m=P.apply(0,h),n=P.apply(0,i),o=Q.apply(0,h),p=Q.apply(0,i),q=d(m,n,o-m,p-n);return b.bbox=J(q),q}function w(a,b,c,d,f){if(f)return[["M",+a+ +f,b],["l",c-2*f,0],["a",f,f,0,0,1,f,f],["l",0,d-2*f],["a",f,f,0,0,1,-f,f],["l",2*f-c,0],["a",f,f,0,0,1,-f,-f],["l",0,2*f-d],["a",f,f,0,0,1,f,-f],["z"]];var g=[["M",a,b],["l",c,0],["l",0,d],["l",-c,0],["z"]];return g.toString=e,g}function x(a,b,c,d,f){if(null==f&&null==d&&(d=c),a=+a,b=+b,c=+c,d=+d,null!=f)var g=Math.PI/180,h=a+c*Math.cos(-d*g),i=a+c*Math.cos(-f*g),j=b+c*Math.sin(-d*g),k=b+c*Math.sin(-f*g),l=[["M",h,j],["A",c,c,0,+(f-d>180),0,i,k]];else l=[["M",a,b],["m",0,-d],["a",c,d,0,1,1,0,2*d],["a",c,d,0,1,1,0,-2*d],["z"]];return l.toString=e,l}function y(b){var d=c(b),g=String.prototype.toLowerCase;if(d.rel)return f(d.rel);a.is(b,"array")&&a.is(b&&b[0],"array")||(b=a.parsePathString(b));var h=[],i=0,j=0,k=0,l=0,m=0;"M"==b[0][0]&&(i=b[0][1],j=b[0][2],k=i,l=j,m++,h.push(["M",i,j]));for(var n=m,o=b.length;o>n;n++){var p=h[n]=[],q=b[n];if(q[0]!=g.call(q[0]))switch(p[0]=g.call(q[0]),p[0]){case"a":p[1]=q[1],p[2]=q[2],p[3]=q[3],p[4]=q[4],p[5]=q[5],p[6]=+(q[6]-i).toFixed(3),p[7]=+(q[7]-j).toFixed(3);break;case"v":p[1]=+(q[1]-j).toFixed(3);break;case"m":k=q[1],l=q[2];default:for(var r=1,s=q.length;s>r;r++)p[r]=+(q[r]-(r%2?i:j)).toFixed(3)}else{p=h[n]=[],"m"==q[0]&&(k=q[1]+i,l=q[2]+j);for(var t=0,u=q.length;u>t;t++)h[n][t]=q[t]}var v=h[n].length;switch(h[n][0]){case"z":i=k,j=l;break;case"h":i+=+h[n][v-1];break;case"v":j+=+h[n][v-1];break;default:i+=+h[n][v-2],j+=+h[n][v-1]}}return h.toString=e,d.rel=f(h),h}function z(b){var d=c(b);if(d.abs)return f(d.abs);if(I(b,"array")&&I(b&&b[0],"array")||(b=a.parsePathString(b)),!b||!b.length)return[["M",0,0]];var g,h=[],i=0,j=0,k=0,l=0,m=0;"M"==b[0][0]&&(i=+b[0][1],j=+b[0][2],k=i,l=j,m++,h[0]=["M",i,j]);for(var n,o,p=3==b.length&&"M"==b[0][0]&&"R"==b[1][0].toUpperCase()&&"Z"==b[2][0].toUpperCase(),q=m,r=b.length;r>q;q++){if(h.push(n=[]),o=b[q],g=o[0],g!=g.toUpperCase())switch(n[0]=g.toUpperCase(),n[0]){case"A":n[1]=o[1],n[2]=o[2],n[3]=o[3],n[4]=o[4],n[5]=o[5],n[6]=+o[6]+i,n[7]=+o[7]+j;break;case"V":n[1]=+o[1]+j;break;case"H":n[1]=+o[1]+i;break;case"R":for(var s=[i,j].concat(o.slice(1)),t=2,u=s.length;u>t;t++)s[t]=+s[t]+i,s[++t]=+s[t]+j;h.pop(),h=h.concat(G(s,p));break;case"O":h.pop(),s=x(i,j,o[1],o[2]),s.push(s[0]),h=h.concat(s);break;case"U":h.pop(),h=h.concat(x(i,j,o[1],o[2],o[3])),n=["U"].concat(h[h.length-1].slice(-2));break;case"M":k=+o[1]+i,l=+o[2]+j;default:for(t=1,u=o.length;u>t;t++)n[t]=+o[t]+(t%2?i:j)}else if("R"==g)s=[i,j].concat(o.slice(1)),h.pop(),h=h.concat(G(s,p)),n=["R"].concat(o.slice(-2));else if("O"==g)h.pop(),s=x(i,j,o[1],o[2]),s.push(s[0]),h=h.concat(s);else if("U"==g)h.pop(),h=h.concat(x(i,j,o[1],o[2],o[3])),n=["U"].concat(h[h.length-1].slice(-2));else for(var v=0,w=o.length;w>v;v++)n[v]=o[v];if(g=g.toUpperCase(),"O"!=g)switch(n[0]){case"Z":i=+k,j=+l;break;case"H":i=n[1];break;case"V":j=n[1];break;case"M":k=n[n.length-2],l=n[n.length-1];default:i=n[n.length-2],j=n[n.length-1]}}return h.toString=e,d.abs=f(h),h}function A(a,b,c,d){return[a,b,c,d,c,d]}function B(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]}function C(b,c,d,e,f,g,h,i,j,k){var l,m=120*O/180,n=O/180*(+f||0),o=[],p=a._.cacher(function(a,b,c){var d=a*N.cos(c)-b*N.sin(c),e=a*N.sin(c)+b*N.cos(c);return{x:d,y:e}});if(k)y=k[0],z=k[1],w=k[2],x=k[3];else{l=p(b,c,-n),b=l.x,c=l.y,l=p(i,j,-n),i=l.x,j=l.y;var q=(N.cos(O/180*f),N.sin(O/180*f),(b-i)/2),r=(c-j)/2,s=q*q/(d*d)+r*r/(e*e);s>1&&(s=N.sqrt(s),d=s*d,e=s*e);var t=d*d,u=e*e,v=(g==h?-1:1)*N.sqrt(S((t*u-t*r*r-u*q*q)/(t*r*r+u*q*q))),w=v*d*r/e+(b+i)/2,x=v*-e*q/d+(c+j)/2,y=N.asin(((c-x)/e).toFixed(9)),z=N.asin(((j-x)/e).toFixed(9));y=w>b?O-y:y,z=w>i?O-z:z,0>y&&(y=2*O+y),0>z&&(z=2*O+z),h&&y>z&&(y-=2*O),!h&&z>y&&(z-=2*O)}var A=z-y;if(S(A)>m){var B=z,D=i,E=j;z=y+m*(h&&z>y?1:-1),i=w+d*N.cos(z),j=x+e*N.sin(z),o=C(i,j,d,e,f,0,h,D,E,[z,B,w,x])}A=z-y;var F=N.cos(y),G=N.sin(y),H=N.cos(z),I=N.sin(z),J=N.tan(A/4),K=4/3*d*J,L=4/3*e*J,M=[b,c],P=[b+K*G,c-L*F],Q=[i+K*I,j-L*H],R=[i,j];if(P[0]=2*M[0]-P[0],P[1]=2*M[1]-P[1],k)return[P,Q,R].concat(o);o=[P,Q,R].concat(o).join().split(",");for(var T=[],U=0,V=o.length;V>U;U++)T[U]=U%2?p(o[U-1],o[U],n).y:p(o[U],o[U+1],n).x;return T}function D(a,b,c,d,e,f,g,h){for(var i,j,k,l,m,n,o,p,q=[],r=[[],[]],s=0;2>s;++s)if(0==s?(j=6*a-12*c+6*e,i=-3*a+9*c-9*e+3*g,k=3*c-3*a):(j=6*b-12*d+6*f,i=-3*b+9*d-9*f+3*h,k=3*d-3*b),S(i)<1e-12){if(S(j)<1e-12)continue;l=-k/j,l>0&&1>l&&q.push(l)}else o=j*j-4*k*i,p=N.sqrt(o),0>o||(m=(-j+p)/(2*i),m>0&&1>m&&q.push(m),n=(-j-p)/(2*i),n>0&&1>n&&q.push(n));for(var t,u=q.length,v=u;u--;)l=q[u],t=1-l,r[0][u]=t*t*t*a+3*t*t*l*c+3*t*l*l*e+l*l*l*g,r[1][u]=t*t*t*b+3*t*t*l*d+3*t*l*l*f+l*l*l*h;return r[0][v]=a,r[1][v]=b,r[0][v+1]=g,r[1][v+1]=h,r[0].length=r[1].length=v+2,{min:{x:P.apply(0,r[0]),y:P.apply(0,r[1])},max:{x:Q.apply(0,r[0]),y:Q.apply(0,r[1])}}}function E(a,b){var d=!b&&c(a);if(!b&&d.curve)return f(d.curve);for(var e=z(a),g=b&&z(b),h={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},j=(function(a,b,c){var d,e;if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];switch(!(a[0]in{T:1,Q:1})&&(b.qx=b.qy=null),a[0]){case"M":b.X=a[1],b.Y=a[2];break;case"A":a=["C"].concat(C.apply(0,[b.x,b.y].concat(a.slice(1))));break;case"S":"C"==c||"S"==c?(d=2*b.x-b.bx,e=2*b.y-b.by):(d=b.x,e=b.y),a=["C",d,e].concat(a.slice(1));break;case"T":"Q"==c||"T"==c?(b.qx=2*b.x-b.qx,b.qy=2*b.y-b.qy):(b.qx=b.x,b.qy=b.y),a=["C"].concat(B(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case"Q":b.qx=a[1],b.qy=a[2],a=["C"].concat(B(b.x,b.y,a[1],a[2],a[3],a[4]));break;case"L":a=["C"].concat(A(b.x,b.y,a[1],a[2]));break;case"H":a=["C"].concat(A(b.x,b.y,a[1],b.y));break;case"V":a=["C"].concat(A(b.x,b.y,b.x,a[1]));break;case"Z":a=["C"].concat(A(b.x,b.y,b.X,b.Y))}return a}),k=function(a,b){if(a[b].length>7){a[b].shift();for(var c=a[b];c.length;)m[b]="A",g&&(n[b]="A"),a.splice(b++,0,["C"].concat(c.splice(0,6)));a.splice(b,1),r=Q(e.length,g&&g.length||0)}},l=function(a,b,c,d,f){a&&b&&"M"==a[f][0]&&"M"!=b[f][0]&&(b.splice(f,0,["M",d.x,d.y]),c.bx=0,c.by=0,c.x=a[f][1],c.y=a[f][2],r=Q(e.length,g&&g.length||0))},m=[],n=[],o="",p="",q=0,r=Q(e.length,g&&g.length||0);r>q;q++){e[q]&&(o=e[q][0]),"C"!=o&&(m[q]=o,q&&(p=m[q-1])),e[q]=j(e[q],h,p),"A"!=m[q]&&"C"==o&&(m[q]="C"),k(e,q),g&&(g[q]&&(o=g[q][0]),"C"!=o&&(n[q]=o,q&&(p=n[q-1])),g[q]=j(g[q],i,p),"A"!=n[q]&&"C"==o&&(n[q]="C"),k(g,q)),l(e,g,h,i,q),l(g,e,i,h,q);var s=e[q],t=g&&g[q],u=s.length,v=g&&t.length;h.x=s[u-2],h.y=s[u-1],h.bx=M(s[u-4])||h.x,h.by=M(s[u-3])||h.y,i.bx=g&&(M(t[v-4])||i.x),i.by=g&&(M(t[v-3])||i.y),i.x=g&&t[v-2],i.y=g&&t[v-1]}return g||(d.curve=f(e)),g?[e,g]:e}function F(a,b){if(!b)return a;var c,d,e,f,g,h,i;for(a=E(a),e=0,g=a.length;g>e;e++)for(i=a[e],f=1,h=i.length;h>f;f+=2)c=b.x(i[f],i[f+1]),d=b.y(i[f],i[f+1]),i[f]=c,i[f+1]=d;return a}function G(a,b){for(var c=[],d=0,e=a.length;e-2*!b>d;d+=2){var f=[{x:+a[d-2],y:+a[d-1]},{x:+a[d],y:+a[d+1]},{x:+a[d+2],y:+a[d+3]},{x:+a[d+4],y:+a[d+5]}];b?d?e-4==d?f[3]={x:+a[0],y:+a[1]}:e-2==d&&(f[2]={x:+a[0],y:+a[1]},f[3]={x:+a[2],y:+a[3]}):f[0]={x:+a[e-2],y:+a[e-1]}:e-4==d?f[3]=f[2]:d||(f[0]={x:+a[d],y:+a[d+1]}),c.push(["C",(-f[0].x+6*f[1].x+f[2].x)/6,(-f[0].y+6*f[1].y+f[2].y)/6,(f[1].x+6*f[2].x-f[3].x)/6,(f[1].y+6*f[2].y-f[3].y)/6,f[2].x,f[2].y])}return c}var H=b.prototype,I=a.is,J=a._.clone,K="hasOwnProperty",L=/,?([a-z]),?/gi,M=parseFloat,N=Math,O=N.PI,P=N.min,Q=N.max,R=N.pow,S=N.abs,T=h(1),U=h(),V=h(0,1),W=a._unit2px,X={path:function(a){return a.attr("path")},circle:function(a){var b=W(a);return x(b.cx,b.cy,b.r)},ellipse:function(a){var b=W(a);return x(b.cx||0,b.cy||0,b.rx,b.ry)},rect:function(a){var b=W(a);return w(b.x||0,b.y||0,b.width,b.height,b.rx,b.ry)},image:function(a){var b=W(a);return w(b.x||0,b.y||0,b.width,b.height)},text:function(a){var b=a.node.getBBox();return w(b.x,b.y,b.width,b.height)},g:function(a){var b=a.node.getBBox();return w(b.x,b.y,b.width,b.height)},symbol:function(a){var b=a.getBBox();return w(b.x,b.y,b.width,b.height)},line:function(a){return"M"+[a.attr("x1")||0,a.attr("y1")||0,a.attr("x2"),a.attr("y2")]},polyline:function(a){return"M"+a.attr("points")},polygon:function(a){return"M"+a.attr("points")+"z"},svg:function(a){var b=a.node.getBBox();return w(b.x,b.y,b.width,b.height)},deflt:function(a){var b=a.node.getBBox();return w(b.x,b.y,b.width,b.height)}};a.path=c,a.path.getTotalLength=T,a.path.getPointAtLength=U,a.path.getSubpath=function(a,b,c){if(this.getTotalLength(a)-c<1e-6)return V(a,b).end;var d=V(a,c,1);return b?V(d,b).end:d},H.getTotalLength=function(){return this.node.getTotalLength?this.node.getTotalLength():void 0},H.getPointAtLength=function(a){return U(this.attr("d"),a)},H.getSubpath=function(b,c){return a.path.getSubpath(this.attr("d"),b,c)},a._.box=d,a.path.findDotsAtSegment=i,a.path.bezierBBox=j,a.path.isPointInsideBBox=k,a.path.isBBoxIntersect=l,a.path.intersection=r,a.path.intersectionNumber=s,a.path.isPointInside=u,a.path.getBBox=v,a.path.get=X,a.path.toRelative=y,a.path.toAbsolute=z,a.path.toCubic=E,a.path.map=F,a.path.toString=e,a.path.clone=f}),d.plugin(function(a){var d=Math.max,e=Math.min,f=function(a){if(this.items=[],this.bindings={},this.length=0,this.type="set",a)for(var b=0,c=a.length;c>b;b++)a[b]&&(this[this.items.length]=this.items[this.items.length]=a[b],this.length++)},g=f.prototype;g.push=function(){for(var a,b,c=0,d=arguments.length;d>c;c++)a=arguments[c],a&&(b=this.items.length,this[b]=this.items[b]=a,this.length++);return this},g.pop=function(){return this.length&&delete this[this.length--],this.items.pop()},g.forEach=function(a,b){for(var c=0,d=this.items.length;d>c;c++)if(a.call(b,this.items[c],c)===!1)return this;return this},g.animate=function(d,e,f,g){"function"!=typeof f||f.length||(g=f,f=c.linear),d instanceof a._.Animation&&(g=d.callback,f=d.easing,e=f.dur,d=d.attr);var h=arguments;if(a.is(d,"array")&&a.is(h[h.length-1],"array"))var i=!0;var j,k=function(){j?this.b=j:j=this.b},l=0,m=g&&function(){l++==this.length&&g.call(this)};return this.forEach(function(a,c){b.once("snap.animcreated."+a.id,k),i?h[c]&&a.animate.apply(a,h[c]):a.animate(d,e,f,m)})},g.remove=function(){for(;this.length;)this.pop().remove();return this},g.bind=function(a,b,c){var d={};if("function"==typeof b)this.bindings[a]=b;else{var e=c||a;this.bindings[a]=function(a){d[e]=a,b.attr(d)}}return this},g.attr=function(a){var b={};for(var c in a)this.bindings[c]?this.bindings[c](a[c]):b[c]=a[c];for(var d=0,e=this.items.length;e>d;d++)this.items[d].attr(b);return this},g.clear=function(){for(;this.length;)this.pop()},g.splice=function(a,b){a=0>a?d(this.length+a,0):a,b=d(0,e(this.length-a,b));var c,g=[],h=[],i=[];for(c=2;cc;c++)h.push(this[a+c]);for(;cc?i[c]:g[c-j];for(c=this.items.length=this.length-=b-j;this[c];)delete this[c++];return new f(h)},g.exclude=function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]==a)return this.splice(b,1),!0;return!1},g.insertAfter=function(a){for(var b=this.items.length;b--;)this.items[b].insertAfter(a);return this},g.getBBox=function(){for(var a=[],b=[],c=[],f=[],g=this.items.length;g--;)if(!this.items[g].removed){var h=this.items[g].getBBox();a.push(h.x),b.push(h.y),c.push(h.x+h.width),f.push(h.y+h.height)}return a=e.apply(0,a),b=e.apply(0,b),c=d.apply(0,c),f=d.apply(0,f),{x:a,y:b,x2:c,y2:f,width:c-a,height:f-b,cx:a+(c-a)/2,cy:b+(f-b)/2}},g.clone=function(a){a=new f;for(var b=0,c=this.items.length;c>b;b++)a.push(this.items[b].clone());return a},g.toString=function(){return"Snap‘s set"},g.type="set",a.set=function(){var a=new f;return arguments.length&&a.push.apply(a,Array.prototype.slice.call(arguments,0)),a}}),d.plugin(function(a,c){function d(a){var b=a[0];switch(b.toLowerCase()){case"t":return[b,0,0];case"m":return[b,1,0,0,1,0,0];case"r":return 4==a.length?[b,0,a[2],a[3]]:[b,0];case"s":return 5==a.length?[b,1,1,a[3],a[4]]:3==a.length?[b,1,1]:[b,1]}}function e(b,c,e){c=n(c).replace(/\.{3}|\u2026/g,b),b=a.parseTransformString(b)||[],c=a.parseTransformString(c)||[];for(var f,g,h,k,l=Math.max(b.length,c.length),m=[],o=[],p=0;l>p;p++){if(h=b[p]||d(c[p]),k=c[p]||d(h),h[0]!=k[0]||"r"==h[0].toLowerCase()&&(h[2]!=k[2]||h[3]!=k[3])||"s"==h[0].toLowerCase()&&(h[3]!=k[3]||h[4]!=k[4])){b=a._.transform2matrix(b,e()),c=a._.transform2matrix(c,e()),m=[["m",b.a,b.b,b.c,b.d,b.e,b.f]],o=[["m",c.a,c.b,c.c,c.d,c.e,c.f]];break}for(m[p]=[],o[p]=[],f=0,g=Math.max(h.length,k.length);g>f;f++)f in h&&(m[p][f]=h[f]),f in k&&(o[p][f]=k[f])}return{from:j(m),to:j(o),f:i(m)}}function f(a){return a}function g(a){return function(b){return+b.toFixed(3)+a}}function h(b){return a.rgb(b[0],b[1],b[2])}function i(a){var b,c,d,e,f,g,h=0,i=[];for(b=0,c=a.length;c>b;b++){for(f="[",g=['"'+a[b][0]+'"'],d=1,e=a[b].length;e>d;d++)g[d]="val["+h++ +"]";f+=g+"]",i[b]=f}return Function("val","return Snap.path.toString.call(["+i+"])")}function j(a){for(var b=[],c=0,d=a.length;d>c;c++)for(var e=1,f=a[c].length;f>e;e++)b.push(a[c][e]);return b}function k(a){for(var b,c=0,d=a.length;d>c;c++)if(b=b||a[c])return b}var l={},m=/[a-z]+$/i,n=String;l.stroke=l.fill="colour",c.prototype.equal=function(a,c){return k(b("snap.util.equal",this,a,c))},b.on("snap.util.equal",function(b,c){var d,k,o=n(this.attr(b)||""),p=this;if(o==+o&&c==+c)return{from:+o,to:+c,f:f};if("colour"==l[b])return d=a.color(o),k=a.color(c),{from:[d.r,d.g,d.b,d.opacity],to:[k.r,k.g,k.b,k.opacity],f:h};if("transform"==b||"gradientTransform"==b||"patternTransform"==b)return c instanceof a.Matrix&&(c=c.toTransformString()),a._.rgTransform.test(c)||(c=a._.svgTransform2string(c)),e(o,c,function(){return p.getBBox(1)
+});if("d"==b||"path"==b)return d=a.path.toCubic(o,c),{from:j(d[0]),to:j(d[1]),f:i(d[0])};if("points"==b)return d=n(o).split(a._.separator),k=n(c).split(a._.separator),{from:d,to:k,f:function(a){return a}};aUnit=o.match(m);var q=n(c).match(m);return aUnit&&aUnit==q?{from:parseFloat(o),to:parseFloat(c),f:g(aUnit)}:{from:this.asPX(b),to:this.asPX(b,c),f:f}})}),d.plugin(function(a,c,d,e){for(var f=c.prototype,g="hasOwnProperty",h=("createTouch"in e.doc),i=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","touchstart","touchmove","touchend","touchcancel"],j={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},k=function(a){var b="y"==a?"scrollTop":"scrollLeft";return e.doc.documentElement[b]||e.doc.body[b]},l=function(){this.returnValue=!1},m=function(){return this.originalEvent.preventDefault()},n=function(){this.cancelBubble=!0},o=function(){return this.originalEvent.stopPropagation()},p=function(){return e.doc.addEventListener?function(a,b,c,d){var e=h&&j[b]?j[b]:b,f=function(e){var f=k("y"),i=k("x");if(h&&j[g](b))for(var l=0,n=e.targetTouches&&e.targetTouches.length;n>l;l++)if(e.targetTouches[l].target==a||a.contains(e.targetTouches[l].target)){var p=e;e=e.targetTouches[l],e.originalEvent=p,e.preventDefault=m,e.stopPropagation=o;break}var q=e.clientX+i,r=e.clientY+f;return c.call(d,e,q,r)};return b!==e&&a.addEventListener(b,f,!1),a.addEventListener(e,f,!1),function(){return b!==e&&a.removeEventListener(b,f,!1),a.removeEventListener(e,f,!1),!0}}:e.doc.attachEvent?function(a,b,c,d){var f=function(a){a=a||e.win.event;var b=k("y"),f=k("x"),g=a.clientX+f,h=a.clientY+b;return a.preventDefault=a.preventDefault||l,a.stopPropagation=a.stopPropagation||n,c.call(d,a,g,h)};a.attachEvent("on"+b,f);var g=function(){return a.detachEvent("on"+b,f),!0};return g}:void 0}(),q=[],r=function(c){for(var d,e=c.clientX,f=c.clientY,g=k("y"),i=k("x"),j=q.length;j--;){if(d=q[j],h){for(var l,m=c.touches&&c.touches.length;m--;)if(l=c.touches[m],l.identifier==d.el._drag.id||d.el.node.contains(l.target)){e=l.clientX,f=l.clientY,(c.originalEvent?c.originalEvent:c).preventDefault();break}}else c.preventDefault();{var n=d.el.node;a._.glob,n.nextSibling,n.parentNode,n.style.display}e+=i,f+=g,b("snap.drag.move."+d.el.id,d.move_scope||d.el,e-d.el._drag.x,f-d.el._drag.y,e,f,c)}},s=function(c){a.unmousemove(r).unmouseup(s);for(var d,e=q.length;e--;)d=q[e],d.el._drag={},b("snap.drag.end."+d.el.id,d.end_scope||d.start_scope||d.move_scope||d.el,c);q=[]},t=i.length;t--;)!function(b){a[b]=f[b]=function(c,d){return a.is(c,"function")&&(this.events=this.events||[],this.events.push({name:b,f:c,unbind:p(this.shape||this.node||e.doc,b,c,d||this)})),this},a["un"+b]=f["un"+b]=function(a){for(var c=this.events||[],d=c.length;d--;)if(c[d].name==b&&(c[d].f==a||!a))return c[d].unbind(),c.splice(d,1),!c.length&&delete this.events,this;return this}}(i[t]);f.hover=function(a,b,c,d){return this.mouseover(a,c).mouseout(b,d||c)},f.unhover=function(a,b){return this.unmouseover(a).unmouseout(b)};var u=[];f.drag=function(c,d,e,f,g,h){function i(i,j,k){(i.originalEvent||i).preventDefault(),this._drag.x=j,this._drag.y=k,this._drag.id=i.identifier,!q.length&&a.mousemove(r).mouseup(s),q.push({el:this,move_scope:f,start_scope:g,end_scope:h}),d&&b.on("snap.drag.start."+this.id,d),c&&b.on("snap.drag.move."+this.id,c),e&&b.on("snap.drag.end."+this.id,e),b("snap.drag.start."+this.id,g||f||this,j,k,i)}if(!arguments.length){var j;return this.drag(function(a,b){this.attr({transform:j+(j?"T":"t")+[a,b]})},function(){j=this.transform().local})}return this._drag={},u.push({el:this,start:i}),this.mousedown(i),this},f.undrag=function(){for(var c=u.length;c--;)u[c].el==this&&(this.unmousedown(u[c].start),u.splice(c,1),b.unbind("snap.drag.*."+this.id));return!u.length&&a.unmousemove(r).unmouseup(s),this}}),d.plugin(function(a,c,d){var e=(c.prototype,d.prototype),f=/^\s*url\((.+)\)/,g=String,h=a._.$;a.filter={},e.filter=function(b){var d=this;"svg"!=d.type&&(d=d.paper);var e=a.parse(g(b)),f=a._.id(),i=(d.node.offsetWidth,d.node.offsetHeight,h("filter"));return h(i,{id:f,filterUnits:"userSpaceOnUse"}),i.appendChild(e.node),d.defs.appendChild(i),new c(i)},b.on("snap.util.getattr.filter",function(){b.stop();var c=h(this.node,"filter");if(c){var d=g(c).match(f);return d&&a.select(d[1])}}),b.on("snap.util.attr.filter",function(d){if(d instanceof c&&"filter"==d.type){b.stop();var e=d.node.id;e||(h(d.node,{id:d.id}),e=d.id),h(this.node,{filter:a.url(e)})}d&&"none"!=d||(b.stop(),this.node.removeAttribute("filter"))}),a.filter.blur=function(b,c){null==b&&(b=2);var d=null==c?b:[b,c];return a.format('',{def:d})},a.filter.blur.toString=function(){return this()},a.filter.shadow=function(b,c,d,e,f){return"string"==typeof d&&(e=d,f=e,d=4),"string"!=typeof e&&(f=e,e="#000"),e=e||"#000",null==d&&(d=4),null==f&&(f=1),null==b&&(b=0,c=2),null==c&&(c=b),e=a.color(e),a.format('',{color:e,dx:b,dy:c,blur:d,opacity:f})},a.filter.shadow.toString=function(){return this()},a.filter.grayscale=function(b){return null==b&&(b=1),a.format('',{a:.2126+.7874*(1-b),b:.7152-.7152*(1-b),c:.0722-.0722*(1-b),d:.2126-.2126*(1-b),e:.7152+.2848*(1-b),f:.0722-.0722*(1-b),g:.2126-.2126*(1-b),h:.0722+.9278*(1-b)})},a.filter.grayscale.toString=function(){return this()},a.filter.sepia=function(b){return null==b&&(b=1),a.format('',{a:.393+.607*(1-b),b:.769-.769*(1-b),c:.189-.189*(1-b),d:.349-.349*(1-b),e:.686+.314*(1-b),f:.168-.168*(1-b),g:.272-.272*(1-b),h:.534-.534*(1-b),i:.131+.869*(1-b)})},a.filter.sepia.toString=function(){return this()},a.filter.saturate=function(b){return null==b&&(b=1),a.format('',{amount:1-b})},a.filter.saturate.toString=function(){return this()},a.filter.hueRotate=function(b){return b=b||0,a.format('',{angle:b})},a.filter.hueRotate.toString=function(){return this()},a.filter.invert=function(b){return null==b&&(b=1),a.format('',{amount:b,amount2:1-b})},a.filter.invert.toString=function(){return this()},a.filter.brightness=function(b){return null==b&&(b=1),a.format('',{amount:b})},a.filter.brightness.toString=function(){return this()},a.filter.contrast=function(b){return null==b&&(b=1),a.format('',{amount:b,amount2:.5-b/2})},a.filter.contrast.toString=function(){return this()}}),d});
\ No newline at end of file
diff --git a/dist/snap.svg.js b/dist/snap.svg.js
index 5c61203..3be5775 100644
--- a/dist/snap.svg.js
+++ b/dist/snap.svg.js
@@ -14,7 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
-// build: 2014-05-12
+// build: 2014-05-15
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -1974,7 +1974,7 @@ function arrayFirstValue(arr) {
* Element.attr
[ method ]
**
- * Gets or sets given attributes of the element
+ * Gets or sets given attributes of the element.
**
- params (object) contains key-value pairs of attributes you want to set
* or
@@ -1987,9 +1987,13 @@ function arrayFirstValue(arr) {
| fill: "#fc0",
| stroke: "#000",
| strokeWidth: 2, // CamelCase...
- | "fill-opacity": 0.5 // or dash-separated names
+ | "fill-opacity": 0.5, // or dash-separated names
+ | width: "*=2" // prefixed values
| });
| console.log(el.attr("fill")); // #fc0
+ * Prefixed values in format `"+=10"` supported. All four operations
+ * (`+`, `-`, `*` and `/`) could be used. Optionally you can use units for `+`
+ * and `-`: `"+=2em"`.
\*/
elproto.attr = function (params, value) {
var el = this,
@@ -2808,8 +2812,6 @@ function arrayFirstValue(arr) {
}
return this;
};
- // SIERRA Element.animate(): For _attrs_, clarify if they represent the destination values, and if the animation executes relative to the element's current attribute values.
- // SIERRA would a _custom_ animation function be an SVG keySplines value?
/*\
* Element.animate
[ method ]
@@ -4091,6 +4093,95 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
+Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
+ var operators = {
+ "+": function (x, y) {
+ return x + y;
+ },
+ "-": function (x, y) {
+ return x - y;
+ },
+ "/": function (x, y) {
+ return x / y;
+ },
+ "*": function (x, y) {
+ return x * y;
+ }
+ },
+ Str = String,
+ reUnit = /[a-z]+$/i,
+ reAddon = /^\s*([+\-\/*])\s*=\s*([\d.eE+\-]+)\s*([^\d\s]+)?\s*$/;
+ function getNumber(val) {
+ return val;
+ }
+ function getUnit(unit) {
+ return function (val) {
+ return +val.toFixed(3) + unit;
+ };
+ }
+ eve.on("snap.util.attr", function (val) {
+ var plus = Str(val).match(reAddon);
+ if (plus) {
+ var evnt = eve.nt(),
+ name = evnt.substring(evnt.lastIndexOf(".") + 1),
+ a = this.attr(name),
+ atr = {};
+ eve.stop();
+ var unit = plus[3] || "",
+ aUnit = a.match(reUnit),
+ op = operators[plus[1]];
+ if (aUnit && aUnit == unit) {
+ val = op(parseFloat(a), +plus[2]);
+ } else {
+ a = this.asPX(name);
+ val = op(this.asPX(name), this.asPX(name, plus[2] + unit));
+ }
+ if (isNaN(a) || isNaN(val)) {
+ return;
+ }
+ atr[name] = val;
+ this.attr(atr);
+ }
+ })(-10);
+ eve.on("snap.util.equal", function (name, b) {
+ var A, B, a = Str(this.attr(name) || ""),
+ el = this,
+ bplus = Str(b).match(reAddon);
+ if (bplus) {
+ eve.stop();
+ var unit = bplus[3] || "",
+ aUnit = a.match(reUnit),
+ op = operators[bplus[1]];
+ if (aUnit && aUnit == unit) {
+ return {
+ from: parseFloat(a),
+ to: op(parseFloat(a), +bplus[2]),
+ f: getUnit(aUnit)
+ };
+ } else {
+ a = this.asPX(name);
+ return {
+ from: a,
+ to: op(a, this.asPX(name, bplus[2] + unit)),
+ f: getNumber
+ };
+ }
+ }
+ })(-10);
+});
+// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
var proto = Paper.prototype,
is = Snap.is;
@@ -4427,8 +4518,8 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
if (height != null) {
attr.height = height;
}
- if (vbx != null && vby != null && vbw != null && vbh != null) {
- attr.viewBox = [vbx, vby, vbw, vbh];
+ if (vx != null && vy != null && vw != null && vh != null) {
+ attr.viewBox = [vx, vy, vw, vh];
}
}
return this.el("pattern", attr);
@@ -6283,6 +6374,27 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
}
return this;
};
+ /*\
+ * Set.animate
+ [ method ]
+ **
+ * Animates each element in set in sync.
+ *
+ **
+ - attrs (object) key-value pairs of destination attributes
+ - duration (number) duration of the animation in milliseconds
+ - easing (function) #optional easing function from @mina or custom
+ - callback (function) #optional callback function that executes when the animation ends
+ * or
+ - animation (array) array of animation parameter for each element in set in format `[attrs, duration, easing, callback]`
+ > Usage
+ | // animate all elements in set to radius 10
+ | set.animate({r: 10}, 500, mina.easein);
+ | // or
+ | // animate first element to radius 10, but second to radius 20 and in different time
+ | set.animate([{r: 10}, 500, mina.easein], [{r: 20}, 1500, mina.easein]);
+ = (Element) the current element
+ \*/
setproto.animate = function (attrs, ms, easing, callback) {
if (typeof easing == "function" && !easing.length) {
callback = easing;
@@ -6294,6 +6406,10 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
ms = easing.dur;
attrs = attrs.attr;
}
+ var args = arguments;
+ if (Snap.is(attrs, "array") && Snap.is(args[args.length - 1], "array")) {
+ var each = true;
+ }
var begin,
handler = function () {
if (begin) {
@@ -6308,33 +6424,15 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
callback.call(this);
}
};
- return this.forEach(function (el) {
+ return this.forEach(function (el, i) {
eve.once("snap.animcreated." + el.id, handler);
- el.animate(attrs, ms, easing, callbacker);
+ if (each) {
+ args[i] && el.animate.apply(el, args[i]);
+ } else {
+ el.animate(attrs, ms, easing, callbacker);
+ }
});
};
- setproto.animateEach = function () {
- var i = 0,
- set = this,
- begin,
- handler = function () {
- if (begin) {
- this.b = begin;
- } else {
- begin = this.b;
- }
- },
- args = arguments,
- caller = function (args) {
- var el = set[i++];
- if (el) {
- el.animate.apply(el, arguments.length > 1 ? arguments : args);
- eve.once("snap.animcreated." + el.id, handler);
- }
- return set[i] ? caller : set;
- };
- return caller(args);
- };
setproto.remove = function () {
while (this.length) {
this.pop().remove();
@@ -6611,7 +6709,19 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
}
return out;
}
+ function arrayFirstValue(arr) {
+ var res;
+ for (var i = 0, ii = arr.length; i < ii; i++) {
+ res = res || arr[i];
+ if (res) {
+ return res;
+ }
+ }
+ }
Element.prototype.equal = function (name, b) {
+ return arrayFirstValue(eve("snap.util.equal", this, name, b));
+ };
+ eve.on("snap.util.equal", function (name, b) {
var A, B, a = Str(this.attr(name) || ""),
el = this;
if (a == +a && b == +b) {
@@ -6650,16 +6760,16 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
};
}
if (name == "points") {
- A = Str(a).split(",");
- B = Str(b).split(",");
+ A = Str(a).split(Snap._.separator);
+ B = Str(b).split(Snap._.separator);
return {
from: A,
to: B,
f: function (val) { return val; }
};
}
- var aUnit = a.match(reUnit),
- bUnit = Str(b).match(reUnit);
+ aUnit = a.match(reUnit);
+ var bUnit = Str(b).match(reUnit);
if (aUnit && aUnit == bUnit) {
return {
from: parseFloat(a),
@@ -6673,7 +6783,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
f: getNumber
};
}
- };
+ });
});
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
//
diff --git a/doc/reference.html b/doc/reference.html
index 426d1e7..c6faf86 100644
--- a/doc/reference.html
+++ b/doc/reference.html
@@ -335,18 +335,94 @@
Paper
+
+ Paper.circle()
+
+
+
+ Paper.clear()
+
+
Paper.el()
+
+ Paper.ellipse()
+
+
Paper.filter()
+
+ Paper.g()
+
+
+
+ Paper.gradient()
+
+
+
+ Paper.group()
+
+
+
+ Paper.image()
+
+
+
+ Paper.line()
+
+
+
+ Paper.mask()
+
+
+
+ Paper.path()
+
+
+
+ Paper.polygon()
+
+
+
+ Paper.polyline()
+
+
+
+ Paper.ptrn()
+
+
+
+ Paper.rect()
+
+
+
+ Paper.svg()
+
+
+
+ Paper.text()
+
+
+
+ Paper.toString()
+
+
+
+ Paper.use()
+
+
Set
+
+ Set.animate()
+
+
Set.bind()
@@ -376,7 +452,7 @@
- Snap()
+ Snap
@@ -2678,7 +2754,7 @@ c.node.onclick = function () {
- Element.attr(…)⚓➭
+ Element.attr(…)⚓➭
@@ -2687,7 +2763,7 @@ c.node.onclick = function () {
- Gets or sets given attributes of the element
+
Gets or sets given attributes of the element.
@@ -2809,7 +2885,8 @@ c.node.onclick = function () {
fill: "#fc0",
stroke: "#000",
strokeWidth: 2, // CamelCase...
- "fill-opacity": 0.5 // or dash-separated names
+ "fill-opacity": 0.5, // or dash-separated names
+ width: "*=2" // prefixed values
});
console.log(el.attr("fill")); // #fc0
@@ -2817,13 +2894,26 @@ console.log(el.attr("fill")); // #fc0
+
+ Prefixed values in format "+=10"
supported. All four operations
+(+
, -
, *
and /
) could be used. Optionally you can use units for +
+and -
: "+=2em"
.
+
+
+
+
+
+
+
+
+
- Element.getBBox()⚓➭
+ Element.getBBox()⚓➭
@@ -3005,7 +3095,7 @@ console.log(el.attr("fill")); // #fc0
- Element.transform(tstr)⚓➭
+ Element.transform(tstr)⚓➭
@@ -3169,7 +3259,7 @@ console.log(el.attr("fill")); // #fc0
- Element.parent()⚓➭
+ Element.parent()⚓➭
@@ -3211,7 +3301,7 @@ console.log(el.attr("fill")); // #fc0
- Element.append(el)⚓➭
+ Element.append(el)⚓➭
@@ -3271,7 +3361,7 @@ console.log(el.attr("fill")); // #fc0
- Element.add()⚓➭
+ Element.add()⚓➭
@@ -3296,7 +3386,7 @@ console.log(el.attr("fill")); // #fc0
- Element.appendTo(el)⚓➭
+ Element.appendTo(el)⚓➭
@@ -3356,7 +3446,7 @@ console.log(el.attr("fill")); // #fc0
- Element.prepend(el)⚓➭
+ Element.prepend(el)⚓➭
@@ -3416,7 +3506,7 @@ console.log(el.attr("fill")); // #fc0
- Element.prependTo(el)⚓➭
+ Element.prependTo(el)⚓➭
@@ -3476,7 +3566,7 @@ console.log(el.attr("fill")); // #fc0
- Element.before(el)⚓➭
+ Element.before(el)⚓➭
@@ -3536,7 +3626,7 @@ console.log(el.attr("fill")); // #fc0
- Element.after(el)⚓➭
+ Element.after(el)⚓➭
@@ -3596,7 +3686,7 @@ console.log(el.attr("fill")); // #fc0
- Element.insertBefore(el)⚓➭
+ Element.insertBefore(el)⚓➭
@@ -3656,7 +3746,7 @@ console.log(el.attr("fill")); // #fc0
- Element.insertAfter(el)⚓➭
+ Element.insertAfter(el)⚓➭
@@ -3716,7 +3806,7 @@ console.log(el.attr("fill")); // #fc0
- Element.remove()⚓➭
+ Element.remove()⚓➭
@@ -3758,7 +3848,7 @@ console.log(el.attr("fill")); // #fc0
- Element.select(query)⚓➭
+ Element.select(query)⚓➭
@@ -3818,7 +3908,7 @@ console.log(el.attr("fill")); // #fc0
- Element.selectAll(query)⚓➭
+ Element.selectAll(query)⚓➭
@@ -3880,7 +3970,7 @@ console.log(el.attr("fill")); // #fc0
- Element.asPX(attr, [value])⚓➭
+ Element.asPX(attr, [value])⚓➭
@@ -3943,7 +4033,7 @@ console.log(el.attr("fill")); // #fc0
- Element.use()⚓➭
+ Element.use()⚓➭
@@ -3985,7 +4075,7 @@ console.log(el.attr("fill")); // #fc0
- Element.clone()⚓➭
+ Element.clone()⚓➭
@@ -4027,7 +4117,7 @@ console.log(el.attr("fill")); // #fc0
- Element.toDefs()⚓➭
+ Element.toDefs()⚓➭
@@ -4069,7 +4159,7 @@ console.log(el.attr("fill")); // #fc0
- Element.pattern()⚓➭
+ Element.pattern()⚓➭
@@ -4094,7 +4184,7 @@ console.log(el.attr("fill")); // #fc0
- Element.toPattern(x, y, width, height)⚓➭
+ Element.toPattern(x, y, width, height)⚓➭
@@ -4194,7 +4284,7 @@ c.attr({
- Element.marker(x, y, width, height, refX, refY)⚓➭
+ Element.marker(x, y, width, height, refX, refY)⚓➭
@@ -4281,7 +4371,7 @@ To create a marker you have to specify the bounding rect and reference point:
- Snap.animation(attr, duration, [easing], [callback])⚓➭
+ Snap.animation(attr, duration, [easing], [callback])⚓➭
@@ -4350,7 +4440,7 @@ To create a marker you have to specify the bounding rect and reference point:
- Element.inAnim()⚓➭
+ Element.inAnim()⚓➭
@@ -4452,7 +4542,7 @@ To create a marker you have to specify the bounding rect and reference point:
- Snap.animate(from, to, setter, duration, [easing], [callback])⚓➭
+ Snap.animate(from, to, setter, duration, [easing], [callback])⚓➭
@@ -4613,7 +4703,7 @@ rect.animate({x: 10}, 1000);
- Element.stop()⚓➭
+ Element.stop()⚓➭
@@ -4655,7 +4745,7 @@ rect.animate({x: 10}, 1000);
- Element.animate(attrs, duration, [easing], [callback])⚓➭
+ Element.animate(attrs, duration, [easing], [callback])⚓➭
@@ -4724,7 +4814,7 @@ rect.animate({x: 10}, 1000);
- Element.data(key, [value])⚓➭
+ Element.data(key, [value])⚓➭
@@ -4846,7 +4936,7 @@ with data-
attributes)
- Element.removeData([key])⚓➭
+ Element.removeData([key])⚓➭
@@ -4907,7 +4997,7 @@ If key is not provided, removes all the data of the element.
- Element.outerSVG()⚓➭
+ Element.outerSVG()⚓➭
@@ -4950,7 +5040,7 @@ If key is not provided, removes all the data of the element.
- Element.toString()⚓➭
+ Element.toString()⚓➭
@@ -4975,7 +5065,7 @@ If key is not provided, removes all the data of the element.
- Element.innerSVG()⚓➭
+ Element.innerSVG()⚓➭
@@ -5017,7 +5107,7 @@ If key is not provided, removes all the data of the element.
- Snap.parse(svg)⚓➭
+ Snap.parse(svg)⚓➭
@@ -5077,7 +5167,7 @@ If key is not provided, removes all the data of the element.
- Fragment.select()⚓➭
+ Fragment.select()⚓➭
@@ -5102,7 +5192,7 @@ If key is not provided, removes all the data of the element.
- Fragment.selectAll()⚓➭
+ Fragment.selectAll()⚓➭
@@ -5127,7 +5217,7 @@ If key is not provided, removes all the data of the element.
- Snap.fragment(varargs)⚓➭
+ Snap.fragment(varargs)⚓➭
@@ -5187,7 +5277,7 @@ If key is not provided, removes all the data of the element.
- Paper.el(name, attr)⚓➭
+ Paper.el(name, attr)⚓➭
@@ -5283,7 +5373,7 @@ var c = paper.el("circle", {
- Snap.ajax(…)⚓➭
+ Snap.ajax(…)⚓➭
@@ -5387,7 +5477,7 @@ var c = paper.el("circle", {
- Snap.load(url, callback, [scope])⚓➭
+ Snap.load(url, callback, [scope])⚓➭
@@ -5436,7 +5526,7 @@ var c = paper.el("circle", {
- Snap.getElementByPoint(x, y)⚓➭
+ Snap.getElementByPoint(x, y)⚓➭
@@ -5521,7 +5611,7 @@ var c = paper.el("circle", {
- Snap.plugin(f)⚓➭
+ Snap.plugin(f)⚓➭
@@ -5585,6 +5675,1689 @@ prototypes). This allow you to extend anything you want.
+
+
+
+
+
+
+ Paper.rect(x, y, width, height, [rx], [ry])⚓➭
+
+
+
+
+
+
+
+
+
Draws a rectangle
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - x
+ number
+ x coordinate of the top left corner
+ - y
+ number
+ y coordinate of the top left corner
+ - width
+ number
+ width
+ - height
+ number
+ height
+ - rx
+ number
+ horizontal radius for rounded corners, default is 0
+ - ry
+ number
+ vertical radius for rounded corners, default is rx or 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+ object
+
+ the rect
element
+
+
+
+
+
+
+
+
+
+
Usage
+
+
+
+
+
+
+
+
+
+
+
+
// regular rectangle
+var c = paper.rect(10, 10, 50, 50);
+// rectangle with rounded corners
+var c = paper.rect(40, 40, 50, 50, 10);
+
+
+
+
+
+
+
+
+
+
+
+ Paper.circle(x, y, r)⚓➭
+
+
+
+
+
+
+
+
+
Draws a circle
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - x
+ number
+ x coordinate of the centre
+ - y
+ number
+ y coordinate of the centre
+ - r
+ number
+ radius
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+ object
+
+ the circle
element
+
+
+
+
+
+
+
+
+
+
Usage
+
+
+
+
+
+
+
+
+
+
+
+
var c = paper.circle(50, 50, 40);
+
+
+
+
+
+
+
+
+
+
+
+ Paper.image(src, x, y, width, height)⚓➭
+
+
+
+
+
+
+
+
+
Places an image on the surface
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - src
+ string
+ URI of the source image
+ - x
+ number
+ x offset position
+ - y
+ number
+ y offset position
+ - width
+ number
+ width of the image
+ - height
+ number
+ height of the image
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+ object
+
+ the image
element
+
+
+
+
+
+
+
or
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+ object
+
+ Snap element object with type image
+
+
+
+
+
+
+
+
+
+
Usage
+
+
+
+
+
+
+
+
+
+
+
+
var c = paper.image("apple.png", 10, 10, 80, 80);
+
+
+
+
+
+
+
+
+
+
+
+ Paper.ellipse(x, y, rx, ry)⚓➭
+
+
+
+
+
+
+
+
+
Draws an ellipse
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - x
+ number
+ x coordinate of the centre
+ - y
+ number
+ y coordinate of the centre
+ - rx
+ number
+ horizontal radius
+ - ry
+ number
+ vertical radius
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+ object
+
+ the ellipse
element
+
+
+
+
+
+
+
+
+
+
Usage
+
+
+
+
+
+
+
+
+
+
+
+
var c = paper.ellipse(50, 50, 40, 20);
+
+
+
+
+
+
+
+
+
+
+
+ Paper.path([pathString])⚓➭
+
+
+
+
+
+
+
+
+
Creates a <path>
element using the given string as the path's definition
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - pathString
+ string
+ path string in SVG format
+
+
+
+
+
+
+
+
+
+
+
+
Path string consists of one-letter commands, followed by comma seprarated arguments in numerical form. Example:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
This example features two commands: M
, with arguments (10, 20)
and L
with arguments (30, 40)
. Uppercase letter commands express coordinates in absolute terms, while lowercase commands express them in relative terms from the most recently declared coordinates.
+
+
+
+
+
+
+
+
+
+
+
+
+
Here is short list of commands available, for more details see SVG path string format or article about path strings at MDN.
+
+
+
+
+
+
+
+
+
+
+
+
Command | Name | Parameters |
+
+
+
+
+
+
+
+
+
+
+
+ M | moveto | (x y)+ |
+
+
+
+
+
+
+
+
+
+
+
+ Z | closepath | (none) |
+
+
+
+
+
+
+
+
+
+
+
+ L | lineto | (x y)+ |
+
+
+
+
+
+
+
+
+
+
+
+ H | horizontal lineto | x+ |
+
+
+
+
+
+
+
+
+
+
+
+ V | vertical lineto | y+ |
+
+
+
+
+
+
+
+
+
+
+
+ C | curveto | (x1 y1 x2 y2 x y)+ |
+
+
+
+
+
+
+
+
+
+
+
+ S | smooth curveto | (x2 y2 x y)+ |
+
+
+
+
+
+
+
+
+
+
+
+ Q | quadratic Bézier curveto | (x1 y1 x y)+ |
+
+
+
+
+
+
+
+
+
+
+
+ T | smooth quadratic Bézier curveto | (x y)+ |
+
+
+
+
+
+
+
+
+
+
+
+ A | elliptical arc | (rx ry x-axis-rotation large-arc-flag sweep-flag x y)+ |
+
+
+
+
+
+
+
+
+
+
+
+ R | Catmull-Rom curveto* | x1 y1 (x y)+ |
+
+
+
+
+
+
+
+
+
+
Catmull-Rom curveto is a not standard SVG command and added to make life easier.
+Note: there is a special case when a path consists of only three commands:
M10,10R…z
. In this case the path connects back to its starting point.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Usage
+
+
+
+
+
+
+
+
+
+
+
+
var c = paper.path("M10 10L90 90");
+// draw a diagonal line:
+// move to 10,10, line to 90,90
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Creates a group element
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - varargs
+ …
+ elements to nest within the group
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+ object
+
+ the g
element
+
+
+
+
+
+
+
+
+
+
Usage
+
+
+
+
+
+
+
+
+
+
+
+
var c1 = paper.circle(),
+ c2 = paper.rect(),
+ g = paper.g(c2, c1); // note that the order of elements is different
+
+
+
+
+
+
+
or
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
var c1 = paper.circle(),
+ c2 = paper.rect(),
+ g = paper.g();
+g.add(c2, c1);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
See Paper.g
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Paper.svg(x, y, width, height, vbx, vby, vbw, vbh)⚓➭
+
+
+
+
+
+
+
+
+
Creates a nested SVG element.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - x
+ number
+ optional X of the element
+ - y
+ number
+ optional Y of the element
+ - width
+ number
+ optional width of the element
+ - height
+ number
+ optional height of the element
+ - vbx
+ number
+ optional viewbox X
+ - vby
+ number
+ optional viewbox Y
+ - vbw
+ number
+ optional viewbox width
+ - vbh
+ number
+ optional viewbox height
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+ object
+
+ the svg
element
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Equivalent in behaviour to Paper.g, except it’s a mask.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+ object
+
+ the mask
element
+
+
+
+
+
+
+
+
+
+
+
+ Paper.ptrn(x, y, width, height, vbx, vby, vbw, vbh)⚓➭
+
+
+
+
+
+
+
+
+
Equivalent in behaviour to Paper.g, except it’s a mask.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - x
+ number
+ optional X of the element
+ - y
+ number
+ optional Y of the element
+ - width
+ number
+ optional width of the element
+ - height
+ number
+ optional height of the element
+ - vbx
+ number
+ optional viewbox X
+ - vby
+ number
+ optional viewbox Y
+ - vbw
+ number
+ optional viewbox width
+ - vbh
+ number
+ optional viewbox height
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+ object
+
+ the mask
element
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Creates a <use> element.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - id
+ string
+ optional id of element to link
+
+
+
+
+
+
+
+
+
+
+
+
or
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - id
+ Element
+ optional element to link
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+ object
+
+ the use
element
+
+
+
+
+
+
+
+
+
+
+
+ Paper.text(x, y, text)⚓➭
+
+
+
+
+
+
+
+
+
Draws a text string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - x
+ number
+ x coordinate position
+ - y
+ number
+ y coordinate position
+ - text
+ string array
+ The text string to draw or array of strings to nest within separate
<tspan>
elements
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+ object
+
+ the text
element
+
+
+
+
+
+
+
+
+
+
Usage
+
+
+
+
+
+
+
+
+
+
+
+
var t1 = paper.text(50, 50, "Snap");
+var t2 = paper.text(50, 50, ["S","n","a","p"]);
+// Text path usage
+t1.attr({textpath: "M10,10L100,100"});
+// or
+var pth = paper.path("M10,10L100,100");
+t1.attr({textpath: pth});
+
+
+
+
+
+
+
+
+
+
+
+ Paper.line(x1, y1, x2, y2)⚓➭
+
+
+
+
+
+
+
+
+
Draws a line
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - x1
+ number
+ x coordinate position of the start
+ - y1
+ number
+ y coordinate position of the start
+ - x2
+ number
+ x coordinate position of the end
+ - y2
+ number
+ y coordinate position of the end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+ object
+
+ the line
element
+
+
+
+
+
+
+
+
+
+
Usage
+
+
+
+
+
+
+
+
+
+
+
+
var t1 = paper.line(50, 50, 100, 100);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Draws a polyline
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - points
+ array
+ array of points
+
+
+
+
+
+
+
+
+
+
+
+
or
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - varargs
+ …
+ points
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+ object
+
+ the polyline
element
+
+
+
+
+
+
+
+
+
+
Usage
+
+
+
+
+
+
+
+
+
+
+
+
var p1 = paper.polyline([10, 10, 100, 100]);
+var p2 = paper.polyline(10, 10, 100, 100);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Paper.gradient(gradient)⚓➭
+
+
+
+
+
+
+
+
+
Creates a gradient element
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - gradient
+ string
+ gradient descriptor
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Gradient Descriptor
+
+
+
+
+
+
+
+
The gradient descriptor is an expression formatted as
+follows: <type>(<coords>)<colors>
. The <type>
can be
+either linear or radial. The uppercase L
or R
letters
+indicate absolute coordinates offset from the SVG surface.
+Lowercase l
or r
letters indicate coordinates
+calculated relative to the element to which the gradient is
+applied. Coordinates specify a linear gradient vector as
+x1
, y1
, x2
, y2
, or a radial gradient as cx
, cy
,
+r
and optional fx
, fy
specifying a focal point away
+from the center of the circle. Specify <colors>
as a list
+of dash-separated CSS color values. Each color may be
+followed by a custom offset value, separated with a colon
+character.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Examples
+
+
+
+
+
+
+
+
Linear gradient, relative from top-left corner to bottom-right
+corner, from black through red to white:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
var g = paper.gradient("l(0, 0, 1, 1)#000-#f00-#fff");
+
+
+
+
+
+
+
Linear gradient, absolute from (0, 0) to (100, 100), from black
+through red at 25% to white:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
var g = paper.gradient("L(0, 0, 100, 100)#000-#f00:25-#fff");
+
+
+
+
+
+
+
Radial gradient, relative from the center of the element with radius
+half the width, from black to white:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
var g = paper.gradient("r(0.5, 0.5, 0.5)#000-#fff");
+
+
+
+
+
+
+
To apply the gradient:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
paper.circle(50, 50, 40).attr({
+ fill: g
+});
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+ object
+
+ the gradient
element
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns SVG code for the Paper
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+ string
+
+ SVG code for the Paper
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Removes all child nodes of the paper, except <defs>.
+
+
+
+
+
+
+
+
+
@@ -10591,13 +12364,137 @@ Converts path to a new path where all segments are cubic beziér curves
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Animates each element in set in sync.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - attrs
+ object
+ key-value pairs of destination attributes
+ - duration
+ number
+ duration of the animation in milliseconds
+ - easing
+ function
+ easing function from mina or custom
+ - callback
+ function
+ callback function that executes when the animation ends
+
+
+
+
+
+
+
+
+
+
+
+
or
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - animation
+ array
+ array of animation parameter for each element in set in format
[attrs, duration, easing, callback]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Usage
+
+
+
+
+
+
+
+
+
+
+
+
// animate all elements in set to radius 10
+set.animate({r: 10}, 500, mina.easein);
+// or
+// animate first element to radius 10, but second to radius 20 and in different time
+set.animate([{r: 10}, 500, mina.easein], [{r: 20}, 1500, mina.easein]);
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+ Element
+
+ the current element
+
+
+
+
+
- Set.bind(…)⚓➭
+ Set.bind(…)⚓➭
@@ -10728,7 +12625,7 @@ to a set.
- Set.clear()⚓➭
+ Set.clear()⚓➭
@@ -10753,7 +12650,7 @@ to a set.
- Set.splice(index, count, [insertion…])⚓➭
+ Set.splice(index, count, [insertion…])⚓➭
@@ -10819,7 +12716,7 @@ to a set.
- Set.exclude(element)⚓➭
+ Set.exclude(element)⚓➭
diff --git a/dr.json b/dr.json
index 9124ec1..e1906f4 100644
--- a/dr.json
+++ b/dr.json
@@ -5,6 +5,9 @@
"files": [{
"url": "src/svg.js",
"link": "https://github.com/adobe-webplatform/savage/blob/master/src/svg.js"
+ }, {
+ "url": "src/paper.js",
+ "link": "https://github.com/adobe-webplatform/savage/blob/master/src/paper.js"
}, {
"url": "src/equal.js",
"link": "https://github.com/adobe-webplatform/savage/blob/master/src/equal.js"
diff --git a/history.md b/history.md
index 5e6b47c..30533a5 100644
--- a/history.md
+++ b/history.md
@@ -7,6 +7,7 @@
* Added syncronisation for `Set.animate()`
* Added method `Set.animateEach`
* Added opacity to the shadow filter
+* Added ability to specify attributes as `"+=10"` or `"-=1em"` or `"*=2"`
* Fix negative scale
* Fix for `path2curve`
* Fixed shared `` issue
diff --git a/src/attradd.js b/src/attradd.js
new file mode 100644
index 0000000..28b6ad1
--- /dev/null
+++ b/src/attradd.js
@@ -0,0 +1,89 @@
+// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
+ var operators = {
+ "+": function (x, y) {
+ return x + y;
+ },
+ "-": function (x, y) {
+ return x - y;
+ },
+ "/": function (x, y) {
+ return x / y;
+ },
+ "*": function (x, y) {
+ return x * y;
+ }
+ },
+ Str = String,
+ reUnit = /[a-z]+$/i,
+ reAddon = /^\s*([+\-\/*])\s*=\s*([\d.eE+\-]+)\s*([^\d\s]+)?\s*$/;
+ function getNumber(val) {
+ return val;
+ }
+ function getUnit(unit) {
+ return function (val) {
+ return +val.toFixed(3) + unit;
+ };
+ }
+ eve.on("snap.util.attr", function (val) {
+ var plus = Str(val).match(reAddon);
+ if (plus) {
+ var evnt = eve.nt(),
+ name = evnt.substring(evnt.lastIndexOf(".") + 1),
+ a = this.attr(name),
+ atr = {};
+ eve.stop();
+ var unit = plus[3] || "",
+ aUnit = a.match(reUnit),
+ op = operators[plus[1]];
+ if (aUnit && aUnit == unit) {
+ val = op(parseFloat(a), +plus[2]);
+ } else {
+ a = this.asPX(name);
+ val = op(this.asPX(name), this.asPX(name, plus[2] + unit));
+ }
+ if (isNaN(a) || isNaN(val)) {
+ return;
+ }
+ atr[name] = val;
+ this.attr(atr);
+ }
+ })(-10);
+ eve.on("snap.util.equal", function (name, b) {
+ var A, B, a = Str(this.attr(name) || ""),
+ el = this,
+ bplus = Str(b).match(reAddon);
+ if (bplus) {
+ eve.stop();
+ var unit = bplus[3] || "",
+ aUnit = a.match(reUnit),
+ op = operators[bplus[1]];
+ if (aUnit && aUnit == unit) {
+ return {
+ from: parseFloat(a),
+ to: op(parseFloat(a), +bplus[2]),
+ f: getUnit(aUnit)
+ };
+ } else {
+ a = this.asPX(name);
+ return {
+ from: a,
+ to: op(a, this.asPX(name, bplus[2] + unit)),
+ f: getNumber
+ };
+ }
+ }
+ })(-10);
+});
\ No newline at end of file
diff --git a/src/equal.js b/src/equal.js
index 65504f4..8534119 100644
--- a/src/equal.js
+++ b/src/equal.js
@@ -103,7 +103,19 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
}
return out;
}
+ function arrayFirstValue(arr) {
+ var res;
+ for (var i = 0, ii = arr.length; i < ii; i++) {
+ res = res || arr[i];
+ if (res) {
+ return res;
+ }
+ }
+ }
Element.prototype.equal = function (name, b) {
+ return arrayFirstValue(eve("snap.util.equal", this, name, b));
+ };
+ eve.on("snap.util.equal", function (name, b) {
var A, B, a = Str(this.attr(name) || ""),
el = this;
if (a == +a && b == +b) {
@@ -142,16 +154,16 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
};
}
if (name == "points") {
- A = Str(a).split(",");
- B = Str(b).split(",");
+ A = Str(a).split(Snap._.separator);
+ B = Str(b).split(Snap._.separator);
return {
from: A,
to: B,
f: function (val) { return val; }
};
}
- var aUnit = a.match(reUnit),
- bUnit = Str(b).match(reUnit);
+ aUnit = a.match(reUnit);
+ var bUnit = Str(b).match(reUnit);
if (aUnit && aUnit == bUnit) {
return {
from: parseFloat(a),
@@ -165,5 +177,5 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
f: getNumber
};
}
- };
+ });
});
\ No newline at end of file
diff --git a/src/set.js b/src/set.js
index ede9758..76e41cf 100644
--- a/src/set.js
+++ b/src/set.js
@@ -82,6 +82,27 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
}
return this;
};
+ /*\
+ * Set.animate
+ [ method ]
+ **
+ * Animates each element in set in sync.
+ *
+ **
+ - attrs (object) key-value pairs of destination attributes
+ - duration (number) duration of the animation in milliseconds
+ - easing (function) #optional easing function from @mina or custom
+ - callback (function) #optional callback function that executes when the animation ends
+ * or
+ - animation (array) array of animation parameter for each element in set in format `[attrs, duration, easing, callback]`
+ > Usage
+ | // animate all elements in set to radius 10
+ | set.animate({r: 10}, 500, mina.easein);
+ | // or
+ | // animate first element to radius 10, but second to radius 20 and in different time
+ | set.animate([{r: 10}, 500, mina.easein], [{r: 20}, 1500, mina.easein]);
+ = (Element) the current element
+ \*/
setproto.animate = function (attrs, ms, easing, callback) {
if (typeof easing == "function" && !easing.length) {
callback = easing;
@@ -93,6 +114,10 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
ms = easing.dur;
attrs = attrs.attr;
}
+ var args = arguments;
+ if (Snap.is(attrs, "array") && Snap.is(args[args.length - 1], "array")) {
+ var each = true;
+ }
var begin,
handler = function () {
if (begin) {
@@ -107,42 +132,15 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
callback.call(this);
}
};
- return this.forEach(function (el) {
+ return this.forEach(function (el, i) {
eve.once("snap.animcreated." + el.id, handler);
- el.animate(attrs, ms, easing, callbacker);
+ if (each) {
+ args[i] && el.animate.apply(el, args[i]);
+ } else {
+ el.animate(attrs, ms, easing, callbacker);
+ }
});
};
- /*\
- * Set.animateEach
- [ method ]
- **
- * Creates multiple animations for each element in the seet. Ensures that they are synced.
- *
- **
- = (function) next element animate function
- \*/
- setproto.animateEach = function () {
- var i = 0,
- set = this,
- begin,
- handler = function () {
- if (begin) {
- this.b = begin;
- } else {
- begin = this.b;
- }
- },
- args = arguments,
- caller = function (args) {
- var el = set[i++];
- if (el) {
- el.animate.apply(el, arguments.length > 1 ? arguments : args);
- eve.once("snap.animcreated." + el.id, handler);
- }
- return set[i] ? caller : set;
- };
- return caller(args);
- };
setproto.remove = function () {
while (this.length) {
this.pop().remove();
diff --git a/src/svg.js b/src/svg.js
index 0cc5d23..c25f1e9 100644
--- a/src/svg.js
+++ b/src/svg.js
@@ -1216,7 +1216,7 @@ function arrayFirstValue(arr) {
* Element.attr
[ method ]
**
- * Gets or sets given attributes of the element
+ * Gets or sets given attributes of the element.
**
- params (object) contains key-value pairs of attributes you want to set
* or
@@ -1229,9 +1229,13 @@ function arrayFirstValue(arr) {
| fill: "#fc0",
| stroke: "#000",
| strokeWidth: 2, // CamelCase...
- | "fill-opacity": 0.5 // or dash-separated names
+ | "fill-opacity": 0.5, // or dash-separated names
+ | width: "*=2" // prefixed values
| });
| console.log(el.attr("fill")); // #fc0
+ * Prefixed values in format `"+=10"` supported. All four operations
+ * (`+`, `-`, `*` and `/`) could be used. Optionally you can use units for `+`
+ * and `-`: `"+=2em"`.
\*/
elproto.attr = function (params, value) {
var el = this,
@@ -2050,8 +2054,6 @@ function arrayFirstValue(arr) {
}
return this;
};
- // SIERRA Element.animate(): For _attrs_, clarify if they represent the destination values, and if the animation executes relative to the element's current attribute values.
- // SIERRA would a _custom_ animation function be an SVG keySplines value?
/*\
* Element.animate
[ method ]
diff --git a/test/attradd.js b/test/attradd.js
new file mode 100644
index 0000000..7622ffe
--- /dev/null
+++ b/test/attradd.js
@@ -0,0 +1,38 @@
+describe("Attributes += methods", function () {
+ var s, r;
+ beforeEach(function () {
+ s = Snap(100, 100);
+ r = s.rect(10, 10, 50, 50);
+ });
+ afterEach(function () {
+ s.remove();
+ });
+ it("+=10", function () {
+ r.attr({x: "+=10"});
+ expect(r.node.getAttribute("x")).to.be("20");
+ });
+ it("-=10", function () {
+ r.attr({x: "-=10"});
+ expect(r.node.getAttribute("x")).to.be("0");
+ });
+ it("*=2", function () {
+ r.attr({x: "*=2"});
+ expect(r.node.getAttribute("x")).to.be("20");
+ });
+ it("/=2", function () {
+ r.attr({x: "/=2"});
+ expect(r.node.getAttribute("x")).to.be("5");
+ });
+ it("+=1em", function () {
+ var em = s.rect(0, 0, "1em", "1em");
+ em = em.getBBox().w;
+ r.attr({x: "+=1em"});
+ expect(r.node.getAttribute("x")).to.eql(10 + em);
+ });
+ it("-=.3em", function () {
+ var em = s.rect(0, 0, "1em", "1em");
+ em = em.getBBox().w;
+ r.attr({x: "-=.3em"});
+ expect((+r.node.getAttribute("x")).toFixed(2)).to.eql((10 - em * .3).toFixed(2));
+ });
+});
diff --git a/test/test.html b/test/test.html
index 43420d9..5b8a3a6 100644
--- a/test/test.html
+++ b/test/test.html
@@ -37,6 +37,7 @@
+