1 line
3.2 KiB
JavaScript
1 line
3.2 KiB
JavaScript
!function(T){"use strict";var t="ht",g=T[t],O=g.Default,n=Math,X=(n.PI,n.sin,n.cos,n.atan2,n.sqrt,n.max),U=n.floor,f=(n.round,n.ceil),h=g.Shape,q=(g.Edge,g.List),J=g.Style,c=g.graph,x=O.getInternal(),B=x.ui(),A=null,H="prototype",F=T.clearInterval,d=T.setInterval,G=function(L){var _=L.data,k=this.dm();if(_&&"add"===L.kind){var K=k.$1c,v=_ instanceof h?"shape.":"edge.";K&&_.s(v+"dash.flow")&&K.indexOf(_)<0&&K.push(_)}"clear"===L.kind&&(k.$1c=[])},L=function(n){var v=n.property,M=n.data,T=n.newValue,a=this.dm().$1c,i=M instanceof h?"s:shape.dash.flow":"s:edge.dash.flow";if(a&&v===i)if(T)a.indexOf(M)<0&&a.push(M);else for(var H=a.length,s=0;H>s;s++)if(a[s]===M){a.splice(s,1);break}},o=c.GraphView[H],l=B.EdgeUI[H],P=B.ShapeUI[H],j=P._80o,_=l._80o,k=g.DataModel[H],w=k.prepareRemove,b=o.setDataModel;J["edge.dash.flow.step"]==A&&(J["edge.dash.flow.step"]=3),J["shape.dash.flow.step"]==A&&(J["shape.dash.flow.step"]=3),k.prepareRemove=function(v){w.call(this,v);var Z=v._dataModel,e=Z.$1c;if(e)for(var B=e.length,k=0;B>k;k++)if(e[k]===v){e.splice(k,1);break}},o.setDataModel=function(B){var w=this,m=w._dataModel;if(m!==B){m&&(m.umm(G,w),m.umd(L,w),m.$1c=[]),B.mm(G,w),B.md(L,w);var $=B.$1c=[];B.each(function(I){var q=I instanceof h?"shape.":"edge.";I.s(q+"dash.flow")&&$.indexOf(I)<0&&$.push(I)}),b.call(w,B)}},o.setDashFlowInterval=function(k){var m=this,U=m.$2c;m.$2c=k,m.fp("dashFlowInterval",U,k),m.$3c!=A&&(F(m.$3c),delete m.$3c,m.enableDashFlow(k))},o.getDashFlowInterval=function(){return this.$2c},o.$4c=function(){var t,m,D,k=this,F=k.tx(),G=k.ty(),e=k._zoom,T=k.getWidth(),M=k.getHeight(),s={x:-F/e,y:-G/e,width:T/e,height:M/e},b=k.dm().$1c,K=k._56I,o=new q;if(b.forEach(function(F){K[F.getId()]&&(t=k.getDataUI(F),t&&(D=t._79o(),D&&o.add(D)))}),0!==o.size()&&(o.each(function(C){O.intersectsRect(s,C)&&(m=O.unionRect(m,C))}),m&&(m&&(O.grow(m,X(1,1/e)),m.x=U(m.x*e)/e,m.y=U(m.y*e)/e,m.width=f(m.width*e)/e,m.height=f(m.height*e)/e,m=O.intersection(s,m)),m))){var i=k._canvas.getContext("2d");i.save(),i.lineCap=O.lineCap,i.lineJoin=O.lineJoin;var z=O.devicePixelRatio,r=m.x,y=m.y,h=m.width,P=m.height;r=Math.floor((r*e+F)*z),y=Math.floor((y*e+G)*z),h=Math.ceil(h*e*z)+1,P=Math.ceil(P*e*z)+1,m.x=(r/z-F)/e,m.y=(y/z-G)/e,m.width=h/z/e,m.height=P/z/e,i.beginPath(),i.rect(r,y,h,P),i.clip(),i.clearRect(r,y,h,P),x.translateAndScale(i,F,G,e),k.$5c(i,m),i.restore()}},o.$5c=function(X,t){var i,l,j=this;j._93db(X),j.each(function(b){j._56I[b._id]&&(i=j.getDataUI(b),i&&(l=i._79o(),(!t||O.intersectsRect(t,l))&&(i.$7c=!0,i._42(X),delete i.$7c)))}),j._92db(X)},o.enableDashFlow=function(i){var n=this;n.$3c==A&&(n.$3c=d(function(){n.$4c()},i||n.$2c||50))},o.disableDashFlow=function(){var t=this;F(t.$3c),delete t.$3c};var z=function(){var $=this,y=$._data,Z=y instanceof h?"shape.":"edge.",D=y.s(Z+"dash.pattern"),O=y.s(Z+"dash.flow.reverse");if(D&&y.s(Z+"dash")&&y.s(Z+"dash.flow")&&$.$7c){var d=$.s(Z+"dash.offset")||0,N=y.s(Z+"dash.flow.step"),v=y.getStyleMap(),S=0;D.forEach(function(m){S+=m}),O&&(N=-N),d-=N,d%=S,v||(y._styleMap=v={}),v[Z+"dash.offset"]=d}};l._80o=function(I){_.call(this,I),z.call(this)},P._80o=function(D){j.call(this,D),z.call(this)}}("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:(0,eval)("this"),Object); |