UNPKG

@zklogic/draw.io

Version:

Draw.IO - Graph Editor integration in Angular-cli

1 lines 14 kB
function mxShapeMockupBreadcrumb(e,t,o,l){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=o,this.strokewidth=null!=l?l:1}function mxShapeMockupStepBar(e,t,o,l){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=o,this.strokewidth=null!=l?l:1}function mxShapeMockupCoverFlow(e,t,o,l){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=o,this.strokewidth=null!=l?l:1}function mxShapeMockupScrollBar(e,t,o,l){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=o,this.strokewidth=null!=l?l:1}function mxShapeMockupPagination(e,t,o,l){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=o,this.strokewidth=null!=l?l:1}function mxShapeMockupPageControl(e,t,o,l){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=o,this.strokewidth=null!=l?l:1}function mxShapeMockupMapNavigator(e,t,o,l){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=o,this.strokewidth=null!=l?l:1}function mxShapeMockupNavigationAnchor(e,t,o,l){mxShape.call(this),this.bounds=e}mxUtils.extend(mxShapeMockupBreadcrumb,mxShape),mxShapeMockupBreadcrumb.prototype.cst={SHAPE_BREADCRUMB:"mxgraph.mockup.navigation.breadcrumb",MAIN_TEXT:"mainText",TEXT_SIZE:"textSize",TEXT_COLOR:"textColor",TEXT_COLOR2:"textColor2"},mxShapeMockupBreadcrumb.prototype.paintVertexShape=function(e,t,o,l,r){for(var a=mxUtils.getValue(this.style,mxShapeMockupBreadcrumb.prototype.cst.MAIN_TEXT,"Layer 1, Layer 2, Layer 3").toString().split(","),i=mxUtils.getValue(this.style,mxShapeMockupBreadcrumb.prototype.cst.TEXT_COLOR,"#666666"),p=mxUtils.getValue(this.style,mxShapeMockupBreadcrumb.prototype.cst.TEXT_COLOR2,"#008cff"),n=mxUtils.getValue(this.style,mxShapeMockupBreadcrumb.prototype.cst.TEXT_SIZE,"17").toString(),s=mxUtils.getValue(this.style,mxConstants.STYLE_STROKECOLOR,"#c4c4c4"),S=a.length,m=new Array(S),h=0,c=0;c<S;c++)m[c]=mxUtils.getSizeForString(a[c],n,mxConstants.DEFAULT_FONTFAMILY).width,h+=m[c];var x=Math.max(r,1.5*n,20),u=20*S+h,T=Math.max(l,u);e.translate(t,o),e.setShadow(!1),this.separators(e,T,x,S,m,10,u,s);var k=0;for(c=0;c<S;c++)c+1===S?e.setFontColor(p):e.setFontColor(i),k+=10,this.buttonText(e,k,x,a[c],m[c],n,u,T),k=k+m[c]+10},mxShapeMockupBreadcrumb.prototype.separators=function(e,t,o,l,r,a,i,p){e.setStrokeColor(p);var n=.5*o;e.begin();for(var s=1;s<l;s++){for(var S=0,m=0;m<s;m++)S+=r[m]+2*a;S=S*t/i,e.moveTo(S-2.5,n-5),e.lineTo(S+2.5,n),e.lineTo(S-2.5,n+5)}e.stroke()},mxShapeMockupBreadcrumb.prototype.buttonText=function(e,t,o,l,r,a,i,p){e.begin(),e.setFontSize(a),e.text((t+.5*r)*p/i,.5*o,0,0,l,mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0)},mxCellRenderer.registerShape(mxShapeMockupBreadcrumb.prototype.cst.SHAPE_BREADCRUMB,mxShapeMockupBreadcrumb),mxUtils.extend(mxShapeMockupStepBar,mxShape),mxShapeMockupStepBar.prototype.cst={SHAPE_STEP_BAR:"mxgraph.mockup.navigation.stepBar",SELECTED:"+",MAIN_TEXT:"mainText",TEXT_SIZE:"textSize",TEXT_COLOR:"textColor",TEXT_COLOR2:"textColor2"},mxShapeMockupStepBar.prototype.customProperties=[{name:"mainText",dispName:"Text",type:"string"},{name:"textSize",dispName:"Text Size",type:"float"},{name:"textColor",dispName:"Text Color",type:"color"},{name:"textColor2",dispName:"Text2 Color",type:"color"}],mxShapeMockupStepBar.prototype.paintVertexShape=function(e,t,o,l,r){for(var a=mxUtils.getValue(this.style,mxShapeMockupStepBar.prototype.cst.MAIN_TEXT,"Step 1, Step 2, Step 3").toString().split(","),i=mxUtils.getValue(this.style,mxShapeMockupStepBar.prototype.cst.TEXT_COLOR,"#666666"),p=mxUtils.getValue(this.style,mxShapeMockupStepBar.prototype.cst.TEXT_COLOR2,"#008cff"),n=mxUtils.getValue(this.style,mxShapeMockupStepBar.prototype.cst.TEXT_SIZE,"17").toString(),s=mxUtils.getValue(this.style,mxConstants.STYLE_STROKECOLOR,"#c4c4c4"),S=mxUtils.getValue(this.style,mxConstants.STYLE_FILLCOLOR,"#666666"),m=a.length,h=new Array(m),c=0,x=-1,u=0;u<m;u++){var T=a[u];T.charAt(0)===mxShapeMockupStepBar.prototype.cst.SELECTED&&(T=a[u].substring(1),x=u),h[u]=mxUtils.getSizeForString(T,n,mxConstants.DEFAULT_FONTFAMILY).width,c+=h[u]}var k=Math.max(r,1.5*n,20),g=20*m+c,C=Math.max(l,g);e.translate(t,o),this.stepLineBg(e,C,k,m,h,10,g,s,n,C),e.setShadow(!1),this.stepLineFg(e,C,k,m,h,10,g,s,S,p,n,C,x);var M=0;for(u=0;u<m;u++)u>=x?e.setFontColor(p):e.setFontColor(i),M+=10,this.buttonText(e,M,k,a[u],h[u],n,g,C),M=M+h[u]+10},mxShapeMockupStepBar.prototype.stepLineBg=function(e,t,o,l,r,a,i,p,n,s){e.setStrokeColor(p),e.setFillColor(p);for(var S=2*n,m=0,h=0,c=0;c<l;c++){for(var x=0,u=0;u<c;u++)x+=r[u]+2*a;x=(x+=.5*r[c]+a)*t/i,0===c?m=x:c+1===l&&(h=x),e.begin(),e.ellipse(x-10,S-10,20,20),e.fillAndStroke()}e.begin(),e.rect(m,S-2,h-m,4),e.fillAndStroke()},mxShapeMockupStepBar.prototype.stepLineFg=function(e,t,o,l,r,a,i,p,n,s,S,m,h){e.setStrokeColor(n);for(var c=2*S,x=7.5,u=0,T=0,k=mxUtils.getValue(this.style,mxConstants.STYLE_STROKEWIDTH,"1"),g=0;g<=h;g++){for(var C=0,M=0;M<g;M++)C+=r[M]+2*a;C=(C+=.5*r[g]+a)*t/i,0===g?u=C:g===h&&(T=C)}for(e.setFillColor(n),e.begin(),e.rect(u,c-1.125,T-u,2.25),e.fill(),e.setFillColor(p),g=0;g<=h;g++){for(C=0,M=0;M<g;M++)C+=r[M]+2*a;C=(C+=.5*r[g]+a)*t/i,0===g?u=C:g+1===h&&(T=C),g<h?(e.setStrokeWidth(k),e.begin(),e.ellipse(C-x,c-x,15,15),e.fillAndStroke(),e.setStrokeWidth(.5*k),e.begin(),e.ellipse(C-4.5,c-4.5,9,9),e.fillAndStroke()):(e.setStrokeWidth(k),e.setFillColor(p),e.setStrokeColor(p),e.begin(),e.ellipse(C-10,c-10,20,20),e.fillAndStroke(),e.setStrokeWidth(k),e.setFillColor("#ffffff"),e.setStrokeColor("#ffffff"),e.begin(),e.ellipse(C-x,c-x,15,15),e.fillAndStroke(),e.setFillColor(s),e.setStrokeColor(s),e.setStrokeWidth(.5*k),e.begin(),e.ellipse(C-5.25,c-5.25,10.5,10.5),e.fillAndStroke())}},mxShapeMockupStepBar.prototype.buttonText=function(e,t,o,l,r,a,i,p){l.charAt(0)===mxShapeMockupStepBar.prototype.cst.SELECTED&&(l=l.substring(1)),e.begin(),e.setFontSize(a),e.text((t+.5*r)*p/i,.5*a,0,0,l,mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0)},mxCellRenderer.registerShape(mxShapeMockupStepBar.prototype.cst.SHAPE_STEP_BAR,mxShapeMockupStepBar),mxUtils.extend(mxShapeMockupCoverFlow,mxShape),mxShapeMockupCoverFlow.prototype.cst={SHAPE_COVER_FLOW:"mxgraph.mockup.navigation.coverFlow"},mxShapeMockupCoverFlow.prototype.paintVertexShape=function(e,t,o,l,r){e.translate(t,o),e.begin(),e.moveTo(.0924*l,.07*r),e.lineTo(.005*l,.01*r),e.lineTo(.005*l,.99*r),e.lineTo(.0924*l,.93*r),e.moveTo(.1774*l,.09*r),e.lineTo(.0924*l,.01*r),e.lineTo(.0924*l,.99*r),e.lineTo(.1774*l,.91*r),e.moveTo(.3373*l,.22*r),e.lineTo(.1774*l,.01*r),e.lineTo(.1774*l,.99*r),e.lineTo(.3373*l,.78*r),e.moveTo(.912*l,.07*r),e.lineTo(.998*l,.01*r),e.lineTo(.998*l,.99*r),e.lineTo(.912*l,.93*r),e.moveTo(.8271*l,.09*r),e.lineTo(.912*l,.01*r),e.lineTo(.912*l,.99*r),e.lineTo(.8271*l,.91*r),e.moveTo(.6672*l,.22*r),e.lineTo(.8271*l,.01*r),e.lineTo(.8271*l,.99*r),e.lineTo(.6672*l,.78*r),e.moveTo(.3373*l,.005*r),e.lineTo(.3373*l,.995*r),e.lineTo(.6672*l,.995*r),e.lineTo(.6672*l,.005*r),e.close(),e.fillAndStroke()},mxCellRenderer.registerShape(mxShapeMockupCoverFlow.prototype.cst.SHAPE_COVER_FLOW,mxShapeMockupCoverFlow),mxUtils.extend(mxShapeMockupScrollBar,mxShape),mxShapeMockupScrollBar.prototype.cst={SHAPE_SCROLL_BAR:"mxgraph.mockup.navigation.scrollBar",FILL_COLOR2:"fillColor2",STROKE_COLOR2:"strokeColor2",BAR_POS:"barPos"},mxShapeMockupScrollBar.prototype.customProperties=[{name:"barPos",dispName:"Handle Position",type:"float"},{name:"fillColor2",dispName:"Fill2 Color",type:"color"},{name:"strokeColor2",dispName:"Stroke2 Color",type:"color"}],mxShapeMockupScrollBar.prototype.paintVertexShape=function(e,t,o,l,r){l=Math.max(l,40),e.translate(t,o),this.background(e,l,20,20),e.setShadow(!1),this.foreground(e,l,20,20),this.barPos=20},mxShapeMockupScrollBar.prototype.background=function(e,t,o,l){e.rect(0,0,t,o),e.fillAndStroke(),e.begin(),e.moveTo(l,0),e.lineTo(l,o),e.moveTo(t-l,0),e.lineTo(t-l,o),e.stroke()},mxShapeMockupScrollBar.prototype.foreground=function(e,t,o,l){var r=mxUtils.getValue(this.style,mxShapeMockupScrollBar.prototype.cst.BAR_POS,"20"),a=mxUtils.getValue(this.style,mxShapeMockupScrollBar.prototype.cst.FILL_COLOR2,"#99ddff"),i=mxUtils.getValue(this.style,mxShapeMockupScrollBar.prototype.cst.STROKE_COLOR2,"none");r=Math.max(0,r),r=Math.min(100,r),e.setStrokeColor(i),e.setFillColor(a),e.begin(),e.moveTo(.2*l,.5*o),e.lineTo(.8*l,.2*o),e.lineTo(.8*l,.8*o),e.close(),e.moveTo(t-.2*l,.5*o),e.lineTo(t-.8*l,.2*o),e.lineTo(t-.8*l,.8*o),e.close(),e.fillAndStroke();var p=60,n=l,s=t-l,S=n+(s-(p=Math.min(p,s-n))/2-(n+p/2))*r/100;e.roundrect(S,.15*o,p,.7*o,5,5),e.fillAndStroke()},mxCellRenderer.registerShape(mxShapeMockupScrollBar.prototype.cst.SHAPE_SCROLL_BAR,mxShapeMockupScrollBar),Graph.handleFactory[mxShapeMockupScrollBar.prototype.cst.SHAPE_SCROLL_BAR]=function(e){return[Graph.createHandle(e,["barPos"],(function(e){var t=Math.max(0,Math.min(100,parseFloat(mxUtils.getValue(this.state.style,"barPos",this.barPos))));return new mxPoint(e.x+(e.width-100)*t/e.width/100*e.width+50,e.y+10)}),(function(e,t){this.state.style.barPos=Math.round(1e3*Math.max(0,Math.min(100,100*(t.x-e.x-50)/(e.width-100))))/1e3}))]},mxUtils.extend(mxShapeMockupPagination,mxShape),mxShapeMockupPagination.prototype.cst={MAIN_TEXT:"linkText",TEXT_SIZE:"textSize",TEXT_COLOR:"textColor",SHAPE_PAGINATION:"mxgraph.mockup.navigation.pagination"},mxShapeMockupPagination.prototype.paintVertexShape=function(e,t,o,l,r){var a=mxUtils.getValue(this.style,mxShapeMockupPagination.prototype.cst.MAIN_TEXT,"0-9 A B C D E F G H I J K L M N O P Q R S T U V X Y Z"),i=mxUtils.getValue(this.style,mxShapeMockupPagination.prototype.cst.TEXT_SIZE,"17"),p=mxUtils.getValue(this.style,mxShapeMockupPagination.prototype.cst.TEXT_COLOR,"#0000ff");e.translate(t,o);var n=mxUtils.getSizeForString(a,i,mxConstants.DEFAULT_FONTFAMILY).width;e.setStrokeColor(p),e.setFontSize(i),e.setFontColor(p),e.text(.5*l,.5*r,0,0,a,mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0),e.begin(),e.moveTo(.5*l-.5*n,.5*(r+parseInt(i,10))),e.lineTo(.5*l+.5*n,.5*(r+parseInt(i,10))),e.stroke()},mxCellRenderer.registerShape(mxShapeMockupPagination.prototype.cst.SHAPE_PAGINATION,mxShapeMockupPagination),mxUtils.extend(mxShapeMockupPageControl,mxShape),mxShapeMockupPageControl.prototype.cst={SHAPE_PAGE_CONTROL:"mxgraph.mockup.navigation.pageControl"},mxShapeMockupPageControl.prototype.paintVertexShape=function(e,t,o,l,r){e.translate(t,o);var a=mxUtils.getValue(this.style,mxConstants.STYLE_FILLCOLOR,"#000000"),i=mxUtils.getValue(this.style,mxConstants.STYLE_STROKECOLOR,"#000000"),p=Math.min(.5*r,.05*l);e.setFillColor(i),e.ellipse(0,.5*r-p,2*p,2*p),e.fill(),e.setFillColor(a),e.ellipse(.35*l-p,.5*r-p,2*p,2*p),e.fill(),e.ellipse(.65*l-p,.5*r-p,2*p,2*p),e.fill(),e.ellipse(l-2*p,.5*r-p,2*p,2*p),e.fill()},mxCellRenderer.registerShape(mxShapeMockupPageControl.prototype.cst.SHAPE_PAGE_CONTROL,mxShapeMockupPageControl),mxUtils.extend(mxShapeMockupMapNavigator,mxShape),mxShapeMockupMapNavigator.prototype.cst={SHAPE_MAP_NAVIGATOR:"mxgraph.mockup.navigation.mapNavigator",FILL_COLOR2:"fillColor2",STROKE_COLOR2:"strokeColor2",STROKE_COLOR3:"strokeColor3"},mxShapeMockupMapNavigator.prototype.customProperties=[{name:"fillColor2",dispName:"Fill2 Color",type:"color"},{name:"strokeColor2",dispName:"Stroke2 Color",type:"color"},{name:"strokeColor3",dispName:"Stroke3 Color",type:"color"}],mxShapeMockupMapNavigator.prototype.paintVertexShape=function(e,t,o,l,r){e.translate(t,o),this.background(e,l,r),e.setShadow(!1),this.foreground(e,l,r)},mxShapeMockupMapNavigator.prototype.background=function(e,t,o){e.ellipse(0,0,t,.6*o),e.fillAndStroke(),e.begin(),e.moveTo(.35*t,.584*o),e.lineTo(.35*t,.95*o),e.arcTo(.083*t,.05*o,0,0,0,.43*t,o),e.lineTo(.56*t,o),e.arcTo(.083*t,.05*o,0,0,0,.65*t,.95*o),e.lineTo(.65*t,.584*o),e.fillAndStroke()},mxShapeMockupMapNavigator.prototype.foreground=function(e,t,o){var l=mxUtils.getValue(this.style,mxShapeMockupMapNavigator.prototype.cst.FILL_COLOR2,"#99ddff"),r=mxUtils.getValue(this.style,mxShapeMockupMapNavigator.prototype.cst.STROKE_COLOR2,"none"),a=mxUtils.getValue(this.style,mxShapeMockupMapNavigator.prototype.cst.STROKE_COLOR3,"#ffffff");e.setFillColor(l),e.setStrokeColor(r),e.ellipse(.4*t,.65*o,.2*t,.12*o),e.fillAndStroke(),e.ellipse(.4*t,.85*o,.2*t,.12*o),e.fillAndStroke(),e.begin(),e.moveTo(.1806*t,.34*o),e.lineTo(.1357*t,.366*o),e.lineTo(.0228*t,.3*o),e.lineTo(.1357*t,.234*o),e.lineTo(.1806*t,.26*o),e.lineTo(.1142*t,.3*o),e.close(),e.fillAndStroke(),e.begin(),e.moveTo(.433*t,.108*o),e.lineTo(.3881*t,.08*o),e.lineTo(.4994*t,.012*o),e.lineTo(.6123*t,.08*o),e.lineTo(.5658*t,.108*o),e.lineTo(.4994*t,.068*o),e.close(),e.fillAndStroke(),e.begin(),e.moveTo(.8198*t,.262*o),e.lineTo(.868*t,.233*o),e.lineTo(.9776*t,.3*o),e.lineTo(.868*t,.367*o),e.lineTo(.8198*t,.341*o),e.lineTo(.8863*t,.3*o),e.close(),e.fillAndStroke(),e.begin(),e.moveTo(.5641*t,.493*o),e.lineTo(.6123*t,.522*o),e.lineTo(.4994*t,.588*o),e.lineTo(.3881*t,.521*o),e.lineTo(.4363*t,.493*o),e.lineTo(.4994*t,.533*o),e.close(),e.fillAndStroke(),e.begin(),e.moveTo(.3333*t,.32*o),e.lineTo(.3333*t,.28*o),e.lineTo(.4163*t,.3*o),e.close(),e.moveTo(.4662*t,.2*o),e.lineTo(.5326*t,.2*o),e.lineTo(.4994*t,.25*o),e.close(),e.moveTo(.6654*t,.28*o),e.lineTo(.6654*t,.32*o),e.lineTo(.5824*t,.3*o),e.close(),e.moveTo(.5326*t,.4*o),e.lineTo(.4662*t,.4*o),e.lineTo(.4994*t,.35*o),e.close(),e.fillAndStroke(),e.setStrokeWidth(2),e.setStrokeColor(a),e.begin(),e.moveTo(.5*t,.67*o),e.lineTo(.5*t,.75*o),e.moveTo(.43*t,.71*o),e.lineTo(.57*t,.71*o),e.moveTo(.43*t,.91*o),e.lineTo(.57*t,.91*o),e.stroke()},mxCellRenderer.registerShape(mxShapeMockupMapNavigator.prototype.cst.SHAPE_MAP_NAVIGATOR,mxShapeMockupMapNavigator),mxUtils.extend(mxShapeMockupNavigationAnchor,mxShape),mxShapeMockupNavigationAnchor.prototype.cst={ANCHOR:"mxgraph.mockup.navigation.anchor"},mxShapeMockupNavigationAnchor.prototype.paintVertexShape=function(e,t,o,l,r){},mxCellRenderer.registerShape(mxShapeMockupNavigationAnchor.prototype.cst.ANCHOR,mxShapeMockupNavigationAnchor);