12.8.5 release
This commit is contained in:
parent
4ba45d424c
commit
ce4550daf6
25 changed files with 5357 additions and 2905 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
14-MAR-2020: 12.8.5
|
||||
|
||||
- Fixes drag and drop of images to containers in Firefox
|
||||
- Adds (Alt+)Shift+Tab for outdent/indent while editing
|
||||
- No longer selects moved cells after undo/redo
|
||||
- Reduces number of automatic layout runs
|
||||
- Merges PWA into online app
|
||||
- Uses mxGraph 4.1.1 beta 13
|
||||
|
||||
11-MAR-2020: 12.8.4
|
||||
|
||||
- Changes canonical URL to app.diagrams.net
|
||||
|
||||
11-MAR-2020: 12.8.3
|
||||
|
||||
- Switches to PlantUML build 1.2020.2
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
12.8.3
|
||||
12.8.5
|
|
@ -297,8 +297,8 @@ mxXmlCanvas2D.prototype.text=function(a,b,c,d,e,f,g,k,l,m,n,p,q){if(this.textEna
|
|||
m);null!=n&&r.setAttribute("clip",n?"1":"0");null!=p&&r.setAttribute("rotation",p);null!=q&&r.setAttribute("dir",q);this.root.appendChild(r)}};mxXmlCanvas2D.prototype.stroke=function(){this.root.appendChild(this.createElement("stroke"))};mxXmlCanvas2D.prototype.fill=function(){this.root.appendChild(this.createElement("fill"))};mxXmlCanvas2D.prototype.fillAndStroke=function(){this.root.appendChild(this.createElement("fillstroke"))};
|
||||
function mxSvgCanvas2D(a,b){mxAbstractCanvas2D.call(this);this.root=a;this.gradients=[];this.defs=null;this.styleEnabled=null!=b?b:!1;var c=null;if(a.ownerDocument!=document)for(c=a;null!=c&&"svg"!=c.nodeName;)c=c.parentNode;null!=c&&(0<c.getElementsByTagName("defs").length&&(this.defs=c.getElementsByTagName("defs")[0]),null==this.defs&&(this.defs=this.createElement("defs"),null!=c.firstChild?c.insertBefore(this.defs,c.firstChild):c.appendChild(this.defs)),this.styleEnabled&&this.defs.appendChild(this.createStyle()))}
|
||||
mxUtils.extend(mxSvgCanvas2D,mxAbstractCanvas2D);(function(){mxSvgCanvas2D.prototype.useDomParser=!mxClient.IS_IE&&"function"===typeof DOMParser&&"function"===typeof XMLSerializer;if(mxSvgCanvas2D.prototype.useDomParser)try{var a=(new DOMParser).parseFromString("test text","text/html");mxSvgCanvas2D.prototype.useDomParser=null!=a}catch(b){mxSvgCanvas2D.prototype.useDomParser=!1}})();mxSvgCanvas2D.prototype.node=null;mxSvgCanvas2D.prototype.matchHtmlAlignment=!0;
|
||||
mxSvgCanvas2D.prototype.textEnabled=!0;mxSvgCanvas2D.prototype.foEnabled=!0;mxSvgCanvas2D.prototype.foAltText="[Object]";mxSvgCanvas2D.prototype.foOffset=0;mxSvgCanvas2D.prototype.textOffset=0;mxSvgCanvas2D.prototype.imageOffset=0;mxSvgCanvas2D.prototype.strokeTolerance=0;mxSvgCanvas2D.prototype.minStrokeWidth=1;mxSvgCanvas2D.prototype.refCount=0;mxSvgCanvas2D.prototype.blockImagePointerEvents=!1;mxSvgCanvas2D.prototype.lineHeightCorrection=1;mxSvgCanvas2D.prototype.pointerEventsValue="all";
|
||||
mxSvgCanvas2D.prototype.fontMetricsPadding=10;mxSvgCanvas2D.prototype.cacheOffsetSize=!0;mxSvgCanvas2D.prototype.format=function(a){return parseFloat(parseFloat(a).toFixed(2))};mxSvgCanvas2D.prototype.getBaseUrl=function(){var a=window.location.href,b=a.lastIndexOf("#");0<b&&(a=a.substring(0,b));return a};mxSvgCanvas2D.prototype.reset=function(){mxAbstractCanvas2D.prototype.reset.apply(this,arguments);this.gradients=[]};
|
||||
mxSvgCanvas2D.prototype.textEnabled=!0;mxSvgCanvas2D.prototype.foEnabled=!0;mxSvgCanvas2D.prototype.foAltText="[Object]";mxSvgCanvas2D.prototype.foOffset=0;mxSvgCanvas2D.prototype.textOffset=0;mxSvgCanvas2D.prototype.imageOffset=0;mxSvgCanvas2D.prototype.strokeTolerance=0;mxSvgCanvas2D.prototype.minStrokeWidth=1;mxSvgCanvas2D.prototype.refCount=0;mxSvgCanvas2D.prototype.lineHeightCorrection=1;mxSvgCanvas2D.prototype.pointerEventsValue="all";mxSvgCanvas2D.prototype.fontMetricsPadding=10;
|
||||
mxSvgCanvas2D.prototype.cacheOffsetSize=!0;mxSvgCanvas2D.prototype.format=function(a){return parseFloat(parseFloat(a).toFixed(2))};mxSvgCanvas2D.prototype.getBaseUrl=function(){var a=window.location.href,b=a.lastIndexOf("#");0<b&&(a=a.substring(0,b));return a};mxSvgCanvas2D.prototype.reset=function(){mxAbstractCanvas2D.prototype.reset.apply(this,arguments);this.gradients=[]};
|
||||
mxSvgCanvas2D.prototype.createStyle=function(a){a=this.createElement("style");a.setAttribute("type","text/css");mxUtils.write(a,"svg{font-family:"+mxConstants.DEFAULT_FONTFAMILY+";font-size:"+mxConstants.DEFAULT_FONTSIZE+";fill:none;stroke-miterlimit:10}");return a};
|
||||
mxSvgCanvas2D.prototype.createElement=function(a,b){if(null!=this.root.ownerDocument.createElementNS)return this.root.ownerDocument.createElementNS(b||mxConstants.NS_SVG,a);var c=this.root.ownerDocument.createElement(a);null!=b&&c.setAttribute("xmlns",b);return c};mxSvgCanvas2D.prototype.getAlternateText=function(a,b,c,d,e,f,g,k,l,m,n,p,q){return null!=f?this.foAltText:null};
|
||||
mxSvgCanvas2D.prototype.createAlternateContent=function(a,b,c,d,e,f,g,k,l,m,n,p,q){a=this.getAlternateText(a,b,c,d,e,f,g,k,l,m,n,p,q);d=this.state;return null!=a&&0<d.fontSize?(k=k==mxConstants.ALIGN_TOP?1:k==mxConstants.ALIGN_BOTTOM?0:.3,e=g==mxConstants.ALIGN_RIGHT?"end":g==mxConstants.ALIGN_LEFT?"start":"middle",g=this.createElement("text"),g.setAttribute("x",Math.round(b+d.dx)),g.setAttribute("y",Math.round(c+d.dy+k*d.fontSize)),g.setAttribute("fill",d.fontColor||"black"),g.setAttribute("font-family",
|
||||
|
@ -322,8 +322,7 @@ mxSvgCanvas2D.prototype.rotate=function(a,b,c,d,e){if(0!=a||b||c){var f=this.sta
|
|||
d;f.rotationCy=e}};mxSvgCanvas2D.prototype.begin=function(){mxAbstractCanvas2D.prototype.begin.apply(this,arguments);this.node=this.createElement("path")};mxSvgCanvas2D.prototype.rect=function(a,b,c,d){var e=this.state,f=this.createElement("rect");f.setAttribute("x",this.format((a+e.dx)*e.scale));f.setAttribute("y",this.format((b+e.dy)*e.scale));f.setAttribute("width",this.format(c*e.scale));f.setAttribute("height",this.format(d*e.scale));this.node=f};
|
||||
mxSvgCanvas2D.prototype.roundrect=function(a,b,c,d,e,f){this.rect(a,b,c,d);0<e&&this.node.setAttribute("rx",this.format(e*this.state.scale));0<f&&this.node.setAttribute("ry",this.format(f*this.state.scale))};mxSvgCanvas2D.prototype.ellipse=function(a,b,c,d){var e=this.state,f=this.createElement("ellipse");f.setAttribute("cx",this.format((a+c/2+e.dx)*e.scale));f.setAttribute("cy",this.format((b+d/2+e.dy)*e.scale));f.setAttribute("rx",c/2*e.scale);f.setAttribute("ry",d/2*e.scale);this.node=f};
|
||||
mxSvgCanvas2D.prototype.image=function(a,b,c,d,e,f,g,k){e=this.converter.convert(e);f=null!=f?f:!0;g=null!=g?g:!1;k=null!=k?k:!1;var l=this.state;a+=l.dx;b+=l.dy;var m=this.createElement("image");m.setAttribute("x",this.format(a*l.scale)+this.imageOffset);m.setAttribute("y",this.format(b*l.scale)+this.imageOffset);m.setAttribute("width",this.format(c*l.scale));m.setAttribute("height",this.format(d*l.scale));null==m.setAttributeNS?m.setAttribute("xlink:href",e):m.setAttributeNS(mxConstants.NS_XLINK,
|
||||
"xlink:href",e);f||m.setAttribute("preserveAspectRatio","none");(1>l.alpha||1>l.fillAlpha)&&m.setAttribute("opacity",l.alpha*l.fillAlpha);e=this.state.transform||"";if(g||k){var n=f=1,p=0,q=0;g&&(f=-1,p=-c-2*a);k&&(n=-1,q=-d-2*b);e+="scale("+f+","+n+")translate("+p*l.scale+","+q*l.scale+")"}0<e.length&&m.setAttribute("transform",e);this.pointerEvents||m.setAttribute("pointer-events","none");this.root.appendChild(m);this.blockImagePointerEvents&&(m.setAttribute("style","pointer-events:none"),m=this.createElement("rect"),
|
||||
m.setAttribute("visibility","hidden"),m.setAttribute("pointer-events","fill"),m.setAttribute("x",this.format(a*l.scale)),m.setAttribute("y",this.format(b*l.scale)),m.setAttribute("width",this.format(c*l.scale)),m.setAttribute("height",this.format(d*l.scale)),this.root.appendChild(m))};
|
||||
"xlink:href",e);f||m.setAttribute("preserveAspectRatio","none");(1>l.alpha||1>l.fillAlpha)&&m.setAttribute("opacity",l.alpha*l.fillAlpha);e=this.state.transform||"";if(g||k){var n=f=1,p=0,q=0;g&&(f=-1,p=-c-2*a);k&&(n=-1,q=-d-2*b);e+="scale("+f+","+n+")translate("+p*l.scale+","+q*l.scale+")"}0<e.length&&m.setAttribute("transform",e);this.pointerEvents||m.setAttribute("pointer-events","none");this.root.appendChild(m)};
|
||||
mxSvgCanvas2D.prototype.convertHtml=function(a){if(this.useDomParser){var b=(new DOMParser).parseFromString(a,"text/html");null!=b&&(a=(new XMLSerializer).serializeToString(b.body),"<body"==a.substring(0,5)&&(a=a.substring(a.indexOf(">",5)+1)),"</body>"==a.substring(a.length-7,a.length)&&(a=a.substring(0,a.length-7)))}else{if(null!=document.implementation&&null!=document.implementation.createDocument){var b=document.implementation.createDocument("http://www.w3.org/1999/xhtml","html",null),c=b.createElement("body");
|
||||
b.documentElement.appendChild(c);var d=document.createElement("div");d.innerHTML=a;for(a=d.firstChild;null!=a;)d=a.nextSibling,c.appendChild(b.adoptNode(a)),a=d;return c.innerHTML}b=document.createElement("textarea");b.innerHTML=a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/</g,"<").replace(/>/g,">");a=b.value.replace(/&/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,
|
||||
"&").replace(/<br>/g,"<br />").replace(/<hr>/g,"<hr />").replace(/(<img[^>]+)>/gm,"$1 />")}return a};
|
||||
|
@ -402,7 +401,7 @@ mxShape.prototype.getLabelBounds=function(a){var b=mxUtils.getValue(this.style,m
|
|||
mxShape.prototype.checkBounds=function(){return!isNaN(this.scale)&&isFinite(this.scale)&&0<this.scale&&null!=this.bounds&&!isNaN(this.bounds.x)&&!isNaN(this.bounds.y)&&!isNaN(this.bounds.width)&&!isNaN(this.bounds.height)&&0<this.bounds.width&&0<this.bounds.height};mxShape.prototype.createVmlGroup=function(){var a=document.createElement(mxClient.VML_PREFIX+":group");a.style.position="absolute";a.style.width=this.node.style.width;a.style.height=this.node.style.height;return a};
|
||||
mxShape.prototype.redrawShape=function(){var a=this.createCanvas();null!=a&&(a.pointerEvents=this.pointerEvents,this.paint(a),this.node!=a.root&&this.node.insertAdjacentHTML("beforeend",a.root.outerHTML),"DIV"==this.node.nodeName&&8==document.documentMode&&(this.node.style.filter="",mxUtils.addTransparentBackgroundFilter(this.node)),this.destroyCanvas(a))};
|
||||
mxShape.prototype.createCanvas=function(){var a=null;null!=this.node.ownerSVGElement?a=this.createSvgCanvas():mxClient.IS_VML&&(this.updateVmlContainer(),a=this.createVmlCanvas());null!=a&&this.outline&&(a.setStrokeWidth(this.strokewidth),a.setStrokeColor(this.stroke),null!=this.isDashed&&a.setDashed(this.isDashed),a.setStrokeWidth=function(){},a.setStrokeColor=function(){},a.setFillColor=function(){},a.setGradient=function(){},a.setDashed=function(){},a.text=function(){});return a};
|
||||
mxShape.prototype.createSvgCanvas=function(){var a=new mxSvgCanvas2D(this.node,!1);a.strokeTolerance=this.pointerEvents?this.svgStrokeTolerance:0;a.pointerEventsValue=this.svgPointerEvents;a.blockImagePointerEvents=mxClient.IS_FF;var b=this.getSvgScreenOffset();0!=b?this.node.setAttribute("transform","translate("+b+","+b+")"):this.node.removeAttribute("transform");a.minStrokeWidth=this.minSvgStrokeWidth;this.antiAlias||(a.format=function(a){return Math.round(parseFloat(a))});return a};
|
||||
mxShape.prototype.createSvgCanvas=function(){var a=new mxSvgCanvas2D(this.node,!1);a.strokeTolerance=this.pointerEvents?this.svgStrokeTolerance:0;a.pointerEventsValue=this.svgPointerEvents;var b=this.getSvgScreenOffset();0!=b?this.node.setAttribute("transform","translate("+b+","+b+")"):this.node.removeAttribute("transform");a.minStrokeWidth=this.minSvgStrokeWidth;this.antiAlias||(a.format=function(a){return Math.round(parseFloat(a))});return a};
|
||||
mxShape.prototype.createVmlCanvas=function(){var a=8==document.documentMode&&this.isParseVml()?this.createVmlGroup():this.node,b=new mxVmlCanvas2D(a,!1);""!=a.tagUrn&&(a.coordsize=Math.max(1,Math.round(this.bounds.width))*this.vmlScale+","+Math.max(1,Math.round(this.bounds.height))*this.vmlScale,b.scale(this.vmlScale),b.vmlScale=this.vmlScale);a=this.scale;b.translate(-Math.round(this.bounds.x/a),-Math.round(this.bounds.y/a));return b};
|
||||
mxShape.prototype.updateVmlContainer=function(){this.node.style.left=Math.round(this.bounds.x)+"px";this.node.style.top=Math.round(this.bounds.y)+"px";var a=Math.max(1,Math.round(this.bounds.height));this.node.style.width=Math.max(1,Math.round(this.bounds.width))+"px";this.node.style.height=a+"px";this.node.style.overflow="visible"};mxShape.prototype.redrawHtmlShape=function(){this.updateHtmlBounds(this.node);this.updateHtmlFilters(this.node);this.updateHtmlColors(this.node)};
|
||||
mxShape.prototype.updateHtmlFilters=function(a){var b="";100>this.opacity&&(b+="alpha(opacity="+this.opacity+")");this.isShadow&&(b+="progid:DXImageTransform.Microsoft.dropShadow (OffX='"+Math.round(mxConstants.SHADOW_OFFSET_X*this.scale)+"', OffY='"+Math.round(mxConstants.SHADOW_OFFSET_Y*this.scale)+"', Color='"+mxConstants.VML_SHADOWCOLOR+"')");if(null!=this.fill&&this.fill!=mxConstants.NONE&&this.gradient&&this.gradient!=mxConstants.NONE){var c=this.fill,d=this.gradient,e="0",f={east:0,south:1,
|
||||
|
@ -559,8 +558,8 @@ mxSwimlane.prototype.paintSwimlane=function(a,b,c,d,e,f,g,k){a.begin();this.isHo
|
|||
mxSwimlane.prototype.paintRoundedSwimlane=function(a,b,c,d,e,f,g,k,l){a.begin();this.isHorizontal()?(a.moveTo(d,f),a.lineTo(d,g),a.quadTo(d,0,d-Math.min(d/2,g),0),a.lineTo(Math.min(d/2,g),0),a.quadTo(0,0,0,g),a.lineTo(0,f),a.fillAndStroke(),f<e&&(k==mxConstants.NONE?a.pointerEvents=!1:a.setFillColor(k),a.begin(),a.moveTo(0,f),a.lineTo(0,e-g),a.quadTo(0,e,Math.min(d/2,g),e),a.lineTo(d-Math.min(d/2,g),e),a.quadTo(d,e,d,e-g),a.lineTo(d,f),k==mxConstants.NONE?a.stroke():a.fillAndStroke())):(a.moveTo(f,
|
||||
0),a.lineTo(g,0),a.quadTo(0,0,0,Math.min(e/2,g)),a.lineTo(0,e-Math.min(e/2,g)),a.quadTo(0,e,g,e),a.lineTo(f,e),a.fillAndStroke(),f<d&&(k==mxConstants.NONE?a.pointerEvents=!1:a.setFillColor(k),a.begin(),a.moveTo(f,e),a.lineTo(d-g,e),a.quadTo(d,e,d,e-Math.min(e/2,g)),a.lineTo(d,Math.min(e/2,g)),a.quadTo(d,0,d-g,0),a.lineTo(f,0),k==mxConstants.NONE?a.stroke():a.fillAndStroke()));l&&this.paintDivider(a,b,c,d,e,f,k==mxConstants.NONE)};
|
||||
mxSwimlane.prototype.paintDivider=function(a,b,c,d,e,f,g){g||a.setShadow(!1);a.begin();this.isHorizontal()?(a.moveTo(0,f),a.lineTo(d,f)):(a.moveTo(f,0),a.lineTo(f,e));a.stroke()};mxSwimlane.prototype.paintSeparator=function(a,b,c,d,e,f,g){g!=mxConstants.NONE&&(a.setStrokeColor(g),a.setDashed(!0),a.begin(),this.isHorizontal()?(a.moveTo(d,f),a.lineTo(d,e)):(a.moveTo(f,0),a.lineTo(d,0)),a.stroke(),a.setDashed(!1))};
|
||||
mxSwimlane.prototype.getImageBounds=function(a,b,c,d){return this.isHorizontal()?new mxRectangle(a+c-this.imageSize,b,this.imageSize,this.imageSize):new mxRectangle(a,b,this.imageSize,this.imageSize)};function mxGraphLayout(a){this.graph=a}mxGraphLayout.prototype.graph=null;mxGraphLayout.prototype.useBoundingBox=!0;mxGraphLayout.prototype.parent=null;mxGraphLayout.prototype.moveCell=function(a,b,c){};mxGraphLayout.prototype.execute=function(a){};mxGraphLayout.prototype.getGraph=function(){return this.graph};
|
||||
mxGraphLayout.prototype.getConstraint=function(a,b,c,d){c=this.graph.view.getState(b);b=null!=c?c.style:this.graph.getCellStyle(b);return null!=b?b[a]:null};
|
||||
mxSwimlane.prototype.getImageBounds=function(a,b,c,d){return this.isHorizontal()?new mxRectangle(a+c-this.imageSize,b,this.imageSize,this.imageSize):new mxRectangle(a,b,this.imageSize,this.imageSize)};function mxGraphLayout(a){this.graph=a}mxGraphLayout.prototype.graph=null;mxGraphLayout.prototype.useBoundingBox=!0;mxGraphLayout.prototype.parent=null;mxGraphLayout.prototype.moveCell=function(a,b,c){};mxGraphLayout.prototype.resizeCell=function(a,b){};mxGraphLayout.prototype.execute=function(a){};
|
||||
mxGraphLayout.prototype.getGraph=function(){return this.graph};mxGraphLayout.prototype.getConstraint=function(a,b,c,d){c=this.graph.view.getState(b);b=null!=c?c.style:this.graph.getCellStyle(b);return null!=b?b[a]:null};
|
||||
mxGraphLayout.traverse=function(a,b,c,d,e){if(null!=c&&null!=a&&(b=null!=b?b:!0,e=e||new mxDictionary,!e.get(a)&&(e.put(a,!0),d=c(a,d),null==d||d))&&(d=this.graph.model.getEdgeCount(a),0<d))for(var f=0;f<d;f++){var g=this.graph.model.getEdgeAt(a,f),k=this.graph.model.getTerminal(g,!0)==a;if(!b||k)k=this.graph.view.getVisibleTerminal(g,!k),this.traverse(k,b,c,g,e)}};
|
||||
mxGraphLayout.prototype.isAncestor=function(a,b,c){if(!c)return this.graph.model.getParent(b)==a;if(b==a)return!1;for(;null!=b&&b!=a;)b=this.graph.model.getParent(b);return b==a};mxGraphLayout.prototype.isVertexMovable=function(a){return this.graph.isCellMovable(a)};mxGraphLayout.prototype.isVertexIgnored=function(a){return!this.graph.getModel().isVertex(a)||!this.graph.isCellVisible(a)};
|
||||
mxGraphLayout.prototype.isEdgeIgnored=function(a){var b=this.graph.getModel();return!b.isEdge(a)||!this.graph.isCellVisible(a)||null==b.getTerminal(a,!0)||null==b.getTerminal(a,!1)};mxGraphLayout.prototype.setEdgeStyleEnabled=function(a,b){this.graph.setCellStyles(mxConstants.STYLE_NOEDGESTYLE,b?"0":"1",[a])};mxGraphLayout.prototype.setOrthogonalEdge=function(a,b){this.graph.setCellStyles(mxConstants.STYLE_ORTHOGONAL,b?"1":"0",[a])};
|
||||
|
@ -1096,8 +1095,8 @@ mxGraph.prototype.createHandlers=function(){this.tooltipHandler=this.createToolt
|
|||
mxGraph.prototype.createTooltipHandler=function(){return new mxTooltipHandler(this)};mxGraph.prototype.createSelectionCellsHandler=function(){return new mxSelectionCellsHandler(this)};mxGraph.prototype.createConnectionHandler=function(){return new mxConnectionHandler(this)};mxGraph.prototype.createGraphHandler=function(){return new mxGraphHandler(this)};mxGraph.prototype.createPanningHandler=function(){return new mxPanningHandler(this)};mxGraph.prototype.createPopupMenuHandler=function(){return new mxPopupMenuHandler(this)};
|
||||
mxGraph.prototype.createSelectionModel=function(){return new mxGraphSelectionModel(this)};mxGraph.prototype.createStylesheet=function(){return new mxStylesheet};mxGraph.prototype.createGraphView=function(){return new mxGraphView(this)};mxGraph.prototype.createCellRenderer=function(){return new mxCellRenderer};mxGraph.prototype.createCellEditor=function(){return new mxCellEditor(this)};mxGraph.prototype.getModel=function(){return this.model};mxGraph.prototype.getView=function(){return this.view};
|
||||
mxGraph.prototype.getStylesheet=function(){return this.stylesheet};mxGraph.prototype.setStylesheet=function(a){this.stylesheet=a};mxGraph.prototype.getSelectionModel=function(){return this.selectionModel};mxGraph.prototype.setSelectionModel=function(a){this.selectionModel=a};
|
||||
mxGraph.prototype.getSelectionCellsForChanges=function(a){for(var b=new mxDictionary,c=[],d=mxUtils.bind(this,function(a){if(!b.get(a)&&this.model.contains(a))if(this.model.isEdge(a)||this.model.isVertex(a))b.put(a,!0),c.push(a);else for(var e=this.model.getChildCount(a),f=0;f<e;f++)d(this.model.getChildAt(a,f))}),e=0;e<a.length;e++){var f=a[e];if(f.constructor!=mxRootChange){var g=null;f instanceof mxChildChange?g=f.child:null!=f.cell&&f.cell instanceof mxCell&&(g=f.cell);null!=g&&d(g)}}return c};
|
||||
mxGraph.prototype.graphModelChanged=function(a){for(var b=0;b<a.length;b++)this.processChange(a[b]);this.updateSelection();this.view.validate();this.sizeDidChange()};
|
||||
mxGraph.prototype.getSelectionCellsForChanges=function(a,b){for(var c=new mxDictionary,d=[],e=mxUtils.bind(this,function(a){if(!c.get(a)&&this.model.contains(a))if(this.model.isEdge(a)||this.model.isVertex(a))c.put(a,!0),d.push(a);else for(var b=this.model.getChildCount(a),f=0;f<b;f++)e(this.model.getChildAt(a,f))}),f=0;f<a.length;f++){var g=a[f];if(g.constructor!=mxRootChange&&(null==b||!b(g))){var k=null;g instanceof mxChildChange?k=g.child:!structureOnly&&null!=g.cell&&g.cell instanceof mxCell&&
|
||||
(k=g.cell);null!=k&&e(k)}}return d};mxGraph.prototype.graphModelChanged=function(a){for(var b=0;b<a.length;b++)this.processChange(a[b]);this.updateSelection();this.view.validate();this.sizeDidChange()};
|
||||
mxGraph.prototype.updateSelection=function(){for(var a=this.getSelectionCells(),b=[],c=0;c<a.length;c++)if(this.model.contains(a[c])&&this.isCellVisible(a[c]))for(var d=this.model.getParent(a[c]);null!=d&&d!=this.view.currentRoot;){if(this.isCellCollapsed(d)||!this.isCellVisible(d)){b.push(a[c]);break}d=this.model.getParent(d)}else b.push(a[c]);this.removeSelectionCells(b)};
|
||||
mxGraph.prototype.processChange=function(a){if(a instanceof mxRootChange)this.clearSelection(),this.setDefaultParent(null),this.removeStateForCell(a.previous),this.resetViewOnRootChange&&(this.view.scale=1,this.view.translate.x=0,this.view.translate.y=0),this.fireEvent(new mxEventObject(mxEvent.ROOT));else if(a instanceof mxChildChange){var b=this.model.getParent(a.child);this.view.invalidate(a.child,!0,!0);if(!this.model.contains(b)||this.isCellCollapsed(b))this.view.invalidate(a.child,!0,!0),this.removeStateForCell(a.child),
|
||||
this.view.currentRoot==a.child&&this.home();b!=a.previous&&(null!=b&&this.view.invalidate(b,!1,!1),null!=a.previous&&this.view.invalidate(a.previous,!1,!1))}else a instanceof mxTerminalChange||a instanceof mxGeometryChange?(a instanceof mxTerminalChange||null==a.previous&&null!=a.geometry||null!=a.previous&&!a.previous.equals(a.geometry))&&this.view.invalidate(a.cell):a instanceof mxValueChange?this.view.invalidate(a.cell,!1,!1):a instanceof mxStyleChange?(this.view.invalidate(a.cell,!0,!0),a=this.view.getState(a.cell),
|
||||
|
@ -1174,9 +1173,9 @@ if(null!=n){var p=this.view.translate,q=this.view.scale,r=(n.y+n.height)/q-d.y-p
|
|||
mxGraph.prototype.getPreferredSizeForCell=function(a){var b=null;if(null!=a){var c=this.view.createState(a),d=c.style;if(!this.model.isEdge(a)){var e=d[mxConstants.STYLE_FONTSIZE]||mxConstants.DEFAULT_FONTSIZE;a=b=0;null==this.getImage(c)&&null==d[mxConstants.STYLE_IMAGE]||d[mxConstants.STYLE_SHAPE]!=mxConstants.SHAPE_LABEL||(d[mxConstants.STYLE_VERTICAL_ALIGN]==mxConstants.ALIGN_MIDDLE&&(b+=parseFloat(d[mxConstants.STYLE_IMAGE_WIDTH])||mxLabel.prototype.imageSize),d[mxConstants.STYLE_ALIGN]!=mxConstants.ALIGN_CENTER&&
|
||||
(a+=parseFloat(d[mxConstants.STYLE_IMAGE_HEIGHT])||mxLabel.prototype.imageSize));b+=2*(d[mxConstants.STYLE_SPACING]||0);b+=d[mxConstants.STYLE_SPACING_LEFT]||0;b+=d[mxConstants.STYLE_SPACING_RIGHT]||0;a+=2*(d[mxConstants.STYLE_SPACING]||0);a+=d[mxConstants.STYLE_SPACING_TOP]||0;a+=d[mxConstants.STYLE_SPACING_BOTTOM]||0;var f=this.getFoldingImage(c);null!=f&&(b+=f.width+8);f=this.cellRenderer.getLabelValue(c);null!=f&&0<f.length?(this.isHtmlLabel(c.cell)||(f=mxUtils.htmlEntities(f,!1)),f=f.replace(/\n/g,
|
||||
"<br>"),e=mxUtils.getSizeForString(f,e,d[mxConstants.STYLE_FONTFAMILY],null,d[mxConstants.STYLE_FONTSTYLE]),c=e.width+b,a=e.height+a,mxUtils.getValue(d,mxConstants.STYLE_HORIZONTAL,!0)||(d=a,a=c,c=d),this.gridEnabled&&(c=this.snap(c+this.gridSize/2),a=this.snap(a+this.gridSize/2)),b=new mxRectangle(0,0,c,a)):(d=4*this.gridSize,b=new mxRectangle(0,0,d,d))}}return b};mxGraph.prototype.resizeCell=function(a,b,c){return this.resizeCells([a],[b],c)[0]};
|
||||
mxGraph.prototype.resizeCells=function(a,b,c){c=null!=c?c:this.isRecursiveResize();this.model.beginUpdate();try{this.cellsResized(a,b,c),this.fireEvent(new mxEventObject(mxEvent.RESIZE_CELLS,"cells",a,"bounds",b))}finally{this.model.endUpdate()}return a};
|
||||
mxGraph.prototype.cellsResized=function(a,b,c){c=null!=c?c:!1;if(null!=a&&null!=b&&a.length==b.length){this.model.beginUpdate();try{for(var d=0;d<a.length;d++)this.cellResized(a[d],b[d],!1,c),this.isExtendParent(a[d])&&this.extendParent(a[d]),this.constrainChild(a[d]);this.resetEdgesOnResize&&this.resetEdges(a);this.fireEvent(new mxEventObject(mxEvent.CELLS_RESIZED,"cells",a,"bounds",b))}finally{this.model.endUpdate()}}};
|
||||
mxGraph.prototype.cellResized=function(a,b,c,d){var e=this.model.getGeometry(a);if(null!=e&&(e.x!=b.x||e.y!=b.y||e.width!=b.width||e.height!=b.height)){e=e.clone();!c&&e.relative?(c=e.offset,null!=c&&(c.x+=b.x-e.x,c.y+=b.y-e.y)):(e.x=b.x,e.y=b.y);e.width=b.width;e.height=b.height;e.relative||!this.model.isVertex(a)||this.isAllowNegativeCoordinates()||(e.x=Math.max(0,e.x),e.y=Math.max(0,e.y));this.model.beginUpdate();try{d&&this.resizeChildCells(a,e),this.model.setGeometry(a,e),this.constrainChildCells(a)}finally{this.model.endUpdate()}}};
|
||||
mxGraph.prototype.resizeCells=function(a,b,c){c=null!=c?c:this.isRecursiveResize();this.model.beginUpdate();try{var d=this.cellsResized(a,b,c);this.fireEvent(new mxEventObject(mxEvent.RESIZE_CELLS,"cells",a,"bounds",b,"previous",d))}finally{this.model.endUpdate()}return a};
|
||||
mxGraph.prototype.cellsResized=function(a,b,c){c=null!=c?c:!1;var d=[];if(null!=a&&null!=b&&a.length==b.length){this.model.beginUpdate();try{for(var e=0;e<a.length;e++)d.push(this.cellResized(a[e],b[e],!1,c)),this.isExtendParent(a[e])&&this.extendParent(a[e]),this.constrainChild(a[e]);this.resetEdgesOnResize&&this.resetEdges(a);this.fireEvent(new mxEventObject(mxEvent.CELLS_RESIZED,"cells",a,"bounds",b,"previous",d))}finally{this.model.endUpdate()}}return d};
|
||||
mxGraph.prototype.cellResized=function(a,b,c,d){var e=this.model.getGeometry(a);if(null!=e&&(e.x!=b.x||e.y!=b.y||e.width!=b.width||e.height!=b.height)){var f=e.clone();!c&&f.relative?(c=f.offset,null!=c&&(c.x+=b.x-f.x,c.y+=b.y-f.y)):(f.x=b.x,f.y=b.y);f.width=b.width;f.height=b.height;f.relative||!this.model.isVertex(a)||this.isAllowNegativeCoordinates()||(f.x=Math.max(0,f.x),f.y=Math.max(0,f.y));this.model.beginUpdate();try{d&&this.resizeChildCells(a,f),this.model.setGeometry(a,f),this.constrainChildCells(a)}finally{this.model.endUpdate()}}return e};
|
||||
mxGraph.prototype.resizeChildCells=function(a,b){for(var c=this.model.getGeometry(a),d=b.width/c.width,c=b.height/c.height,e=this.model.getChildCount(a),f=0;f<e;f++)this.scaleCell(this.model.getChildAt(a,f),d,c,!0)};mxGraph.prototype.constrainChildCells=function(a){for(var b=this.model.getChildCount(a),c=0;c<b;c++)this.constrainChild(this.model.getChildAt(a,c))};
|
||||
mxGraph.prototype.scaleCell=function(a,b,c,d){var e=this.model.getGeometry(a);if(null!=e){var f=this.view.getState(a),f=null!=f?f.style:this.getCellStyle(a),e=e.clone(),g=e.x,k=e.y,l=e.width,m=e.height;e.scale(b,c,"fixed"==f[mxConstants.STYLE_ASPECT]);"1"==f[mxConstants.STYLE_RESIZE_WIDTH]?e.width=l*b:"0"==f[mxConstants.STYLE_RESIZE_WIDTH]&&(e.width=l);"1"==f[mxConstants.STYLE_RESIZE_HEIGHT]?e.height=m*c:"0"==f[mxConstants.STYLE_RESIZE_HEIGHT]&&(e.height=m);this.isCellMovable(a)||(e.x=g,e.y=k);this.isCellResizable(a)||
|
||||
(e.width=l,e.height=m);this.model.isVertex(a)?this.cellResized(a,e,!0,d):this.model.setGeometry(a,e)}};mxGraph.prototype.extendParent=function(a){if(null!=a){var b=this.model.getParent(a),c=this.getCellGeometry(b);null==b||null==c||this.isCellCollapsed(b)||(a=this.getCellGeometry(a),null!=a&&!a.relative&&(c.width<a.x+a.width||c.height<a.y+a.height)&&(c=c.clone(),c.width=Math.max(c.width,a.x+a.width),c.height=Math.max(c.height,a.y+a.height),this.cellsResized([b],[c],!1)))}};
|
||||
|
@ -1248,7 +1247,7 @@ mxGraph.prototype.convertValueToString=function(a){a=this.model.getValue(a);if(n
|
|||
mxGraph.prototype.isHtmlLabels=function(){return this.htmlLabels};mxGraph.prototype.setHtmlLabels=function(a){this.htmlLabels=a};mxGraph.prototype.isWrapping=function(a){var b=this.view.getState(a);a=null!=b?b.style:this.getCellStyle(a);return null!=a?"wrap"==a[mxConstants.STYLE_WHITE_SPACE]:!1};mxGraph.prototype.isLabelClipped=function(a){var b=this.view.getState(a);a=null!=b?b.style:this.getCellStyle(a);return null!=a?"hidden"==a[mxConstants.STYLE_OVERFLOW]:!1};
|
||||
mxGraph.prototype.getTooltip=function(a,b,c,d){var e=null;null!=a&&(null==a.control||b!=a.control.node&&b.parentNode!=a.control.node||(e=this.collapseExpandResource,e=mxUtils.htmlEntities(mxResources.get(e)||e).replace(/\\n/g,"<br>")),null==e&&null!=a.overlays&&a.overlays.visit(function(a,c){null!=e||b!=c.node&&b.parentNode!=c.node||(e=c.overlay.toString())}),null==e&&(c=this.selectionCellsHandler.getHandler(a.cell),null!=c&&"function"==typeof c.getTooltipForNode&&(e=c.getTooltipForNode(b))),null==
|
||||
e&&(e=this.getTooltipForCell(a.cell)));return e};mxGraph.prototype.getTooltipForCell=function(a){return null!=a&&null!=a.getTooltip?a.getTooltip():this.convertValueToString(a)};mxGraph.prototype.getLinkForCell=function(a){return null};mxGraph.prototype.getCursorForMouseEvent=function(a){return this.getCursorForCell(a.getCell())};mxGraph.prototype.getCursorForCell=function(a){return null};
|
||||
mxGraph.prototype.getStartSize=function(a){var b=new mxRectangle,c=this.view.getState(a);a=null!=c?c.style:this.getCellStyle(a);null!=a&&(c=parseInt(mxUtils.getValue(a,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE)),mxUtils.getValue(a,mxConstants.STYLE_HORIZONTAL,!0)?b.height=c:b.width=c);return b};mxGraph.prototype.getImage=function(a){return null!=a&&null!=a.style?a.style[mxConstants.STYLE_IMAGE]:null};
|
||||
mxGraph.prototype.getStartSize=function(a,b){var c=new mxRectangle,d=b?null:this.view.getState(a),d=null!=d?d.style:this.getCellStyle(a);if(null!=d){var e=parseInt(mxUtils.getValue(d,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE));mxUtils.getValue(d,mxConstants.STYLE_HORIZONTAL,!0)?c.height=e:c.width=e}return c};mxGraph.prototype.getImage=function(a){return null!=a&&null!=a.style?a.style[mxConstants.STYLE_IMAGE]:null};
|
||||
mxGraph.prototype.isTransparentState=function(a){var b=!1;if(null!=a)var b=mxUtils.getValue(a.style,mxConstants.STYLE_STROKECOLOR,mxConstants.NONE),c=mxUtils.getValue(a.style,mxConstants.STYLE_FILLCOLOR,mxConstants.NONE),b=b==mxConstants.NONE&&c==mxConstants.NONE&&null==this.getImage(a);return b};mxGraph.prototype.getVerticalAlign=function(a){return null!=a&&null!=a.style?a.style[mxConstants.STYLE_VERTICAL_ALIGN]||mxConstants.ALIGN_MIDDLE:null};
|
||||
mxGraph.prototype.getIndicatorColor=function(a){return null!=a&&null!=a.style?a.style[mxConstants.STYLE_INDICATOR_COLOR]:null};mxGraph.prototype.getIndicatorGradientColor=function(a){return null!=a&&null!=a.style?a.style[mxConstants.STYLE_INDICATOR_GRADIENTCOLOR]:null};mxGraph.prototype.getIndicatorShape=function(a){return null!=a&&null!=a.style?a.style[mxConstants.STYLE_INDICATOR_SHAPE]:null};
|
||||
mxGraph.prototype.getIndicatorImage=function(a){return null!=a&&null!=a.style?a.style[mxConstants.STYLE_INDICATOR_IMAGE]:null};mxGraph.prototype.getBorder=function(){return this.border};mxGraph.prototype.setBorder=function(a){this.border=a};mxGraph.prototype.isSwimlane=function(a){if(null!=a&&this.model.getParent(a)!=this.model.getRoot()){var b=this.view.getState(a),b=null!=b?b.style:this.getCellStyle(a);if(null!=b&&!this.model.isEdge(a))return b[mxConstants.STYLE_SHAPE]==mxConstants.SHAPE_SWIMLANE}return!1};
|
||||
|
@ -1348,14 +1347,17 @@ this.selectionBorder=null);null!=this.sizer&&(this.sizer.destroy(),this.sizer=nu
|
|||
mxMultiplicity.prototype.min=null;mxMultiplicity.prototype.max=null;mxMultiplicity.prototype.validNeighbors=null;mxMultiplicity.prototype.validNeighborsAllowed=!0;mxMultiplicity.prototype.countError=null;mxMultiplicity.prototype.typeError=null;
|
||||
mxMultiplicity.prototype.check=function(a,b,c,d,e,f){var g="";if(this.source&&this.checkTerminal(a,c,b)||!this.source&&this.checkTerminal(a,d,b))null!=this.countError&&(this.source&&(0==this.max||e>=this.max)||!this.source&&(0==this.max||f>=this.max))&&(g+=this.countError+"\n"),null!=this.validNeighbors&&null!=this.typeError&&0<this.validNeighbors.length&&(this.checkNeighbors(a,b,c,d)||(g+=this.typeError+"\n"));return 0<g.length?g:null};
|
||||
mxMultiplicity.prototype.checkNeighbors=function(a,b,c,d){b=a.model.getValue(c);d=a.model.getValue(d);c=!this.validNeighborsAllowed;for(var e=this.validNeighbors,f=0;f<e.length;f++)if(this.source&&this.checkType(a,d,e[f])){c=this.validNeighborsAllowed;break}else if(!this.source&&this.checkType(a,b,e[f])){c=this.validNeighborsAllowed;break}return c};mxMultiplicity.prototype.checkTerminal=function(a,b,c){b=a.model.getValue(b);return this.checkType(a,b,this.type,this.attr,this.value)};
|
||||
mxMultiplicity.prototype.checkType=function(a,b,c,d,e){return null!=b?isNaN(b.nodeType)?b==c:mxUtils.isNode(b,c,d,e):!1};function mxLayoutManager(a){this.undoHandler=mxUtils.bind(this,function(a,c){this.isEnabled()&&this.beforeUndo(c.getProperty("edit"))});this.moveHandler=mxUtils.bind(this,function(a,c){this.isEnabled()&&this.cellsMoved(c.getProperty("cells"),c.getProperty("event"))});this.setGraph(a)}mxLayoutManager.prototype=new mxEventSource;mxLayoutManager.prototype.constructor=mxLayoutManager;
|
||||
mxLayoutManager.prototype.graph=null;mxLayoutManager.prototype.bubbling=!0;mxLayoutManager.prototype.enabled=!0;mxLayoutManager.prototype.updateHandler=null;mxLayoutManager.prototype.moveHandler=null;mxLayoutManager.prototype.isEnabled=function(){return this.enabled};mxLayoutManager.prototype.setEnabled=function(a){this.enabled=a};mxLayoutManager.prototype.isBubbling=function(){return this.bubbling};mxLayoutManager.prototype.setBubbling=function(a){this.bubbling=a};
|
||||
mxLayoutManager.prototype.getGraph=function(){return this.graph};mxLayoutManager.prototype.setGraph=function(a){if(null!=this.graph){var b=this.graph.getModel();b.removeListener(this.undoHandler);this.graph.removeListener(this.moveHandler)}this.graph=a;null!=this.graph&&(b=this.graph.getModel(),b.addListener(mxEvent.BEFORE_UNDO,this.undoHandler),this.graph.addListener(mxEvent.MOVE_CELLS,this.moveHandler))};mxLayoutManager.prototype.getLayout=function(a){return null};
|
||||
mxLayoutManager.prototype.beforeUndo=function(a){a=this.getCellsForChanges(a.changes);for(var b=this.getGraph().getModel(),c=[],d=0;d<a.length;d++)c=c.concat(b.getDescendants(a[d]));a=c;if(this.isBubbling())for(c=b.getParents(a);0<c.length;)a=a.concat(c),c=b.getParents(c);this.executeLayoutForCells(a)};mxLayoutManager.prototype.executeLayoutForCells=function(a){a=mxUtils.sortCells(a,!0);a=a.concat(a.slice().reverse());this.layoutCells(a)};
|
||||
mxLayoutManager.prototype.cellsMoved=function(a,b){if(null!=a&&null!=b)for(var c=mxUtils.convertPoint(this.getGraph().container,mxEvent.getClientX(b),mxEvent.getClientY(b)),d=this.getGraph().getModel(),e=0;e<a.length;e++){var f=d.getParent(a[e]);0>mxUtils.indexOf(a,f)&&(f=this.getLayout(f),null!=f&&f.moveCell(a[e],c.x,c.y))}};
|
||||
mxLayoutManager.prototype.getCellsForChanges=function(a){for(var b=new mxDictionary,c=[],d=0;d<a.length;d++){var e=a[d];if(e instanceof mxRootChange)return[];for(var e=this.getCellsForChange(e),f=0;f<e.length;f++)null==e[f]||b.get(e[f])||(b.put(e[f],!0),c.push(e[f]))}return c};
|
||||
mxLayoutManager.prototype.getCellsForChange=function(a){var b=this.getGraph().getModel();return a instanceof mxChildChange?[a.child,a.previous,b.getParent(a.child)]:a instanceof mxTerminalChange||a instanceof mxGeometryChange?[a.cell,b.getParent(a.cell)]:a instanceof mxVisibleChange||a instanceof mxStyleChange?[a.cell]:[]};
|
||||
mxLayoutManager.prototype.layoutCells=function(a){if(0<a.length){var b=this.getGraph().getModel();b.beginUpdate();try{for(var c=null,d=0;d<a.length;d++)a[d]!=b.getRoot()&&a[d]!=c&&this.executeLayout(this.getLayout(a[d]),a[d])&&(c=a[d]);this.fireEvent(new mxEventObject(mxEvent.LAYOUT_CELLS,"cells",a))}finally{b.endUpdate()}}};mxLayoutManager.prototype.executeLayout=function(a,b){var c=!1;null!=a&&null!=b&&(a.execute(b),c=!0);return c};mxLayoutManager.prototype.destroy=function(){this.setGraph(null)};
|
||||
mxMultiplicity.prototype.checkType=function(a,b,c,d,e){return null!=b?isNaN(b.nodeType)?b==c:mxUtils.isNode(b,c,d,e):!1};
|
||||
function mxLayoutManager(a){this.undoHandler=mxUtils.bind(this,function(a,c){this.isEnabled()&&this.beforeUndo(c.getProperty("edit"))});this.moveHandler=mxUtils.bind(this,function(a,c){this.isEnabled()&&this.cellsMoved(c.getProperty("cells"),c.getProperty("event"))});this.resizeHandler=mxUtils.bind(this,function(a,c){this.isEnabled()&&this.cellsResized(c.getProperty("cells"),c.getProperty("bounds"),c.getProperty("previous"))});this.setGraph(a)}mxLayoutManager.prototype=new mxEventSource;
|
||||
mxLayoutManager.prototype.constructor=mxLayoutManager;mxLayoutManager.prototype.graph=null;mxLayoutManager.prototype.bubbling=!0;mxLayoutManager.prototype.enabled=!0;mxLayoutManager.prototype.undoHandler=null;mxLayoutManager.prototype.moveHandler=null;mxLayoutManager.prototype.resizeHandler=null;mxLayoutManager.prototype.isEnabled=function(){return this.enabled};mxLayoutManager.prototype.setEnabled=function(a){this.enabled=a};mxLayoutManager.prototype.isBubbling=function(){return this.bubbling};
|
||||
mxLayoutManager.prototype.setBubbling=function(a){this.bubbling=a};mxLayoutManager.prototype.getGraph=function(){return this.graph};
|
||||
mxLayoutManager.prototype.setGraph=function(a){if(null!=this.graph){var b=this.graph.getModel();b.removeListener(this.undoHandler);this.graph.removeListener(this.moveHandler);this.graph.removeListener(this.resizeHandler)}this.graph=a;null!=this.graph&&(b=this.graph.getModel(),b.addListener(mxEvent.BEFORE_UNDO,this.undoHandler),this.graph.addListener(mxEvent.MOVE_CELLS,this.moveHandler),this.graph.addListener(mxEvent.RESIZE_CELLS,this.resizeHandler))};
|
||||
mxLayoutManager.prototype.getLayout=function(a,b){return null};mxLayoutManager.prototype.beforeUndo=function(a){this.executeLayoutForCells(this.getCellsForChanges(a.changes))};mxLayoutManager.prototype.cellsMoved=function(a,b){if(null!=a&&null!=b)for(var c=mxUtils.convertPoint(this.getGraph().container,mxEvent.getClientX(b),mxEvent.getClientY(b)),d=0;d<a.length;d++){var e=this.getAncestorLayout(a[d],mxEvent.MOVE_CELLS);null!=e&&e.moveCell(a[d],c.x,c.y)}};
|
||||
mxLayoutManager.prototype.cellsResized=function(a,b,c){if(null!=a&&null!=b)for(var d=0;d<a.length;d++){var e=this.getAncestorLayout(a[d],mxEvent.RESIZE_CELLS);null!=e&&e.resizeCell(a[d],b[d],c[d])}};mxLayoutManager.prototype.getAncestorLayout=function(a,b){for(var c=this.getGraph().getModel();null!=a;){var d=this.getLayout(a,b);if(null!=d)return d;a=c.getParent(a)}return null};
|
||||
mxLayoutManager.prototype.getCellsForChanges=function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c];if(d instanceof mxRootChange)return[];b=b.concat(this.getCellsForChange(d))}return b};mxLayoutManager.prototype.getCellsForChange=function(a){return a instanceof mxChildChange?this.addCellsWithLayout(a.child,this.addCellsWithLayout(a.previous)):a instanceof mxTerminalChange||a instanceof mxGeometryChange||a instanceof mxVisibleChange||a instanceof mxStyleChange?this.addCellsWithLayout(a.cell):[]};
|
||||
mxLayoutManager.prototype.addCellsWithLayout=function(a,b){return this.addDescendantsWithLayout(a,this.addAncestorsWithLayout(a,b))};mxLayoutManager.prototype.addAncestorsWithLayout=function(a,b){b=null!=b?b:[];if(null!=a&&(null!=this.getLayout(a)&&b.push(a),this.isBubbling())){var c=this.getGraph().getModel();this.addAncestorsWithLayout(c.getParent(a),b)}return b};
|
||||
mxLayoutManager.prototype.addDescendantsWithLayout=function(a,b){b=null!=b?b:[];if(null!=a&&null!=this.getLayout(a))for(var c=this.getGraph().getModel(),d=0;d<c.getChildCount(a);d++){var e=c.getChildAt(a,d);null!=this.getLayout(e)&&(b.push(e),this.addDescendantsWithLayout(e,b))}return b};mxLayoutManager.prototype.executeLayoutForCells=function(a){a=mxUtils.sortCells(a,!0);this.layoutCells(a,!1);this.layoutCells(a.reverse(),!0)};
|
||||
mxLayoutManager.prototype.layoutCells=function(a,b){if(0<a.length){var c=this.getGraph().getModel();c.beginUpdate();try{for(var d=null,e=0;e<a.length;e++)a[e]!=c.getRoot()&&a[e]!=d&&(this.executeLayout(a[e],b),d=a[e]);this.fireEvent(new mxEventObject(mxEvent.LAYOUT_CELLS,"cells",a))}finally{c.endUpdate()}}};mxLayoutManager.prototype.executeLayout=function(a,b){var c=this.getLayout(a,b?mxEvent.END_UPDATE:mxEvent.BEGIN_UPDATE);null!=c&&c.execute(a)};mxLayoutManager.prototype.destroy=function(){this.setGraph(null)};
|
||||
function mxSwimlaneManager(a,b,c,d){this.horizontal=null!=b?b:!0;this.addEnabled=null!=c?c:!0;this.resizeEnabled=null!=d?d:!0;this.addHandler=mxUtils.bind(this,function(a,b){this.isEnabled()&&this.isAddEnabled()&&this.cellsAdded(b.getProperty("cells"))});this.resizeHandler=mxUtils.bind(this,function(a,b){this.isEnabled()&&this.isResizeEnabled()&&this.cellsResized(b.getProperty("cells"))});this.setGraph(a)}mxSwimlaneManager.prototype=new mxEventSource;mxSwimlaneManager.prototype.constructor=mxSwimlaneManager;
|
||||
mxSwimlaneManager.prototype.graph=null;mxSwimlaneManager.prototype.enabled=!0;mxSwimlaneManager.prototype.horizontal=!0;mxSwimlaneManager.prototype.addEnabled=!0;mxSwimlaneManager.prototype.resizeEnabled=!0;mxSwimlaneManager.prototype.addHandler=null;mxSwimlaneManager.prototype.resizeHandler=null;mxSwimlaneManager.prototype.isEnabled=function(){return this.enabled};mxSwimlaneManager.prototype.setEnabled=function(a){this.enabled=a};mxSwimlaneManager.prototype.isHorizontal=function(){return this.horizontal};
|
||||
mxSwimlaneManager.prototype.setHorizontal=function(a){this.horizontal=a};mxSwimlaneManager.prototype.isAddEnabled=function(){return this.addEnabled};mxSwimlaneManager.prototype.setAddEnabled=function(a){this.addEnabled=a};mxSwimlaneManager.prototype.isResizeEnabled=function(){return this.resizeEnabled};mxSwimlaneManager.prototype.setResizeEnabled=function(a){this.resizeEnabled=a};mxSwimlaneManager.prototype.getGraph=function(){return this.graph};
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 22 KiB |
|
@ -18,7 +18,6 @@
|
|||
<meta name="theme-color" content="#d89000">
|
||||
<script type="text/javascript">
|
||||
var mxIsElectron = window && window.process && window.process.type;
|
||||
var mxIsElectron5 = mxIsElectron && parseInt(process.versions.electron) >= 5;
|
||||
|
||||
/**
|
||||
* URL Parameters and protocol description are here:
|
||||
|
@ -102,11 +101,6 @@
|
|||
window.location.href = href;
|
||||
}
|
||||
}
|
||||
else if (!mxIsElectron5)
|
||||
{
|
||||
// It's electron, but v3 or lower
|
||||
window.location.href = 'https://about.draw.io/updates-to-draw-io-desktop/';
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
|
@ -152,7 +146,7 @@
|
|||
addMeta('apple-mobile-web-app-title', name);
|
||||
addMeta('application-name', name);
|
||||
|
||||
if (mxIsElectron5)
|
||||
if (mxIsElectron)
|
||||
{
|
||||
addMeta(null, 'default-src \'self\' \'unsafe-inline\'; connect-src \'self\' https://*.draw.io https://fonts.googleapis.com https://fonts.gstatic.com; img-src * data:; media-src *; font-src *; style-src-elem \'self\' \'unsafe-inline\' https://fonts.googleapis.com', 'Content-Security-Policy');
|
||||
}
|
||||
|
@ -165,7 +159,7 @@
|
|||
<link rel="mask-icon" href="images/safari-pinned-tab.svg" color="#d89000">
|
||||
<link rel="stylesheet" type="text/css" href="js/croppie/croppie.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="styles/grapheditor.css">
|
||||
<link rel="canonical" href="https://www.draw.io">
|
||||
<link rel="canonical" href="https://app.diagrams.net">
|
||||
<link rel="manifest" href="images/manifest.json">
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<style type="text/css">
|
||||
|
|
2662
src/main/webapp/js/app.min.js
vendored
2662
src/main/webapp/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -531,25 +531,12 @@ App.main = function(callback, createUi)
|
|||
|
||||
if (window.mxscript != null)
|
||||
{
|
||||
// Check that service workers are supported and registers,
|
||||
// unregisters or updates the installed service worker
|
||||
// Runs as progressive web app if service workers are supported
|
||||
try
|
||||
{
|
||||
if ('serviceWorker' in navigator)
|
||||
{
|
||||
if (urlParams['offline'] == '1')
|
||||
{
|
||||
mxscript('js/shapes.min.js');
|
||||
mxscript('js/stencils.min.js');
|
||||
mxscript('js/extensions.min.js');
|
||||
|
||||
// Use the window load event to keep the page load performant
|
||||
window.addEventListener('load', function()
|
||||
{
|
||||
navigator.serviceWorker.register('/service-worker.js');
|
||||
});
|
||||
}
|
||||
else if (urlParams['offline'] == '0')
|
||||
if (urlParams['offline'] == '0' || urlParams['dev'] == '1')
|
||||
{
|
||||
navigator.serviceWorker.getRegistrations().then(function(registrations)
|
||||
{
|
||||
|
@ -559,9 +546,13 @@ App.main = function(callback, createUi)
|
|||
}
|
||||
});
|
||||
}
|
||||
else if (navigator.serviceWorker.controller)
|
||||
else
|
||||
{
|
||||
// Updates cache if PWA was registered
|
||||
mxscript('js/shapes.min.js');
|
||||
mxscript('js/stencils.min.js');
|
||||
mxscript('js/extensions.min.js');
|
||||
|
||||
// Use the window load event to keep the page load performant
|
||||
window.addEventListener('load', function()
|
||||
{
|
||||
navigator.serviceWorker.register('/service-worker.js');
|
||||
|
@ -1441,17 +1432,15 @@ App.prototype.init = function()
|
|||
}
|
||||
|
||||
// Integrates Add to Home Screen
|
||||
if (urlParams['offline'] == '1' && 'serviceWorker' in navigator &&
|
||||
!mxClient.IS_CHROMEAPP && !EditorUi.isElectronApp)
|
||||
if ('serviceWorker' in navigator && !mxClient.IS_CHROMEAPP && !EditorUi.isElectronApp &&
|
||||
(/.*\.diagrams\.net$/.test(window.location.hostname) || urlParams['offline'] == '1'))
|
||||
{
|
||||
window.addEventListener('beforeinstallprompt', mxUtils.bind(this, function(e)
|
||||
{
|
||||
this.showBanner('AddToHomeScreenFooter',
|
||||
mxResources.get('installDrawio'),
|
||||
mxUtils.bind(this, function()
|
||||
this.showBanner('AddToHomeScreenFooter', mxResources.get('installDrawio'), function()
|
||||
{
|
||||
e.prompt();
|
||||
}));
|
||||
});
|
||||
}));
|
||||
}
|
||||
else if (!mxClient.IS_CHROMEAPP && !EditorUi.isElectronApp && !this.isOfflineApp() &&
|
||||
|
@ -1470,7 +1459,7 @@ App.prototype.init = function()
|
|||
}
|
||||
|
||||
if (!mxClient.IS_CHROMEAPP && !EditorUi.isElectronApp && urlParams['embed'] != '1' && DrawioFile.SYNC == 'auto' &&
|
||||
urlParams['local'] != '1' && urlParams['stealth'] != '1' && urlParams['offline'] != '1' &&
|
||||
urlParams['local'] != '1' && urlParams['stealth'] != '1' && this.isOffline() &&
|
||||
(!this.editor.chromeless || this.editor.editable))
|
||||
{
|
||||
// Checks if the cache is alive
|
||||
|
@ -3483,6 +3472,22 @@ App.prototype.pickFile = function(mode)
|
|||
window.openNew = this.getCurrentFile() != null && !this.isDiagramEmpty();
|
||||
window.baseUrl = this.getUrl();
|
||||
window.openKey = 'open';
|
||||
|
||||
window.listBrowserFiles = mxUtils.bind(this, function(success, error)
|
||||
{
|
||||
StorageFile.listFiles(this, 'F', success, error);
|
||||
});
|
||||
|
||||
window.openBrowserFile = mxUtils.bind(this, function(title, success, error)
|
||||
{
|
||||
StorageFile.getFileContent(this, title, success, error);
|
||||
});
|
||||
|
||||
window.deleteBrowserFile = mxUtils.bind(this, function(title, success, error)
|
||||
{
|
||||
StorageFile.deleteFile(this, title, success, error);
|
||||
});
|
||||
|
||||
var prevValue = Editor.useLocalStorage;
|
||||
Editor.useLocalStorage = (mode == App.MODE_BROWSER);
|
||||
this.openFile();
|
||||
|
@ -3638,6 +3643,21 @@ App.prototype.pickLibrary = function(mode)
|
|||
window.openNew = false;
|
||||
window.openKey = 'open';
|
||||
|
||||
window.listBrowserFiles = mxUtils.bind(this, function(success, error)
|
||||
{
|
||||
StorageFile.listFiles(this, 'L', success, error);
|
||||
});
|
||||
|
||||
window.openBrowserFile = mxUtils.bind(this, function(title, success, error)
|
||||
{
|
||||
StorageFile.getFileContent(this, title, success, error);
|
||||
});
|
||||
|
||||
window.deleteBrowserFile = mxUtils.bind(this, function(title, success, error)
|
||||
{
|
||||
StorageFile.deleteFile(this, title, success, error);
|
||||
});
|
||||
|
||||
var prevValue = Editor.useLocalStorage;
|
||||
Editor.useLocalStorage = mode == App.MODE_BROWSER;
|
||||
|
||||
|
@ -4420,11 +4440,19 @@ App.prototype.loadFile = function(id, sameWindow, file, success, force)
|
|||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
var error = mxUtils.bind(this, function (e)
|
||||
{
|
||||
id = decodeURIComponent(id.substring(1));
|
||||
var data = localStorage.getItem(id);
|
||||
this.handleError(e, mxResources.get('errorLoadingFile'), mxUtils.bind(this, function()
|
||||
{
|
||||
var tempFile = this.getCurrentFile();
|
||||
window.location.hash = (tempFile != null) ? tempFile.getHash() : '';
|
||||
}));
|
||||
});
|
||||
|
||||
id = decodeURIComponent(id.substring(1));
|
||||
|
||||
StorageFile.getFileContent(this, id, mxUtils.bind(this, function(data)
|
||||
{
|
||||
if (data != null)
|
||||
{
|
||||
this.fileLoaded(new StorageFile(this, data, id));
|
||||
|
@ -4436,17 +4464,9 @@ App.prototype.loadFile = function(id, sameWindow, file, success, force)
|
|||
}
|
||||
else
|
||||
{
|
||||
throw {message: mxResources.get('fileNotFound')};
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
this.handleError(e, mxResources.get('errorLoadingFile'), mxUtils.bind(this, function()
|
||||
{
|
||||
var tempFile = this.getCurrentFile();
|
||||
window.location.hash = (tempFile != null) ? tempFile.getHash() : '';
|
||||
}));
|
||||
error({message: mxResources.get('fileNotFound')});
|
||||
}
|
||||
}), error);
|
||||
}
|
||||
}
|
||||
else if (file != null)
|
||||
|
@ -4914,7 +4934,7 @@ App.prototype.loadLibraries = function(libs, done)
|
|||
{
|
||||
var name = decodeURIComponent(id.substring(1));
|
||||
|
||||
var xml = this.getLocalData(name, mxUtils.bind(this, function(xml)
|
||||
StorageFile.getFileContent(this, name, mxUtils.bind(this, function(xml)
|
||||
{
|
||||
if (name == '.scratchpad' && xml == null)
|
||||
{
|
||||
|
@ -4929,7 +4949,7 @@ App.prototype.loadLibraries = function(libs, done)
|
|||
{
|
||||
onerror();
|
||||
}
|
||||
}));
|
||||
}), onerror);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
|
|
|
@ -2768,7 +2768,7 @@
|
|||
{
|
||||
if (this.scratchpad == null)
|
||||
{
|
||||
this.getLocalData('.scratchpad', mxUtils.bind(this, function(xml)
|
||||
StorageFile.getFileContent(this, '.scratchpad', mxUtils.bind(this, function(xml)
|
||||
{
|
||||
if (xml == null)
|
||||
{
|
||||
|
@ -10320,7 +10320,9 @@
|
|||
|
||||
this.addListener('customFontsChanged', mxUtils.bind(this, function(sender, evt)
|
||||
{
|
||||
mxSettings.setCustomFonts(this.menus.customFonts);
|
||||
var customFonts = evt.getProperty('customFonts');
|
||||
this.menus.customFonts = customFonts;
|
||||
mxSettings.setCustomFonts(customFonts);
|
||||
mxSettings.save();
|
||||
}));
|
||||
|
||||
|
@ -13634,20 +13636,56 @@
|
|||
{
|
||||
try
|
||||
{
|
||||
var req = indexedDB.open('database', '1.0');
|
||||
var req = indexedDB.open('database', 2);
|
||||
|
||||
req.onupgradeneeded = function(e)
|
||||
{
|
||||
e.target.result.createObjectStore('objects', {keyPath: 'key'});
|
||||
var db = req.result;
|
||||
|
||||
if (e.oldVersion < 1)
|
||||
{
|
||||
// Version 1 is the first version of the database.
|
||||
db.createObjectStore('objects', {keyPath: 'key'});
|
||||
}
|
||||
|
||||
if (e.oldVersion < 2)
|
||||
{
|
||||
// Version 2 introduces browser file storage.
|
||||
db.createObjectStore('files', {keyPath: 'title'});
|
||||
db.createObjectStore('filesInfo', {keyPath: 'title'});
|
||||
EditorUi.migrateStorageFiles = true;
|
||||
}
|
||||
}
|
||||
|
||||
req.onsuccess = mxUtils.bind(this, function(e)
|
||||
{
|
||||
this.database = e.target.result;
|
||||
success(this.database);
|
||||
var db = req.result;
|
||||
this.database = db;
|
||||
|
||||
if (EditorUi.migrateStorageFiles)
|
||||
{
|
||||
StorageFile.migrate(db);
|
||||
EditorUi.migrateStorageFiles = false;
|
||||
}
|
||||
|
||||
success(db);
|
||||
|
||||
db.onversionchange = function()
|
||||
{
|
||||
//TODO Handle DB revision update while code is running
|
||||
// Save open file and request a page reload before closing the DB
|
||||
db.close();
|
||||
};
|
||||
});
|
||||
|
||||
req.onerror = error;
|
||||
|
||||
req.onblocked = function()
|
||||
{
|
||||
//TODO Use this when a new version is introduced
|
||||
// there's another open connection to same database
|
||||
// and it wasn't closed after db.onversionchange triggered for them
|
||||
};
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
|
@ -13668,16 +13706,33 @@
|
|||
}
|
||||
};
|
||||
|
||||
EditorUi.prototype.setDatabaseItem = function(key, data, success, error)
|
||||
/**
|
||||
* Add/Update item(s) in the database. It supports multiple stores transactions by sending an array of data, storeName
|
||||
* (key is optional, can be an array also if multiple stores are needed)
|
||||
*/
|
||||
EditorUi.prototype.setDatabaseItem = function(key, data, success, error, storeName)
|
||||
{
|
||||
this.openDatabase(mxUtils.bind(this, function(db)
|
||||
{
|
||||
try
|
||||
{
|
||||
var trx = db.transaction(['objects'], 'readwrite');
|
||||
var req = trx.objectStore('objects').put({key: key, data: data});
|
||||
req.onsuccess = success;
|
||||
req.onerror = error;
|
||||
storeName = storeName || 'objects';
|
||||
|
||||
if (!Array.isArray(storeName))
|
||||
{
|
||||
storeName = [storeName];
|
||||
key = [key];
|
||||
data = [data];
|
||||
}
|
||||
|
||||
var trx = db.transaction(storeName, 'readwrite');
|
||||
trx.oncomplete = success;
|
||||
trx.onerror = error;
|
||||
|
||||
for (var i = 0; i < storeName.length; i++)
|
||||
{
|
||||
trx.objectStore(storeName[i]).put(key != null && key[i] != null? {key: key[i], data: data[i]} : data[i]);
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
|
@ -13692,28 +13747,71 @@
|
|||
/**
|
||||
* Removes the item for the given key from the database.
|
||||
*/
|
||||
EditorUi.prototype.removeDatabaseItem = function(key, success, error)
|
||||
EditorUi.prototype.removeDatabaseItem = function(key, success, error, storeName)
|
||||
{
|
||||
this.openDatabase(mxUtils.bind(this, function(db)
|
||||
{
|
||||
var trx = db.transaction(['objects'], 'readwrite');
|
||||
var req = trx.objectStore('objects').delete(key);
|
||||
req.onsuccess = success;
|
||||
storeName = storeName || 'objects';
|
||||
|
||||
if (!Array.isArray(storeName))
|
||||
{
|
||||
storeName = [storeName];
|
||||
key = [key];
|
||||
}
|
||||
|
||||
var trx = db.transaction(storeName, 'readwrite');
|
||||
trx.oncomplete = success;
|
||||
trx.onerror = error;
|
||||
|
||||
for (var i = 0; i < storeName.length; i++)
|
||||
{
|
||||
trx.objectStore(storeName[i]).delete(key[i]);
|
||||
}
|
||||
}), error);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns one item from the database.
|
||||
*/
|
||||
EditorUi.prototype.getDatabaseItem = function(key, success, error, storeName)
|
||||
{
|
||||
this.openDatabase(mxUtils.bind(this, function(db)
|
||||
{
|
||||
try
|
||||
{
|
||||
storeName = storeName || 'objects';
|
||||
var trx = db.transaction([storeName], 'readonly');
|
||||
var req = trx.objectStore(storeName).get(key);
|
||||
|
||||
req.onsuccess = function()
|
||||
{
|
||||
success(req.result);
|
||||
};
|
||||
|
||||
req.onerror = error;
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
if (error != null)
|
||||
{
|
||||
error(e);
|
||||
}
|
||||
}
|
||||
}), error);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns all items from the database.
|
||||
*/
|
||||
EditorUi.prototype.getDatabaseItems = function(success, error)
|
||||
EditorUi.prototype.getDatabaseItems = function(success, error, storeName)
|
||||
{
|
||||
this.openDatabase(mxUtils.bind(this, function(db)
|
||||
{
|
||||
try
|
||||
{
|
||||
var trx = db.transaction(['objects'], 'readwrite');
|
||||
var req = trx.objectStore('objects').openCursor(
|
||||
storeName = storeName || 'objects';
|
||||
var trx = db.transaction([storeName], 'readonly');
|
||||
var req = trx.objectStore(storeName).openCursor(
|
||||
IDBKeyRange.lowerBound(0));
|
||||
var items = [];
|
||||
|
||||
|
@ -13742,6 +13840,35 @@
|
|||
}), error);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns all item keys from the database.
|
||||
*/
|
||||
EditorUi.prototype.getDatabaseItemKeys = function(success, error, storeName)
|
||||
{
|
||||
this.openDatabase(mxUtils.bind(this, function(db)
|
||||
{
|
||||
try
|
||||
{
|
||||
storeName = storeName || 'objects';
|
||||
var trx = db.transaction([storeName], 'readonly');
|
||||
var req = trx.objectStore(storeName).getAllKeys();
|
||||
|
||||
req.onsuccess = function()
|
||||
{
|
||||
success(req.result);
|
||||
};
|
||||
|
||||
req.onerror = error;
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
if (error != null)
|
||||
{
|
||||
error(e);
|
||||
}
|
||||
}
|
||||
}), error);
|
||||
};
|
||||
/**
|
||||
* Comments: We need these functions as wrapper of File functions in order to facilitate
|
||||
* overriding them if comments are needed without having a file (e.g. Confluence Plugin)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
window.PLUGINS_BASE_PATH = '.';
|
||||
window.OPEN_URL = 'https://www.draw.io/open';
|
||||
window.TEMPLATE_PATH = 'templates';
|
||||
window.DRAW_MATH_URL = window.mxIsElectron5? 'math' : 'https://www.draw.io/math';
|
||||
window.DRAW_MATH_URL = 'math';
|
||||
FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
|
||||
|
||||
//Disables eval for JS (uses shapes.min.js)
|
||||
|
@ -1335,8 +1334,6 @@ mxStencilRegistry.allowEval = false;
|
|||
return this.response;
|
||||
}
|
||||
|
||||
if (mxIsElectron5)
|
||||
{
|
||||
//Direct export to pdf
|
||||
EditorUi.prototype.createDownloadRequest = function(filename, format, ignoreSelection, base64, transparent, currentPage, scale, border, grid)
|
||||
{
|
||||
|
@ -1481,7 +1478,6 @@ mxStencilRegistry.allowEval = false;
|
|||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
EditorUi.prototype.saveData = function(filename, format, data, mimeType, base64Encoded)
|
||||
{
|
||||
|
|
|
@ -16,18 +16,18 @@ window.mxLoadSettings = window.mxLoadSettings || urlParams['configure'] != '1';
|
|||
window.isSvgBrowser = window.isSvgBrowser || (navigator.userAgent.indexOf('MSIE') < 0 || document.documentMode >= 9);
|
||||
|
||||
// CUSTOM_PARAMETERS - URLs for save and export
|
||||
window.DRAWIO_BASE_URL = window.DRAWIO_BASE_URL || 'https://app.diagrams.net';
|
||||
window.EXPORT_URL = window.EXPORT_URL || 'https://exp.draw.io/ImageExport4/export';
|
||||
window.PLANT_URL = window.PLANT_URL || 'https://exp-plant.draw.io/plantuml-1-2020-2';
|
||||
window.DRAW_MATH_URL = window.DRAW_MATH_URL || 'https://www.draw.io/math';
|
||||
window.DRAW_MATH_URL = window.DRAW_MATH_URL || window.DRAWIO_BASE_URL + '/math';
|
||||
window.VSD_CONVERT_URL = window.VSD_CONVERT_URL || 'https://convert.draw.io/VsdConverter/api/converter';
|
||||
window.EMF_CONVERT_URL = window.EMF_CONVERT_URL || 'https://convert.draw.io/emf2png/convertEMF';
|
||||
window.REALTIME_URL = window.REALTIME_URL || 'https://rt.draw.io/cache';
|
||||
window.REALTIME_URL = window.REALTIME_URL || 'cache';
|
||||
window.DRAWIO_GITLAB_URL = window.DRAWIO_GITLAB_URL || 'https://gitlab.com';
|
||||
window.DRAWIO_GITLAB_ID = window.DRAWIO_GITLAB_ID || '5cdc018a32acddf6eba37592d9374945241e644b8368af847422d74c8709bc44';
|
||||
window.SAVE_URL = window.SAVE_URL || 'save';
|
||||
window.OPEN_URL = window.OPEN_URL || 'open';
|
||||
window.PROXY_URL = window.PROXY_URL || 'proxy';
|
||||
window.DRAWIO_BASE_URL = window.DRAWIO_BASE_URL || 'https://www.draw.io';
|
||||
window.DRAWIO_VIEWER_URL = window.DRAWIO_VIEWER_URL || null;
|
||||
|
||||
// Paths and files
|
||||
|
@ -35,7 +35,7 @@ window.SHAPES_PATH = window.SHAPES_PATH || 'shapes';
|
|||
// Path for images inside the diagram
|
||||
window.GRAPH_IMAGE_PATH = window.GRAPH_IMAGE_PATH || 'img';
|
||||
window.ICONSEARCH_PATH = window.ICONSEARCH_PATH || ((navigator.userAgent.indexOf('MSIE') >= 0 ||
|
||||
urlParams['dev']) && window.location.protocol != 'file:' ? 'iconSearch' : 'https://www.draw.io/iconSearch');
|
||||
urlParams['dev']) && window.location.protocol != 'file:' ? 'iconSearch' : 'https://app.diagrams.net/iconSearch');
|
||||
window.TEMPLATE_PATH = window.TEMPLATE_PATH || 'templates';
|
||||
window.NEW_DIAGRAM_CATS_PATH = window.NEW_DIAGRAM_CATS_PATH || 'newDiagramCats';
|
||||
window.PLUGINS_BASE_PATH = window.PLUGINS_BASE_PATH || '';
|
||||
|
|
|
@ -287,7 +287,7 @@
|
|||
|
||||
editorUi.actions.put('exportPdf', new Action(mxResources.get('formatPdf') + '...', function()
|
||||
{
|
||||
if ((typeof(mxIsElectron5) === 'undefined' || !mxIsElectron5) &&
|
||||
if ((typeof(mxIsElectron) === 'undefined' || !mxIsElectron) &&
|
||||
(editorUi.isOffline() || editorUi.printPdfExport))
|
||||
{
|
||||
// Export PDF action for chrome OS (same as print with different dialog title)
|
||||
|
@ -3542,11 +3542,13 @@
|
|||
/**
|
||||
* External Fonts undoable change
|
||||
*/
|
||||
function ChangeExtFonts(ui, extFonts)
|
||||
function ChangeExtFonts(ui, extFonts, customFonts)
|
||||
{
|
||||
this.ui = ui;
|
||||
this.extFonts = extFonts;
|
||||
this.previousExtFonts = extFonts;
|
||||
this.customFonts = customFonts;
|
||||
this.prevCustomFonts = customFonts;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -3556,6 +3558,11 @@
|
|||
{
|
||||
var graph = this.ui.editor.graph;
|
||||
|
||||
|
||||
this.customFonts = this.prevCustomFonts;
|
||||
this.prevCustomFonts = this.ui.menus.customFonts;
|
||||
this.ui.fireEvent(new mxEventObject('customFontsChanged', 'customFonts', this.customFonts));
|
||||
|
||||
this.extFonts = this.previousExtFonts;
|
||||
var tmp = graph.extFonts;
|
||||
|
||||
|
@ -3571,7 +3578,7 @@
|
|||
|
||||
graph.extFonts = [];
|
||||
|
||||
for (var i = 0; i < this.previousExtFonts.length; i++)
|
||||
for (var i = 0; this.previousExtFonts != null && i < this.previousExtFonts.length; i++)
|
||||
{
|
||||
this.ui.editor.graph.addExtFont(this.previousExtFonts[i].name, this.previousExtFonts[i].url);
|
||||
}
|
||||
|
@ -3582,7 +3589,7 @@
|
|||
//Replace the default font family menu
|
||||
this.put('fontFamily', new Menu(mxUtils.bind(this, function(menu, parent)
|
||||
{
|
||||
var addItem = mxUtils.bind(this, function(fontname, fontUrl)
|
||||
var addItem = mxUtils.bind(this, function(fontname, fontUrl, deletable)
|
||||
{
|
||||
var graph = this.editorUi.editor.graph;
|
||||
|
||||
|
@ -3607,6 +3614,50 @@
|
|||
//Add the font to the file in case it was a previous font from the settings
|
||||
graph.addExtFont(fontname, fontUrl);
|
||||
});
|
||||
|
||||
if (deletable)
|
||||
{
|
||||
var img = document.createElement('span');
|
||||
img.className = 'geSprite geSprite-delete';
|
||||
img.style.cursor = 'pointer';
|
||||
img.style.display = 'inline-block';
|
||||
tr.firstChild.nextSibling.nextSibling.appendChild(img);
|
||||
|
||||
mxEvent.addListener(img, (mxClient.IS_POINTER) ? 'pointerup' : 'mouseup', mxUtils.bind(this, function(evt)
|
||||
{
|
||||
var extFonts = mxUtils.clone(this.editorUi.editor.graph.extFonts);
|
||||
|
||||
if (extFonts != null && extFonts.length > 0)
|
||||
{
|
||||
for (var i = 0; i < extFonts.length; i++)
|
||||
{
|
||||
if (extFonts[i].name == fontname)
|
||||
{
|
||||
extFonts.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var customFonts = mxUtils.clone(this.customFonts);
|
||||
|
||||
for (var i = 0; i < customFonts.length; i++)
|
||||
{
|
||||
if (customFonts[i].name == fontname)
|
||||
{
|
||||
customFonts.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var change = new ChangeExtFonts(this.editorUi, extFonts, customFonts);
|
||||
this.editorUi.editor.graph.model.execute(change);
|
||||
|
||||
this.editorUi.menubar.hideMenu();
|
||||
mxEvent.consume(evt);
|
||||
}));
|
||||
}
|
||||
|
||||
tr.firstChild.nextSibling.style.fontFamily = fontname;
|
||||
});
|
||||
|
||||
|
@ -3641,7 +3692,7 @@
|
|||
|
||||
if (changed)
|
||||
{
|
||||
this.editorUi.fireEvent(new mxEventObject('customFontsChanged'));
|
||||
this.editorUi.fireEvent(new mxEventObject('customFontsChanged', 'customFonts', this.customFonts));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3650,7 +3701,7 @@
|
|||
for (var i = 0; i < this.customFonts.length; i++)
|
||||
{
|
||||
var name = this.customFonts[i].name, url = this.customFonts[i].url;
|
||||
addItem(name, url);
|
||||
addItem(name, url, true);
|
||||
|
||||
//Load external fonts without saving them to the file
|
||||
this.editorUi.editor.graph.addExtFont(name, url, true);
|
||||
|
@ -3660,11 +3711,8 @@
|
|||
|
||||
menu.addItem(mxResources.get('reset'), null, mxUtils.bind(this, function()
|
||||
{
|
||||
var change = new ChangeExtFonts(this.editorUi, []);
|
||||
var change = new ChangeExtFonts(this.editorUi, [], []);
|
||||
this.editorUi.editor.graph.model.execute(change);
|
||||
|
||||
this.customFonts = [];
|
||||
this.editorUi.fireEvent(new mxEventObject('customFontsChanged'));
|
||||
}), parent);
|
||||
|
||||
menu.addSeparator(parent);
|
||||
|
@ -3742,7 +3790,7 @@
|
|||
if (addToCustom)
|
||||
{
|
||||
this.customFonts.push({name: fontName, url: fontUrl});
|
||||
this.editorUi.fireEvent(new mxEventObject('customFontsChanged'));
|
||||
this.editorUi.fireEvent(new mxEventObject('customFontsChanged', 'customFonts', this.customFonts));
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
|
|
@ -30,6 +30,11 @@ StorageFile.prototype.autosaveDelay = 2000;
|
|||
*/
|
||||
StorageFile.prototype.maxAutosaveDelay = 20000;
|
||||
|
||||
/**
|
||||
* A differentiator of the stored object type (file or lib)
|
||||
*/
|
||||
StorageFile.prototype.type = 'F';
|
||||
|
||||
/**
|
||||
* Translates this point by the given vector.
|
||||
*
|
||||
|
@ -105,6 +110,48 @@ StorageFile.prototype.saveAs = function(title, success, error)
|
|||
this.saveFile(title, false, success, error);
|
||||
};
|
||||
|
||||
|
||||
StorageFile.getFileContent = function(ui, title, success, error)
|
||||
{
|
||||
ui.getDatabaseItem(title, function(obj)
|
||||
{
|
||||
success(obj != null? obj.data : null);
|
||||
},
|
||||
mxUtils.bind(this, function()
|
||||
{
|
||||
if (ui.database == null) //fallback to localstorage
|
||||
{
|
||||
ui.getLocalData(title, success);
|
||||
}
|
||||
else if (error != null)
|
||||
{
|
||||
error();
|
||||
}
|
||||
}), 'files');
|
||||
};
|
||||
|
||||
StorageFile.getFileInfo = function(ui, title, success, error)
|
||||
{
|
||||
ui.getDatabaseItem(title, function(obj)
|
||||
{
|
||||
success(obj);
|
||||
},
|
||||
mxUtils.bind(this, function()
|
||||
{
|
||||
if (ui.database == null) //fallback to localstorage
|
||||
{
|
||||
ui.getLocalData(title, function(data)
|
||||
{
|
||||
success(data != null? {title: title} : null);
|
||||
});
|
||||
}
|
||||
else if (error != null)
|
||||
{
|
||||
error();
|
||||
}
|
||||
}), 'filesInfo');
|
||||
};
|
||||
|
||||
/**
|
||||
* Translates this point by the given vector.
|
||||
*
|
||||
|
@ -131,7 +178,7 @@ StorageFile.prototype.saveFile = function(title, revision, success, error)
|
|||
|
||||
try
|
||||
{
|
||||
this.ui.setLocalData(this.title, this.getData(), mxUtils.bind(this, function()
|
||||
var saveDone = mxUtils.bind(this, function()
|
||||
{
|
||||
this.setModified(false);
|
||||
this.contentChanged();
|
||||
|
@ -140,7 +187,29 @@ StorageFile.prototype.saveFile = function(title, revision, success, error)
|
|||
{
|
||||
success();
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
var data = this.getData();
|
||||
|
||||
this.ui.setDatabaseItem(null, [{
|
||||
title: this.title,
|
||||
size: data.length,
|
||||
lastModified: Date.now(),
|
||||
type: this.type
|
||||
}, {
|
||||
title: this.title,
|
||||
data: data
|
||||
}], saveDone, mxUtils.bind(this, function()
|
||||
{
|
||||
if (this.ui.database == null) //fallback to localstorage
|
||||
{
|
||||
this.ui.setLocalData(this.title, data, saveDone);
|
||||
}
|
||||
else if (error != null)
|
||||
{
|
||||
error();
|
||||
}
|
||||
}), ['filesInfo', 'files']);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
|
@ -158,7 +227,7 @@ StorageFile.prototype.saveFile = function(title, revision, success, error)
|
|||
}
|
||||
else
|
||||
{
|
||||
this.ui.getLocalData(title, mxUtils.bind(this, function(data)
|
||||
StorageFile.getFileInfo(this.ui, title, mxUtils.bind(this, function(data)
|
||||
{
|
||||
if (!this.isRenamable() || this.getTitle() == title || data == null)
|
||||
{
|
||||
|
@ -168,7 +237,7 @@ StorageFile.prototype.saveFile = function(title, revision, success, error)
|
|||
{
|
||||
this.ui.confirm(mxResources.get('replaceIt', [title]), fn, error);
|
||||
}
|
||||
}));
|
||||
}), error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -185,7 +254,7 @@ StorageFile.prototype.rename = function(title, success, error)
|
|||
|
||||
if (oldTitle != title)
|
||||
{
|
||||
this.ui.getLocalData(title, mxUtils.bind(this, function(data)
|
||||
StorageFile.getFileInfo(this.ui, title, mxUtils.bind(this, function(data)
|
||||
{
|
||||
var fn = mxUtils.bind(this, function()
|
||||
{
|
||||
|
@ -211,7 +280,7 @@ StorageFile.prototype.rename = function(title, success, error)
|
|||
{
|
||||
fn();
|
||||
}
|
||||
}));
|
||||
}), error);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -236,10 +305,10 @@ StorageFile.prototype.open = function()
|
|||
*/
|
||||
StorageFile.prototype.getLatestVersion = function(success, error)
|
||||
{
|
||||
this.ui.getLocalData(this.title, mxUtils.bind(this, function(data)
|
||||
StorageFile.getFileContent(this.ui, this.title, mxUtils.bind(this, function(data)
|
||||
{
|
||||
success(new StorageFile(this.ui, data, this.title));
|
||||
}));
|
||||
}), error);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -255,3 +324,100 @@ StorageFile.prototype.destroy = function()
|
|||
this.storageListener = null;
|
||||
}
|
||||
};
|
||||
|
||||
StorageFile.listLocalStorageFiles = function(type)
|
||||
{
|
||||
var filesInfo = [];
|
||||
|
||||
for (var i = 0; i < localStorage.length; i++)
|
||||
{
|
||||
var key = localStorage.key(i);
|
||||
var value = localStorage.getItem(key);
|
||||
|
||||
if (key.length > 0 && key.charAt(0) != '.' && value.length > 0)
|
||||
{
|
||||
var isFile = (type == null || type == 'F') && (value.substring(0, 8) === '<mxfile ' ||
|
||||
value.substring(0, 5) === '<?xml' || value.substring(0, 12) === '<!--[if IE]>');
|
||||
var isLib = (type == null || type == 'L') && (value.substring(0, 11) === '<mxlibrary>');
|
||||
|
||||
if (isFile || isLib)
|
||||
{
|
||||
filesInfo.push({
|
||||
title: key,
|
||||
type: isFile? 'F' : 'L',
|
||||
size: value.length,
|
||||
lastModified: Date.now()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return filesInfo;
|
||||
};
|
||||
|
||||
StorageFile.migrate = function(db)
|
||||
{
|
||||
var lsFilesInfo = StorageFile.listLocalStorageFiles();
|
||||
lsFilesInfo.push({title: '.scratchpad', type: 'L'}); //Adding scratchpad also since it is a library (storage file)
|
||||
var tx = db.transaction(['files', 'filesInfo'], 'readwrite');
|
||||
var files = tx.objectStore('files');
|
||||
var filesInfo = tx.objectStore('filesInfo');
|
||||
|
||||
for (var i = 0; i < lsFilesInfo.length; i++)
|
||||
{
|
||||
var lsFileInfo = lsFilesInfo[i];
|
||||
var data = localStorage.getItem(lsFileInfo.title);
|
||||
files.add({
|
||||
title: lsFileInfo.title,
|
||||
data: data
|
||||
});
|
||||
filesInfo.add(lsFileInfo);
|
||||
}
|
||||
};
|
||||
|
||||
StorageFile.listFiles = function(ui, type, success, error)
|
||||
{
|
||||
ui.getDatabaseItems(function(filesInfo)
|
||||
{
|
||||
var files = [];
|
||||
|
||||
if (filesInfo != null)
|
||||
{
|
||||
for (var i = 0; i < filesInfo.length; i++)
|
||||
{
|
||||
if (filesInfo[i].title.charAt(0) != '.' && (type == null || filesInfo[i].type == type))
|
||||
{
|
||||
files.push(filesInfo[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success(files);
|
||||
}, function()
|
||||
{
|
||||
if (ui.database == null) //fallback to localstorage
|
||||
{
|
||||
success(StorageFile.listLocalStorageFiles(type));
|
||||
}
|
||||
else if (error != null)
|
||||
{
|
||||
error();
|
||||
}
|
||||
}, 'filesInfo');
|
||||
};
|
||||
|
||||
StorageFile.deleteFile = function(ui, title, success, error)
|
||||
{
|
||||
ui.removeDatabaseItem([title, title], success, function()
|
||||
{
|
||||
if (ui.database == null) //fallback to localstorage
|
||||
{
|
||||
localStorage.removeItem(title)
|
||||
success();
|
||||
}
|
||||
else if (error != null)
|
||||
{
|
||||
error();
|
||||
}
|
||||
}, ['files', 'filesInfo']);
|
||||
};
|
|
@ -18,6 +18,11 @@ StorageLibrary = function(ui, data, title)
|
|||
//Extends mxEventSource
|
||||
mxUtils.extend(StorageLibrary, StorageFile);
|
||||
|
||||
/**
|
||||
* A differentiator of the stored object type (file or lib)
|
||||
*/
|
||||
StorageLibrary.prototype.type = 'L';
|
||||
|
||||
/**
|
||||
* Translates this point by the given vector.
|
||||
*
|
||||
|
|
|
@ -34,6 +34,14 @@
|
|||
this.createVertexTemplateEntry('shape=dimension;direction=south;whiteSpace=wrap;html=1;align=left;points=[];verticalAlign=middle;labelBackgroundColor=#ffffff', 40, 100, 'Label', 'Horizontal Dimension', null, null, 'horizontal dimension measure distance unit'),
|
||||
this.createVertexTemplateEntry(s + 'window;',
|
||||
w, 10, '', 'Window', null, null, this.getTagsForStencil(gn, 'window', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'windowGlider;dx=0.25;',
|
||||
100, 10, '', 'Window, Glider', null, null, this.getTagsForStencil(gn, 'windowGlider', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'windowGarden;dx=0.25;',
|
||||
100, 20, '', 'Window, Garden', null, null, this.getTagsForStencil(gn, 'windowGarden', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'windowBow;strokeWidth=3;',
|
||||
100, 20, '', 'Window, Bow', null, null, this.getTagsForStencil(gn, 'windowBow', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'windowBay;strokeWidth=3;aspect=fixed;',
|
||||
100, 40, '', 'Window, Bay', null, null, this.getTagsForStencil(gn, 'windowBay', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'stairs;',
|
||||
300, 100, '', 'Stairs', null, null, this.getTagsForStencil(gn, 'stairs', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'stairs;direction=south;',
|
||||
|
@ -46,6 +54,30 @@
|
|||
80, 85, '', 'Door', null, null, this.getTagsForStencil(gn, 'doorRight', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'doorDouble;aspect=fixed;',
|
||||
160, 85, '', 'Door, Double', null, null, this.getTagsForStencil(gn, 'doorDouble', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'doorUneven;dx=0.5;',
|
||||
160, 85, '', 'Door, Uneven', null, null, this.getTagsForStencil(gn, 'doorUneven', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'doorOpposing;dx=0.5;',
|
||||
160, 165, '', 'Door, Opposing', null, null, this.getTagsForStencil(gn, 'doorOpposing', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'doorRevolving;aspect=fixed;',
|
||||
80, 85, '', 'Door, Revolving', null, null, this.getTagsForStencil(gn, 'doorLeft', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'doorPocket;dx=0.5;',
|
||||
104, 10, '', 'Door, Pocket', null, null, this.getTagsForStencil(gn, 'doorPocket', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'doorDoublePocket;dx=0.25;',
|
||||
104, 10, '', 'Door, Double Pocket', null, null, this.getTagsForStencil(gn, 'doorDoublePocket', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'doorBypass;dx=0.25;',
|
||||
104, 10, '', 'Door, By-pass', null, null, this.getTagsForStencil(gn, 'doorBypass', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'doorBifold;dx=0.3;',
|
||||
160, 40, '', 'Door, Bi-fold', null, null, this.getTagsForStencil(gn, 'doorBifold', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'doorSlidingGlass;dx=0.25;',
|
||||
104, 10, '', 'Door, SlidingGlass', null, null, this.getTagsForStencil(gn, 'doorSlidingGlass', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'doorOverhead;',
|
||||
104, 30, '', 'Door, Overhead', null, null, this.getTagsForStencil(gn, 'doorOverhead', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'doorAccordion;dx=0.6;',
|
||||
160, 30, '', 'Door, Accordion', null, null, this.getTagsForStencil(gn, 'accordion', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'doorDoubleAction;aspect=fixed;',
|
||||
80, 165, '', 'Door, Double Action', null, null, this.getTagsForStencil(gn, 'doorDoubleAction', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'opening;',
|
||||
50, 10, '', 'Opening', null, null, this.getTagsForStencil(gn, 'opening', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'bathtub;',
|
||||
180, 60, '', 'Bathtub', null, null, this.getTagsForStencil(gn, 'bathtub', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'bed_double;',
|
||||
|
|
|
@ -1239,6 +1239,15 @@ Actions.prototype.init = function()
|
|||
document.execCommand('superscript', false, null);
|
||||
}
|
||||
}), null, null, Editor.ctrlKey + '+.');
|
||||
action = this.addAction('indent', mxUtils.bind(this, function()
|
||||
{
|
||||
// NOTE: Alt+Tab for outdent implemented via special code in
|
||||
// keyHandler.getFunction in EditorUi.js. Ctrl+Tab is reserved.
|
||||
if (graph.cellEditor.isContentEditing())
|
||||
{
|
||||
document.execCommand('indent', false, null);
|
||||
}
|
||||
}), null, null, 'Shift+Tab');
|
||||
this.addAction('image...', function()
|
||||
{
|
||||
if (graph.isEnabled() && !graph.isCellLocked(graph.getDefaultParent()))
|
||||
|
@ -1335,7 +1344,7 @@ Actions.prototype.init = function()
|
|||
if (this.layersWindow == null)
|
||||
{
|
||||
// LATER: Check outline window for initial placement
|
||||
this.layersWindow = new LayersWindow(ui, document.body.offsetWidth - 280, 120, 220, 180);
|
||||
this.layersWindow = new LayersWindow(ui, document.body.offsetWidth - 280, 120, 220, 196);
|
||||
this.layersWindow.window.addListener('show', function()
|
||||
{
|
||||
ui.fireEvent(new mxEventObject('layers'));
|
||||
|
@ -1346,6 +1355,8 @@ Actions.prototype.init = function()
|
|||
});
|
||||
this.layersWindow.window.setVisible(true);
|
||||
ui.fireEvent(new mxEventObject('layers'));
|
||||
|
||||
this.layersWindow.init();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -2237,7 +2237,6 @@ var LayersWindow = function(editorUi, x, y, w, h)
|
|||
|
||||
var layerCount = null;
|
||||
var selectionLayer = null;
|
||||
|
||||
var ldiv = document.createElement('div');
|
||||
|
||||
ldiv.className = 'geToolbarContainer';
|
||||
|
@ -2468,7 +2467,6 @@ var LayersWindow = function(editorUi, x, y, w, h)
|
|||
}
|
||||
|
||||
ldiv.appendChild(addLink);
|
||||
|
||||
div.appendChild(ldiv);
|
||||
|
||||
function refresh()
|
||||
|
@ -2766,6 +2764,11 @@ var LayersWindow = function(editorUi, x, y, w, h)
|
|||
this.window.setClosable(true);
|
||||
this.window.setVisible(true);
|
||||
|
||||
this.init = function()
|
||||
{
|
||||
listDiv.scrollTop = listDiv.scrollHeight - listDiv.clientHeight;
|
||||
};
|
||||
|
||||
this.window.addListener(mxEvent.SHOW, mxUtils.bind(this, function()
|
||||
{
|
||||
this.window.fit();
|
||||
|
|
|
@ -644,7 +644,14 @@ Editor.prototype.createUndoManager = function()
|
|||
// Keeps the selection in sync with the history
|
||||
var undoHandler = function(sender, evt)
|
||||
{
|
||||
var cand = graph.getSelectionCellsForChanges(evt.getProperty('edit').changes);
|
||||
var cand = graph.getSelectionCellsForChanges(evt.getProperty('edit').changes, function(change)
|
||||
{
|
||||
// Only selects changes to the cell hierarchy
|
||||
return !(change instanceof mxChildChange);
|
||||
});
|
||||
|
||||
if (cand.length > 0)
|
||||
{
|
||||
var model = graph.getModel();
|
||||
var cells = [];
|
||||
|
||||
|
@ -657,6 +664,7 @@ Editor.prototype.createUndoManager = function()
|
|||
}
|
||||
|
||||
graph.setSelectionCells(cells);
|
||||
}
|
||||
};
|
||||
|
||||
undoMgr.addListener(mxEvent.UNDO, undoHandler);
|
||||
|
|
|
@ -1115,7 +1115,8 @@ EditorUi.prototype.onKeyDown = function(evt)
|
|||
var graph = this.editor.graph;
|
||||
|
||||
// Tab selects next cell
|
||||
if (evt.which == 9 && graph.isEnabled() && !mxEvent.isAltDown(evt))
|
||||
if (evt.which == 9 && graph.isEnabled() && !mxEvent.isAltDown(evt) &&
|
||||
(!graph.isEditing() || !mxEvent.isShiftDown(evt)))
|
||||
{
|
||||
if (graph.isEditing())
|
||||
{
|
||||
|
@ -4138,11 +4139,14 @@ EditorUi.prototype.createKeyHandler = function(editor)
|
|||
var isEventIgnored = keyHandler.isEventIgnored;
|
||||
keyHandler.isEventIgnored = function(evt)
|
||||
{
|
||||
// Handles undo/redo/ctrl+./,/u via action and allows ctrl+b/i only if editing value is HTML (except for FF and Safari)
|
||||
return (!this.isControlDown(evt) || mxEvent.isShiftDown(evt) || (evt.keyCode != 90 && evt.keyCode != 89 &&
|
||||
evt.keyCode != 188 && evt.keyCode != 190 && evt.keyCode != 85)) && ((evt.keyCode != 66 && evt.keyCode != 73) ||
|
||||
!this.isControlDown(evt) || (this.graph.cellEditor.isContentEditing() && !mxClient.IS_FF && !mxClient.IS_SF)) &&
|
||||
isEventIgnored.apply(this, arguments);
|
||||
// Handles undo/redo/ctrl+./,/u via action and allows ctrl+b/i
|
||||
// only if editing value is HTML (except for FF and Safari)
|
||||
return !(mxEvent.isShiftDown(evt) && evt.keyCode == 9) &&
|
||||
((!this.isControlDown(evt) || mxEvent.isShiftDown(evt) ||
|
||||
(evt.keyCode != 90 && evt.keyCode != 89 && evt.keyCode != 188 &&
|
||||
evt.keyCode != 190 && evt.keyCode != 85)) && ((evt.keyCode != 66 && evt.keyCode != 73) ||
|
||||
!this.isControlDown(evt) || (this.graph.cellEditor.isContentEditing() &&
|
||||
!mxClient.IS_FF && !mxClient.IS_SF)) && isEventIgnored.apply(this, arguments));
|
||||
};
|
||||
|
||||
// Ignores graph enabled state but not chromeless state
|
||||
|
@ -4347,7 +4351,15 @@ EditorUi.prototype.createKeyHandler = function(editor)
|
|||
|
||||
if (evt.keyCode == 9 && mxEvent.isAltDown(evt))
|
||||
{
|
||||
if (mxEvent.isShiftDown(evt))
|
||||
if (graph.cellEditor.isContentEditing())
|
||||
{
|
||||
// Alt+Shift+Tab while editing
|
||||
return function()
|
||||
{
|
||||
document.execCommand('outdent', false, null);
|
||||
};
|
||||
}
|
||||
else if (mxEvent.isShiftDown(evt))
|
||||
{
|
||||
// Alt+Shift+Tab
|
||||
return function()
|
||||
|
@ -4539,6 +4551,7 @@ EditorUi.prototype.createKeyHandler = function(editor)
|
|||
keyHandler.bindAction(85, true, 'ungroup', true); // Ctrl+Shift+U
|
||||
keyHandler.bindAction(190, true, 'superscript'); // Ctrl+.
|
||||
keyHandler.bindAction(188, true, 'subscript'); // Ctrl+,
|
||||
keyHandler.bindAction(9, false, 'indent', true); // Shift+Tab,
|
||||
keyHandler.bindKey(13, function() { if (graph.isEnabled()) { graph.startEditingAtCell(); }}); // Enter
|
||||
keyHandler.bindKey(113, function() { if (graph.isEnabled()) { graph.startEditingAtCell(); }}); // F2
|
||||
}
|
||||
|
|
|
@ -1490,15 +1490,19 @@ ArrangePanel.prototype.init = function()
|
|||
this.container.appendChild(this.addAngle(this.createPanel()));
|
||||
}
|
||||
|
||||
if (!ss.containsLabel && ss.edges.length == 0)
|
||||
if (!ss.containsLabel && ss.edges.length == 0 &&
|
||||
ss.style.shape != 'rectangle' &&
|
||||
ss.style.shape != 'label')
|
||||
{
|
||||
this.container.appendChild(this.addFlip(this.createPanel()));
|
||||
}
|
||||
|
||||
if (ss.vertices.length > 1)
|
||||
if (ss.vertices.length == 1 && ss.edges.length == 0 &&
|
||||
(graph.isTable(ss.vertices[0]) ||
|
||||
graph.isTableRow(ss.vertices[0]) ||
|
||||
graph.isTableCell(ss.vertices[0])))
|
||||
{
|
||||
this.container.appendChild(this.addAlign(this.createPanel()));
|
||||
this.container.appendChild(this.addDistribute(this.createPanel()));
|
||||
this.container.appendChild(this.addTable(this.createPanel()));
|
||||
}
|
||||
|
||||
this.container.appendChild(this.addGroupOps(this.createPanel()));
|
||||
|
@ -1518,6 +1522,111 @@ ArrangePanel.prototype.init = function()
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
ArrangePanel.prototype.addTable = function(div)
|
||||
{
|
||||
var ui = this.editorUi;
|
||||
var editor = ui.editor;
|
||||
var graph = editor.graph;
|
||||
var ss = this.format.getSelectionState();
|
||||
div.style.paddingTop = '6px';
|
||||
div.style.paddingBottom = '10px';
|
||||
|
||||
var span = document.createElement('div');
|
||||
span.style.marginTop = '2px';
|
||||
span.style.marginBottom = '8px';
|
||||
span.style.fontWeight = 'bold';
|
||||
mxUtils.write(span, mxResources.get('table'));
|
||||
div.appendChild(span);
|
||||
|
||||
var panel = document.createElement('div');
|
||||
panel.style.position = 'relative';
|
||||
panel.style.paddingLeft = '0px';
|
||||
panel.style.borderWidth = '0px';
|
||||
panel.className = 'geToolbarContainer';
|
||||
|
||||
var btns = [
|
||||
ui.toolbar.addButton('geSprite-insertcolumnbefore', mxResources.get('insertColumnBefore'),
|
||||
mxUtils.bind(this, function()
|
||||
{
|
||||
try
|
||||
{
|
||||
graph.insertTableColumn(ss.vertices[0], true);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
ui.handleError(e);
|
||||
}
|
||||
}), panel),
|
||||
ui.toolbar.addButton('geSprite-insertcolumnafter', mxResources.get('insertColumnAfter'),
|
||||
mxUtils.bind(this, function()
|
||||
{
|
||||
try
|
||||
{
|
||||
graph.insertTableColumn(ss.vertices[0], false);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
ui.handleError(e);
|
||||
}
|
||||
}), panel),
|
||||
ui.toolbar.addButton('geSprite-deletecolumn', mxResources.get('deleteColumn'),
|
||||
mxUtils.bind(this, function()
|
||||
{
|
||||
try
|
||||
{
|
||||
graph.deleteTableColumn(ss.vertices[0]);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
ui.handleError(e);
|
||||
}
|
||||
}), panel),
|
||||
ui.toolbar.addButton('geSprite-insertrowbefore', mxResources.get('insertRowBefore'),
|
||||
mxUtils.bind(this, function()
|
||||
{
|
||||
try
|
||||
{
|
||||
graph.insertTableRow(ss.vertices[0], true);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
ui.handleError(e);
|
||||
}
|
||||
}), panel),
|
||||
ui.toolbar.addButton('geSprite-insertrowafter', mxResources.get('insertRowAfter'),
|
||||
mxUtils.bind(this, function()
|
||||
{
|
||||
try
|
||||
{
|
||||
graph.insertTableRow(ss.vertices[0], false);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
ui.handleError(e);
|
||||
}
|
||||
}), panel),
|
||||
ui.toolbar.addButton('geSprite-deleterow', mxResources.get('deleteRow'),
|
||||
mxUtils.bind(this, function()
|
||||
{
|
||||
try
|
||||
{
|
||||
graph.deleteTableRow(ss.vertices[0]);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
ui.handleError(e);
|
||||
}
|
||||
}), panel)];
|
||||
this.styleButtons(btns);
|
||||
div.appendChild(panel);
|
||||
btns[2].style.marginRight = '9px';
|
||||
|
||||
return div;
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -1035,6 +1035,16 @@ Graph.lineJumpsEnabled = true;
|
|||
*/
|
||||
Graph.defaultJumpSize = 6;
|
||||
|
||||
/**
|
||||
* Minimum width for table columns.
|
||||
*/
|
||||
Graph.minTableColumnWidth = 20;
|
||||
|
||||
/**
|
||||
* Minimum height for table rows.
|
||||
*/
|
||||
Graph.minTableRowHeight = 20;
|
||||
|
||||
/**
|
||||
* Text for foreign object warning.
|
||||
*/
|
||||
|
@ -1866,16 +1876,25 @@ Graph.prototype.initLayoutManager = function()
|
|||
{
|
||||
this.layoutManager = new mxLayoutManager(this);
|
||||
|
||||
this.layoutManager.getLayout = function(cell)
|
||||
// Using shared instances for some layouts
|
||||
var organicLayout = new mxFastOrganicLayout(this);
|
||||
var stackLayout = new mxStackLayout(this, true);
|
||||
var treeLayout = new mxCompactTreeLayout(this);
|
||||
var circleLayout = new mxCircleLayout(this);
|
||||
var rowLayout = new TableRowLayout(this);
|
||||
var tableLayout = new TableLayout(this);
|
||||
|
||||
this.layoutManager.getLayout = function(cell, eventName)
|
||||
{
|
||||
// Workaround for possible invalid style after change and before view validation
|
||||
if (eventName != mxEvent.BEGIN_UPDATE)
|
||||
{
|
||||
var style = this.graph.getCellStyle(cell);
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
if (style['childLayout'] == 'stackLayout')
|
||||
{
|
||||
var stackLayout = new mxStackLayout(this.graph, true);
|
||||
stackLayout.resizeParentMax = mxUtils.getValue(style, 'resizeParentMax', '1') == '1';
|
||||
stackLayout.horizontal = mxUtils.getValue(style, 'horizontalStack', '1') == '1';
|
||||
stackLayout.resizeParent = mxUtils.getValue(style, 'resizeParent', '1') == '1';
|
||||
|
@ -1892,7 +1911,6 @@ Graph.prototype.initLayoutManager = function()
|
|||
}
|
||||
else if (style['childLayout'] == 'treeLayout')
|
||||
{
|
||||
var treeLayout = new mxCompactTreeLayout(this.graph);
|
||||
treeLayout.horizontal = mxUtils.getValue(style, 'horizontalTree', '1') == '1';
|
||||
treeLayout.resizeParent = mxUtils.getValue(style, 'resizeParent', '1') == '1';
|
||||
treeLayout.groupPadding = mxUtils.getValue(style, 'parentPadding', 20);
|
||||
|
@ -1912,20 +1930,33 @@ Graph.prototype.initLayoutManager = function()
|
|||
flowLayout.maintainParentLocation = true;
|
||||
|
||||
// Special undocumented styles for changing the hierarchical
|
||||
flowLayout.intraCellSpacing = mxUtils.getValue(style, 'intraCellSpacing', mxHierarchicalLayout.prototype.intraCellSpacing);
|
||||
flowLayout.interRankCellSpacing = mxUtils.getValue(style, 'interRankCellSpacing', mxHierarchicalLayout.prototype.interRankCellSpacing);
|
||||
flowLayout.interHierarchySpacing = mxUtils.getValue(style, 'interHierarchySpacing', mxHierarchicalLayout.prototype.interHierarchySpacing);
|
||||
flowLayout.parallelEdgeSpacing = mxUtils.getValue(style, 'parallelEdgeSpacing', mxHierarchicalLayout.prototype.parallelEdgeSpacing);
|
||||
flowLayout.intraCellSpacing = mxUtils.getValue(style, 'intraCellSpacing',
|
||||
mxHierarchicalLayout.prototype.intraCellSpacing);
|
||||
flowLayout.interRankCellSpacing = mxUtils.getValue(style, 'interRankCellSpacing',
|
||||
mxHierarchicalLayout.prototype.interRankCellSpacing);
|
||||
flowLayout.interHierarchySpacing = mxUtils.getValue(style, 'interHierarchySpacing',
|
||||
mxHierarchicalLayout.prototype.interHierarchySpacing);
|
||||
flowLayout.parallelEdgeSpacing = mxUtils.getValue(style, 'parallelEdgeSpacing',
|
||||
mxHierarchicalLayout.prototype.parallelEdgeSpacing);
|
||||
|
||||
return flowLayout;
|
||||
}
|
||||
else if (style['childLayout'] == 'circleLayout')
|
||||
{
|
||||
return new mxCircleLayout(this.graph);
|
||||
return circleLayout;
|
||||
}
|
||||
else if (style['childLayout'] == 'organicLayout')
|
||||
{
|
||||
return new mxFastOrganicLayout(this.graph);
|
||||
return organicLayout;
|
||||
}
|
||||
else if (this.graph.isTableRow(cell))
|
||||
{
|
||||
return rowLayout;
|
||||
}
|
||||
else if (this.graph.isTable(cell))
|
||||
{
|
||||
return tableLayout;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2913,7 +2944,8 @@ Graph.prototype.foldCells = function(collapse, recurse, cells, checkFoldable, ev
|
|||
this.moveSiblings(state, parent, dx, dy);
|
||||
}
|
||||
}
|
||||
else if ((evt == null || !mxEvent.isAltDown(evt)) && layout.constructor == mxStackLayout && !layout.resizeLast)
|
||||
else if ((evt == null || !mxEvent.isAltDown(evt)) &&
|
||||
layout.constructor == mxStackLayout && !layout.resizeLast)
|
||||
{
|
||||
this.resizeParentStacks(parent, layout, dx, dy);
|
||||
}
|
||||
|
@ -4240,6 +4272,459 @@ HoverIcons.prototype.setCurrentState = function(state)
|
|||
this.currentState = state;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if the given cell is a table cell.
|
||||
*/
|
||||
Graph.prototype.isTableCell = function(cell)
|
||||
{
|
||||
return this.isTableRow(this.model.getParent(cell));
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if the given cell is a table row.
|
||||
*/
|
||||
Graph.prototype.isTableRow = function(cell)
|
||||
{
|
||||
return this.isTable(this.model.getParent(cell));
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if the given cell is a table.
|
||||
*/
|
||||
Graph.prototype.isTable = function(cell)
|
||||
{
|
||||
var style = this.getCellStyle(cell);
|
||||
|
||||
return style != null && style['childLayout'] == 'tableLayout';
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates column width and row height.
|
||||
*/
|
||||
Graph.prototype.getActualStartSize = function(swimlane, ignoreState)
|
||||
{
|
||||
var result = new mxRectangle();
|
||||
var state = (ignoreState) ? null : this.view.getState(swimlane);
|
||||
var style = (state != null) ? state.style : this.getCellStyle(swimlane);
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
var size = parseInt(mxUtils.getValue(style,
|
||||
mxConstants.STYLE_STARTSIZE, mxConstants.DEFAULT_STARTSIZE));
|
||||
|
||||
var dir = mxUtils.getValue(style, mxConstants.STYLE_DIRECTION, mxConstants.DIRECTION_EAST);
|
||||
var flipH = mxUtils.getValue(style, mxConstants.STYLE_FLIPH, 0) == 1;
|
||||
var flipV = mxUtils.getValue(style, mxConstants.STYLE_FLIPV, 0) == 1;
|
||||
|
||||
if (mxUtils.getValue(style, mxConstants.STYLE_HORIZONTAL, true))
|
||||
{
|
||||
result.y = size;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.x = size;
|
||||
}
|
||||
|
||||
if (dir == mxConstants.DIRECTION_SOUTH || dir == mxConstants.DIRECTION_WEST)
|
||||
{
|
||||
var tmp = result.y;
|
||||
result.y = result.x;
|
||||
result.x = tmp;
|
||||
}
|
||||
|
||||
if (flipV)
|
||||
{
|
||||
result.height = result.y;
|
||||
result.y = 0;
|
||||
}
|
||||
|
||||
if (flipH)
|
||||
{
|
||||
result.width = result.x;
|
||||
result.x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates column width and row height.
|
||||
*/
|
||||
Graph.prototype.tableResized = function(table)
|
||||
{
|
||||
console.log('tableLayout.tableResized', table);
|
||||
var model = this.getModel();
|
||||
var rowCount = model.getChildCount(table);
|
||||
var tableGeo = this.getCellGeometry(table);
|
||||
|
||||
if (tableGeo != null && rowCount > 0)
|
||||
{
|
||||
var off = this.getActualStartSize(table);
|
||||
var y = off.y;
|
||||
|
||||
for (var i = 0; i < rowCount; i++)
|
||||
{
|
||||
var row = model.getChildAt(table, i);
|
||||
|
||||
if (row != null)
|
||||
{
|
||||
var rowGeo = this.getCellGeometry(row);
|
||||
|
||||
if (rowGeo != null)
|
||||
{
|
||||
if (i == rowCount - 1)
|
||||
{
|
||||
var newRowGeo = rowGeo.clone();
|
||||
newRowGeo.width = tableGeo.width;
|
||||
|
||||
if (y < tableGeo.height)
|
||||
{
|
||||
newRowGeo.height = tableGeo.height - y;
|
||||
}
|
||||
else if (y > tableGeo.height)
|
||||
{
|
||||
tableGeo.height = y + Graph.minTableRowHeight;
|
||||
newRowGeo.height = Graph.minTableRowHeight;
|
||||
}
|
||||
|
||||
model.setGeometry(row, newRowGeo);
|
||||
this.tableRowResized(row, newRowGeo, rowGeo);
|
||||
}
|
||||
|
||||
y += rowGeo.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates column width and row height.
|
||||
*/
|
||||
Graph.prototype.tableRowResized = function(row, bounds, prev)
|
||||
{
|
||||
console.log('tableLayout.tableRowResized', row);
|
||||
var model = this.getModel();
|
||||
var rowGeo = this.getCellGeometry(row);
|
||||
var cellCount = model.getChildCount(row);
|
||||
|
||||
if (rowGeo != null && cellCount > 0)
|
||||
{
|
||||
var off = this.getActualStartSize(row);
|
||||
var x = off.x;
|
||||
|
||||
for (var i = 0; i < cellCount; i++)
|
||||
{
|
||||
var cell = model.getChildAt(row, i);
|
||||
|
||||
if (cell != null)
|
||||
{
|
||||
var geo = this.getCellGeometry(cell);
|
||||
|
||||
if (geo != null)
|
||||
{
|
||||
if (i == cellCount - 1)
|
||||
{
|
||||
var newGeo = geo.clone();
|
||||
newGeo.height = rowGeo.height;
|
||||
|
||||
if (x < rowGeo.width)
|
||||
{
|
||||
newGeo.width = rowGeo.width - x;
|
||||
}
|
||||
else if (x > rowGeo.width)
|
||||
{
|
||||
rowGeo.width = x + Graph.minTableColumnWidth;
|
||||
newGeo.width = Graph.minTableColumnWidth;
|
||||
}
|
||||
|
||||
model.setGeometry(cell, newGeo);
|
||||
this.tableCellResized(cell, newGeo, geo);
|
||||
}
|
||||
|
||||
x += geo.width;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Updates previous row height if upper edge was moved
|
||||
var table = model.getParent(row);
|
||||
var index = table.getIndex(row);
|
||||
|
||||
if (bounds.y != prev.y && index > 0)
|
||||
{
|
||||
var previousRow = model.getChildAt(table, index - 1);
|
||||
var prg = this.getCellGeometry(previousRow);
|
||||
|
||||
if (prg != null)
|
||||
{
|
||||
prg = prg.clone();
|
||||
prg.height -= prev.y - bounds.y;
|
||||
model.setGeometry(previousRow, prg);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates column width and row height.
|
||||
*/
|
||||
Graph.prototype.tableCellResized = function(cell, bounds, prev)
|
||||
{
|
||||
console.log('tableLayout.tableCellResized', cell, bounds, prev);
|
||||
var geo = this.getCellGeometry(cell);
|
||||
|
||||
if (geo != null)
|
||||
{
|
||||
var model = this.getModel();
|
||||
var row = model.getParent(cell);
|
||||
var table = model.getParent(row);
|
||||
var index = row.getIndex(cell);
|
||||
|
||||
// Updates row height
|
||||
var rowGeo = this.getCellGeometry(row);
|
||||
|
||||
if (rowGeo != null)
|
||||
{
|
||||
rowGeo = rowGeo.clone();
|
||||
rowGeo.height = geo.height;
|
||||
model.setGeometry(row, rowGeo);
|
||||
}
|
||||
|
||||
// Updates column width
|
||||
var previousRow = null;
|
||||
|
||||
for (var i = 0; i < model.getChildCount(table); i++)
|
||||
{
|
||||
var currentRow = model.getChildAt(table, i);
|
||||
var child = model.getChildAt(currentRow, index);
|
||||
|
||||
if (cell != child)
|
||||
{
|
||||
var childGeo = this.getCellGeometry(child);
|
||||
|
||||
if (childGeo != null)
|
||||
{
|
||||
childGeo = childGeo.clone();
|
||||
childGeo.width = geo.width;
|
||||
model.setGeometry(child, childGeo);
|
||||
}
|
||||
}
|
||||
|
||||
// Updates previous row height
|
||||
if (bounds.y != prev.y && currentRow == row && previousRow != null)
|
||||
{
|
||||
var prg = this.getCellGeometry(previousRow);
|
||||
|
||||
if (prg != null)
|
||||
{
|
||||
prg = prg.clone();
|
||||
prg.height -= prev.y - bounds.y;
|
||||
model.setGeometry(previousRow, prg);
|
||||
}
|
||||
}
|
||||
|
||||
previousRow = currentRow;
|
||||
}
|
||||
|
||||
// Updates previous column width
|
||||
if (bounds.x != prev.x && index > 0)
|
||||
{
|
||||
var child = model.getChildAt(row, index - 1);
|
||||
var childGeo = this.getCellGeometry(child);
|
||||
|
||||
if (childGeo != null)
|
||||
{
|
||||
var newChildGeo = childGeo.clone();
|
||||
newChildGeo.width -= prev.x - bounds.x;
|
||||
model.setGeometry(child, newChildGeo);
|
||||
|
||||
this.tableCellResized(child, newChildGeo, childGeo);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Table Layout
|
||||
*/
|
||||
function TableLayout(graph)
|
||||
{
|
||||
mxGraphLayout.call(this, graph);
|
||||
};
|
||||
|
||||
/**
|
||||
* Extends mxGraphLayout
|
||||
*/
|
||||
TableLayout.prototype = new mxGraphLayout();
|
||||
TableLayout.prototype.constructor = TableLayout;
|
||||
|
||||
/**
|
||||
* Reorders rows.
|
||||
*/
|
||||
TableLayout.prototype.moveCell = function(cell, x, y)
|
||||
{
|
||||
// TODO: Reorder rows
|
||||
console.log('tableLayout.moveCell', cell, x, y);
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
TableLayout.prototype.resizeCell = function(cell, geo, prev)
|
||||
{
|
||||
if (this.graph.isTable(cell))
|
||||
{
|
||||
this.graph.tableResized(cell, geo, prev);
|
||||
}
|
||||
else if (this.graph.isTableRow(cell))
|
||||
{
|
||||
this.graph.tableRowResized(cell, geo, prev);
|
||||
}
|
||||
else if (this.graph.isTableCell(cell))
|
||||
{
|
||||
this.graph.tableCellResized(cell, geo, prev);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates column width and row height.
|
||||
*/
|
||||
TableLayout.prototype.execute = function(table)
|
||||
{
|
||||
var off = this.graph.getActualStartSize(table, true);
|
||||
var model = this.graph.getModel();
|
||||
var y = off.y;
|
||||
var x = 0;
|
||||
|
||||
for (var i = 0; i < model.getChildCount(table); i++)
|
||||
{
|
||||
var row = model.getChildAt(table, i);
|
||||
|
||||
// TODO: Get maximum row width
|
||||
if (row != null)
|
||||
{
|
||||
var rowGeo = this.graph.getCellGeometry(row);
|
||||
|
||||
if (rowGeo != null)
|
||||
{
|
||||
var rowOff = this.graph.getActualStartSize(row, true);
|
||||
x = rowOff.x;
|
||||
|
||||
for (var j = 0; j < model.getChildCount(row); j++)
|
||||
{
|
||||
var cell = model.getChildAt(row, j);
|
||||
|
||||
if (cell != null)
|
||||
{
|
||||
var geo = this.graph.getCellGeometry(cell);
|
||||
|
||||
if (geo != null)
|
||||
{
|
||||
geo = geo.clone();
|
||||
|
||||
geo.height = rowGeo.height;
|
||||
geo.x = x;
|
||||
geo.y = rowOff.y;
|
||||
model.setGeometry(cell, geo);
|
||||
|
||||
x += geo.width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rowGeo = rowGeo.clone();
|
||||
rowGeo.width = x;
|
||||
rowGeo.y = y;
|
||||
rowGeo.x = off.x;
|
||||
model.setGeometry(row, rowGeo);
|
||||
|
||||
y += rowGeo.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Updates table size
|
||||
var tableGeo = this.graph.getCellGeometry(table);
|
||||
|
||||
if (tableGeo != null)
|
||||
{
|
||||
tableGeo = tableGeo.clone();
|
||||
tableGeo.width = x + off.x;
|
||||
tableGeo.height = y + off.height;
|
||||
model.setGeometry(table, tableGeo);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Table Layout
|
||||
*/
|
||||
function TableRowLayout(graph)
|
||||
{
|
||||
mxGraphLayout.call(this, graph);
|
||||
};
|
||||
|
||||
/**
|
||||
* Extends mxGraphLayout
|
||||
*/
|
||||
TableRowLayout.prototype = new TableLayout();
|
||||
TableRowLayout.prototype.constructor = TableRowLayout;
|
||||
|
||||
/**
|
||||
* Reorders rows.
|
||||
*/
|
||||
TableRowLayout.prototype.moveCell = function(cell, x, y)
|
||||
{
|
||||
// TODO: Reorder columns
|
||||
console.log('TableRowLayout.moveCell', cell, x, y);
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates row start sizes.
|
||||
*/
|
||||
TableRowLayout.prototype.execute = function(row)
|
||||
{
|
||||
var off = this.graph.getActualStartSize(row, true);
|
||||
var style = this.graph.getCellStyle(row);
|
||||
var model = this.graph.getModel();
|
||||
var table = model.getParent(row);
|
||||
|
||||
if (style != null && table != null)
|
||||
{
|
||||
var size = parseInt(mxUtils.getValue(style,
|
||||
mxConstants.STYLE_STARTSIZE, mxConstants.DEFAULT_STARTSIZE));
|
||||
|
||||
model.beginUpdate();
|
||||
try
|
||||
{
|
||||
for (var i = 0; i < model.getChildCount(table); i++)
|
||||
{
|
||||
var current = model.getChildAt(table, i);
|
||||
|
||||
if (current != row)
|
||||
{
|
||||
var temp = this.graph.getActualStartSize(current);
|
||||
|
||||
// Checks if same side is offset
|
||||
if ((off.x > 0 && temp.x > 0) || (off.y > 0 && temp.y > 0) ||
|
||||
(off.width > 0 && temp.width > 0) ||
|
||||
(off.height > 0 && temp.height > 0))
|
||||
{
|
||||
this.graph.setCellStyles(
|
||||
mxConstants.STYLE_STARTSIZE,
|
||||
size, [current]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
model.endUpdate();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
(function()
|
||||
{
|
||||
/**
|
||||
|
@ -7184,6 +7669,256 @@ if (typeof mxVertexHandler != 'undefined')
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
Graph.prototype.insertTableColumn = function(cell, before)
|
||||
{
|
||||
var model = this.getModel();
|
||||
model.beginUpdate();
|
||||
|
||||
try
|
||||
{
|
||||
var table = cell;
|
||||
var index = 0;
|
||||
|
||||
if (this.isTableCell(cell))
|
||||
{
|
||||
var row = model.getParent(cell);
|
||||
table = model.getParent(row);
|
||||
index = row.getIndex(cell);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.isTableRow(cell))
|
||||
{
|
||||
table = model.getParent(cell);
|
||||
}
|
||||
|
||||
if (!before)
|
||||
{
|
||||
index = model.getChildCount(model.getChildAt(table, 0)) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < model.getChildCount(table); i++)
|
||||
{
|
||||
var row = model.getChildAt(table, i);
|
||||
var child = model.getChildAt(row, index);
|
||||
var clone = model.cloneCell(child);
|
||||
var geo = this.getCellGeometry(clone);
|
||||
clone.value = null;
|
||||
|
||||
if (geo != null)
|
||||
{
|
||||
geo.width = Graph.minTableColumnWidth;
|
||||
var rowGeo = this.getCellGeometry(row);
|
||||
|
||||
if (rowGeo != null)
|
||||
{
|
||||
geo.height = rowGeo.height;
|
||||
}
|
||||
}
|
||||
|
||||
model.add(row, clone, index + ((before) ? 0 : 1));
|
||||
}
|
||||
|
||||
var tableGeo = this.getCellGeometry(table);
|
||||
|
||||
if (tableGeo != null)
|
||||
{
|
||||
tableGeo = tableGeo.clone();
|
||||
tableGeo.width += Graph.minColumnWidth;
|
||||
|
||||
model.setGeometry(table, tableGeo);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
model.endUpdate();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
Graph.prototype.insertTableRow = function(cell, before)
|
||||
{
|
||||
var model = this.getModel();
|
||||
model.beginUpdate();
|
||||
|
||||
try
|
||||
{
|
||||
var table = cell;
|
||||
var index = 0;
|
||||
|
||||
if (this.isTableCell(cell))
|
||||
{
|
||||
var row = model.getParent(cell);
|
||||
table = model.getParent(row);
|
||||
index = table.getIndex(row);
|
||||
}
|
||||
else if (this.isTableRow(cell))
|
||||
{
|
||||
table = model.getParent(cell);
|
||||
index = table.getIndex(cell);
|
||||
}
|
||||
else if (!before)
|
||||
{
|
||||
index = model.getChildCount(table) - 1;
|
||||
}
|
||||
|
||||
var row = model.cloneCell(model.getChildAt(table, index));
|
||||
row.value = null;
|
||||
|
||||
var rowGeo = this.getCellGeometry(row);
|
||||
|
||||
if (rowGeo != null)
|
||||
{
|
||||
rowGeo.height = Graph.minTableRowHeight;
|
||||
|
||||
for (var i = 0; i < model.getChildCount(row); i++)
|
||||
{
|
||||
var cell = model.getChildAt(row, i);
|
||||
cell.value = null;
|
||||
|
||||
var geo = this.getCellGeometry(cell);
|
||||
|
||||
if (geo != null)
|
||||
{
|
||||
geo.height = rowGeo.height;
|
||||
}
|
||||
}
|
||||
|
||||
model.add(table, row, index + ((before) ? 0 : 1));
|
||||
|
||||
var tableGeo = this.getCellGeometry(table);
|
||||
|
||||
if (tableGeo != null)
|
||||
{
|
||||
tableGeo = tableGeo.clone();
|
||||
tableGeo.height += rowGeo.height;
|
||||
|
||||
model.setGeometry(table, tableGeo);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
model.endUpdate();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
Graph.prototype.deleteTableColumn = function(cell)
|
||||
{
|
||||
var model = this.getModel();
|
||||
model.beginUpdate();
|
||||
|
||||
try
|
||||
{
|
||||
var table = cell;
|
||||
var index = 0;
|
||||
|
||||
if (this.isTableCell(cell))
|
||||
{
|
||||
var row = model.getParent(cell);
|
||||
table = model.getParent(row);
|
||||
index = row.getIndex(cell);
|
||||
}
|
||||
else if (this.isTableRow(cell))
|
||||
{
|
||||
table = model.getParent(cell);
|
||||
index = model.getChildCount(cell) - 1;
|
||||
}
|
||||
else if (this.isTable(cell))
|
||||
{
|
||||
index = model.getChildCount(model.getChildAt(cell, 0)) - 1;
|
||||
}
|
||||
|
||||
var width = 0;
|
||||
|
||||
for (var i = 0; i < model.getChildCount(table); i++)
|
||||
{
|
||||
var row = model.getChildAt(table, i);
|
||||
var child = model.getChildAt(row, index);
|
||||
model.remove(child);
|
||||
|
||||
var geo = this.getCellGeometry(child);
|
||||
|
||||
if (geo != null)
|
||||
{
|
||||
width = Math.max(width, geo.width);
|
||||
}
|
||||
}
|
||||
|
||||
var tableGeo = this.getCellGeometry(table);
|
||||
|
||||
if (tableGeo != null)
|
||||
{
|
||||
tableGeo = tableGeo.clone();
|
||||
tableGeo.width -= width;
|
||||
|
||||
model.setGeometry(table, tableGeo);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
model.endUpdate();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
Graph.prototype.deleteTableRow = function(cell)
|
||||
{
|
||||
var model = this.getModel();
|
||||
model.beginUpdate();
|
||||
|
||||
try
|
||||
{
|
||||
var row = cell;
|
||||
|
||||
if (this.isTableCell(cell))
|
||||
{
|
||||
row = model.getParent(cell);
|
||||
}
|
||||
else if (this.isTable(cell))
|
||||
{
|
||||
row = model.getChildAt(cell,
|
||||
model.getChildCount(cell) - 1);
|
||||
}
|
||||
|
||||
var table = model.getParent(row);
|
||||
model.remove(row);
|
||||
var height = 0;
|
||||
|
||||
var geo = this.getCellGeometry(row);
|
||||
|
||||
if (geo != null)
|
||||
{
|
||||
height = geo.height;
|
||||
}
|
||||
|
||||
var tableGeo = this.getCellGeometry(table);
|
||||
|
||||
if (tableGeo != null)
|
||||
{
|
||||
tableGeo = tableGeo.clone();
|
||||
tableGeo.height -= height;
|
||||
|
||||
model.setGeometry(table, tableGeo);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
model.endUpdate();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Inserts a new row into the given table.
|
||||
*/
|
||||
|
|
40
src/main/webapp/js/shapes.min.js
vendored
40
src/main/webapp/js/shapes.min.js
vendored
|
@ -2178,7 +2178,45 @@ function mxFloorplanDoorLeft(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill
|
|||
mxFloorplanDoorLeft.prototype.background=function(a,d,e,b,c){a.rect(0,0,b,5);a.fillAndStroke();a.begin();a.moveTo(b,5);a.arcTo(b,b,0,0,1,0,5+b);a.lineTo(0,5);a.stroke()};mxCellRenderer.registerShape(mxFloorplanDoorLeft.prototype.cst.DOOR_LEFT,mxFloorplanDoorLeft);function mxFloorplanDoorRight(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1}mxUtils.extend(mxFloorplanDoorRight,mxShape);mxFloorplanDoorRight.prototype.cst={DOOR_RIGHT:"mxgraph.floorplan.doorRight"};
|
||||
mxFloorplanDoorRight.prototype.paintVertexShape=function(a,d,e,b,c){a.translate(d,e);this.background(a,d,e,b,c)};mxFloorplanDoorRight.prototype.background=function(a,d,e,b,c){a.rect(0,0,b,5);a.fillAndStroke();a.begin();a.moveTo(0,5);a.arcTo(b,b,0,0,0,b,5+b);a.lineTo(b,5);a.stroke()};mxCellRenderer.registerShape(mxFloorplanDoorRight.prototype.cst.DOOR_RIGHT,mxFloorplanDoorRight);
|
||||
function mxFloorplanDoorDouble(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1}mxUtils.extend(mxFloorplanDoorDouble,mxShape);mxFloorplanDoorDouble.prototype.cst={DOOR_DOUBLE:"mxgraph.floorplan.doorDouble"};mxFloorplanDoorDouble.prototype.paintVertexShape=function(a,d,e,b,c){a.translate(d,e);this.background(a,d,e,b,c)};
|
||||
mxFloorplanDoorDouble.prototype.background=function(a,d,e,b,c){d=.5*b;a.rect(0,0,b,5);a.fillAndStroke();a.begin();a.moveTo(d,0);a.lineTo(d,5);a.moveTo(d,5);a.arcTo(d,d,0,0,1,0,5+d);a.lineTo(0,5);a.moveTo(d,5);a.arcTo(d,d,0,0,0,b,5+d);a.lineTo(b,5);a.stroke()};mxCellRenderer.registerShape(mxFloorplanDoorDouble.prototype.cst.DOOR_DOUBLE,mxFloorplanDoorDouble);
|
||||
mxFloorplanDoorDouble.prototype.background=function(a,d,e,b,c){d=.5*b;a.rect(0,0,b,5);a.fillAndStroke();a.begin();a.moveTo(d,0);a.lineTo(d,5);a.moveTo(d,5);a.arcTo(d,d,0,0,1,0,5+d);a.lineTo(0,5);a.moveTo(d,5);a.arcTo(d,d,0,0,0,b,5+d);a.lineTo(b,5);a.stroke()};mxCellRenderer.registerShape(mxFloorplanDoorDouble.prototype.cst.DOOR_DOUBLE,mxFloorplanDoorDouble);function mxFloorplanDoorUneven(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1;this.dx=.3}
|
||||
mxUtils.extend(mxFloorplanDoorUneven,mxShape);mxFloorplanDoorUneven.prototype.customProperties=[{name:"dx",dispName:"Door size",type:"float",min:0,max:1,defVal:.3}];mxFloorplanDoorUneven.prototype.cst={DOOR_UNEVEN:"mxgraph.floorplan.doorUneven"};mxFloorplanDoorUneven.prototype.paintVertexShape=function(a,d,e,b,c){a.translate(d,e);this.background(a,d,e,b,c)};
|
||||
mxFloorplanDoorUneven.prototype.background=function(a,d,e,b,c){d=b*Math.max(0,Math.min(b,parseFloat(mxUtils.getValue(this.style,"dx",this.dx))));a.rect(0,0,b,5);a.fillAndStroke();a.begin();a.moveTo(d,0);a.lineTo(d,5);a.arcTo(d,d,0,0,1,0,5+d);a.lineTo(0,5);a.moveTo(d,5);a.arcTo(b-d,b-d,0,0,0,b,5+b-d);a.lineTo(b,5);a.stroke()};mxCellRenderer.registerShape(mxFloorplanDoorUneven.prototype.cst.DOOR_UNEVEN,mxFloorplanDoorUneven);
|
||||
Graph.handleFactory[mxFloorplanDoorUneven.prototype.cst.DOOR_UNEVEN]=function(a){return[Graph.createHandle(a,["dx"],function(a){var d=Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.state.style,"dx",this.dx))));return new mxPoint(a.x+d*a.width,a.y+5)},function(a,e){this.state.style.dx=Math.round(100*Math.max(0,Math.min(1,(e.x-a.x)/a.width)))/100})]};function mxFloorplanDoorOpposing(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1;this.dx=.3}
|
||||
mxUtils.extend(mxFloorplanDoorOpposing,mxShape);mxFloorplanDoorOpposing.prototype.customProperties=[{name:"dx",dispName:"Door size",type:"float",min:0,max:1,defVal:.3}];mxFloorplanDoorOpposing.prototype.cst={DOOR_OPPOSING:"mxgraph.floorplan.doorOpposing"};mxFloorplanDoorOpposing.prototype.paintVertexShape=function(a,d,e,b,c){a.translate(d,e);this.background(a,d,e,b,c)};
|
||||
mxFloorplanDoorOpposing.prototype.background=function(a,d,e,b,c){d=b*Math.max(0,Math.min(b,parseFloat(mxUtils.getValue(this.style,"dx",this.dx))));a.rect(0,d,b,5);a.fillAndStroke();a.begin();a.moveTo(d,d);a.lineTo(d,d+5);a.arcTo(d,d,0,0,0,0,0);a.lineTo(0,d);a.moveTo(d,d+5);a.arcTo(b-d,b-d,0,0,0,b,5+b);a.lineTo(b,d+5);a.stroke()};mxCellRenderer.registerShape(mxFloorplanDoorOpposing.prototype.cst.DOOR_OPPOSING,mxFloorplanDoorOpposing);
|
||||
Graph.handleFactory[mxFloorplanDoorOpposing.prototype.cst.DOOR_OPPOSING]=function(a){return[Graph.createHandle(a,["dx"],function(a){var d=Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.state.style,"dx",this.dx))));return new mxPoint(a.x+d*a.width,a.y+5)},function(a,e){this.state.style.dx=Math.round(100*Math.max(0,Math.min(1,(e.x-a.x)/a.width)))/100})]};function mxFloorplanDoorRevolving(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1}
|
||||
mxUtils.extend(mxFloorplanDoorRevolving,mxShape);mxFloorplanDoorRevolving.prototype.cst={DOOR_REVOLVING:"mxgraph.floorplan.doorRevolving"};mxFloorplanDoorRevolving.prototype.paintVertexShape=function(a,d,e,b,c){a.translate(d,e);this.background(a,d,e,b,c)};mxFloorplanDoorRevolving.prototype.background=function(a,d,e,b,c){d=Math.min(b,c);a.rect(.5*(b-d),.5*c-2.5,d,5);a.fillAndStroke();a.rect(.5*b-2.5,.5*(c-d),5,d);a.fillAndStroke();a.begin();a.ellipse(.5*(b-d),.5*(c-d),d,d);a.stroke()};
|
||||
mxCellRenderer.registerShape(mxFloorplanDoorRevolving.prototype.cst.DOOR_REVOLVING,mxFloorplanDoorRevolving);function mxFloorplanDoorPocket(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1;this.dx=.5}mxUtils.extend(mxFloorplanDoorPocket,mxShape);mxFloorplanDoorPocket.prototype.customProperties=[{name:"dx",dispName:"Door size",type:"float",min:0,max:1,defVal:.3}];mxFloorplanDoorPocket.prototype.cst={DOOR_POCKET:"mxgraph.floorplan.doorPocket"};
|
||||
mxFloorplanDoorPocket.prototype.paintVertexShape=function(a,d,e,b,c){var f=b*Math.max(0,Math.min(b,parseFloat(mxUtils.getValue(this.style,"dx",this.dx))));a.translate(d,e);a.rect(f,.5*c-5,5,10);a.fillAndStroke();a.rect(b-5,.5*c-5,5,10);a.fillAndStroke();a.rect(0,.5*c-2.5,b-f,5);a.fillAndStroke()};mxCellRenderer.registerShape(mxFloorplanDoorPocket.prototype.cst.DOOR_POCKET,mxFloorplanDoorPocket);
|
||||
Graph.handleFactory[mxFloorplanDoorPocket.prototype.cst.DOOR_POCKET]=function(a){return[Graph.createHandle(a,["dx"],function(a){var d=Math.max(0,Math.min(.5,parseFloat(mxUtils.getValue(this.state.style,"dx",this.dx))));return new mxPoint(a.x+d*a.width,a.y+5)},function(a,e){this.state.style.dx=Math.round(100*Math.max(0,Math.min(.5,(e.x-a.x)/a.width)))/100})]};
|
||||
function mxFloorplanDoorDoublePocket(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1;this.dx=.5}mxUtils.extend(mxFloorplanDoorDoublePocket,mxShape);mxFloorplanDoorDoublePocket.prototype.customProperties=[{name:"dx",dispName:"Door size",type:"float",min:0,max:1,defVal:.3}];mxFloorplanDoorDoublePocket.prototype.cst={DOOR_DOUBLE_POCKET:"mxgraph.floorplan.doorDoublePocket"};
|
||||
mxFloorplanDoorDoublePocket.prototype.paintVertexShape=function(a,d,e,b,c){var f=b*Math.max(0,Math.min(b,parseFloat(mxUtils.getValue(this.style,"dx",this.dx))));a.translate(d,e);a.rect(f,.5*c-5,5,10);a.fillAndStroke();a.rect(b-f-5,.5*c-5,5,10);a.fillAndStroke();a.rect(0,.5*c-2.5,.5*b-f,5);a.fillAndStroke();a.rect(.5*b+f,.5*c-2.5,.5*b-f,5);a.fillAndStroke()};mxCellRenderer.registerShape(mxFloorplanDoorDoublePocket.prototype.cst.DOOR_DOUBLE_POCKET,mxFloorplanDoorDoublePocket);
|
||||
Graph.handleFactory[mxFloorplanDoorDoublePocket.prototype.cst.DOOR_DOUBLE_POCKET]=function(a){return[Graph.createHandle(a,["dx"],function(a){var d=Math.max(0,Math.min(.25,parseFloat(mxUtils.getValue(this.state.style,"dx",this.dx))));return new mxPoint(a.x+d*a.width,a.y+5)},function(a,e){this.state.style.dx=Math.round(100*Math.max(0,Math.min(.25,(e.x-a.x)/a.width)))/100})]};
|
||||
function mxFloorplanDoorBypass(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1;this.dx=.5}mxUtils.extend(mxFloorplanDoorBypass,mxShape);mxFloorplanDoorBypass.prototype.customProperties=[{name:"dx",dispName:"Door size",type:"float",min:0,max:1,defVal:.3}];mxFloorplanDoorBypass.prototype.cst={DOOR_BYPASS:"mxgraph.floorplan.doorBypass"};
|
||||
mxFloorplanDoorBypass.prototype.paintVertexShape=function(a,d,e,b,c){var f=b*Math.max(0,Math.min(b,parseFloat(mxUtils.getValue(this.style,"dx",this.dx))));a.translate(d,e);a.rect(0,.5*c-5,5,10);a.fillAndStroke();a.rect(b-5,.5*c-5,5,10);a.fillAndStroke();a.rect(0,.5*c,.5*b,5);a.fillAndStroke();a.rect(f,.5*c-5,.5*b,5);a.fillAndStroke()};mxCellRenderer.registerShape(mxFloorplanDoorBypass.prototype.cst.DOOR_BYPASS,mxFloorplanDoorBypass);
|
||||
Graph.handleFactory[mxFloorplanDoorBypass.prototype.cst.DOOR_BYPASS]=function(a){return[Graph.createHandle(a,["dx"],function(a){var d=Math.max(0,Math.min(.5,parseFloat(mxUtils.getValue(this.state.style,"dx",this.dx))));return new mxPoint(a.x+d*a.width,a.y+5)},function(a,e){this.state.style.dx=Math.round(100*Math.max(0,Math.min(.5,(e.x-a.x)/a.width)))/100})]};function mxFloorplanDoorBifold(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1;this.dx=.5}
|
||||
mxUtils.extend(mxFloorplanDoorBifold,mxShape);mxFloorplanDoorBifold.prototype.customProperties=[{name:"dx",dispName:"Door size",type:"float",min:0,max:1,defVal:.3}];mxFloorplanDoorBifold.prototype.cst={DOOR_BIFOLD:"mxgraph.floorplan.doorBifold"};
|
||||
mxFloorplanDoorBifold.prototype.paintVertexShape=function(a,d,e,b,c){var f=b*Math.max(0,Math.min(b,parseFloat(mxUtils.getValue(this.style,"dx",this.dx)))),g=parseFloat(mxUtils.getValue(this.style,"strokeWidth",this.dx));a.translate(d,e);a.rect(0,c-10,5,10);a.fillAndStroke();a.rect(b-5,c-10,5,10);a.fillAndStroke();a.setStrokeWidth(3*g);a.begin();a.moveTo(5,c-10);a.lineTo(Math.max(.5*(f-10)+5,5),0);a.lineTo(Math.max(f,5),c-10);a.moveTo(b-5,c-10);a.lineTo(b-Math.max(.5*(f-10)+5,5),0);a.lineTo(b-Math.max(f,
|
||||
5),c-10);a.stroke()};mxCellRenderer.registerShape(mxFloorplanDoorBifold.prototype.cst.DOOR_BIFOLD,mxFloorplanDoorBifold);Graph.handleFactory[mxFloorplanDoorBifold.prototype.cst.DOOR_BIFOLD]=function(a){return[Graph.createHandle(a,["dx"],function(a){var d=Math.max(0,Math.min(.5,parseFloat(mxUtils.getValue(this.state.style,"dx",this.dx))));return new mxPoint(a.x+d*a.width,a.y+5)},function(a,e){this.state.style.dx=Math.round(100*Math.max(0,Math.min(.5,(e.x-a.x)/a.width)))/100})]};
|
||||
function mxFloorplanDoorSlidingGlass(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1;this.dx=.5}mxUtils.extend(mxFloorplanDoorSlidingGlass,mxShape);mxFloorplanDoorSlidingGlass.prototype.customProperties=[{name:"dx",dispName:"Door size",type:"float",min:0,max:1,defVal:.3}];mxFloorplanDoorSlidingGlass.prototype.cst={DOOR_SLIDING_GLASS:"mxgraph.floorplan.doorSlidingGlass"};
|
||||
mxFloorplanDoorSlidingGlass.prototype.paintVertexShape=function(a,d,e,b,c){var f=b*Math.max(0,Math.min(b,parseFloat(mxUtils.getValue(this.style,"dx",this.dx))));a.translate(d,e);a.rect(0,.5*c-5,5,10);a.fillAndStroke();a.rect(b-5,.5*c-5,5,10);a.fillAndStroke();a.rect(0,.5*c,.5*b,2);a.fillAndStroke();a.rect(f,.5*c-2,.5*b,2);a.fillAndStroke()};mxCellRenderer.registerShape(mxFloorplanDoorSlidingGlass.prototype.cst.DOOR_SLIDING_GLASS,mxFloorplanDoorSlidingGlass);
|
||||
Graph.handleFactory[mxFloorplanDoorSlidingGlass.prototype.cst.DOOR_SLIDING_GLASS]=function(a){return[Graph.createHandle(a,["dx"],function(a){var d=Math.max(0,Math.min(.5,parseFloat(mxUtils.getValue(this.state.style,"dx",this.dx))));return new mxPoint(a.x+d*a.width,a.y+5)},function(a,e){this.state.style.dx=Math.round(100*Math.max(0,Math.min(.5,(e.x-a.x)/a.width)))/100})]};
|
||||
function mxFloorplanOverhead(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1;this.dx=.5}mxUtils.extend(mxFloorplanOverhead,mxShape);mxFloorplanOverhead.prototype.cst={DOOR_OVERHEAD:"mxgraph.floorplan.doorOverhead"};mxFloorplanOverhead.prototype.paintVertexShape=function(a,d,e,b,c){a.translate(d,e);a.rect(0,c-10,5,10);a.fillAndStroke();a.rect(b-5,c-10,5,10);a.fillAndStroke();a.rect(5,0,b-10,c-5);a.fillAndStroke()};
|
||||
mxCellRenderer.registerShape(mxFloorplanOverhead.prototype.cst.DOOR_OVERHEAD,mxFloorplanOverhead);function mxFloorplanOpening(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1;this.dx=.5}mxUtils.extend(mxFloorplanOpening,mxShape);mxFloorplanOpening.prototype.cst={OPENING:"mxgraph.floorplan.opening"};mxFloorplanOpening.prototype.paintVertexShape=function(a,d,e,b,c){a.translate(d,e);a.rect(0,0,5,c);a.fillAndStroke();a.rect(b-5,0,5,c);a.fillAndStroke()};
|
||||
mxCellRenderer.registerShape(mxFloorplanOpening.prototype.cst.OPENING,mxFloorplanOpening);function mxFloorplanWindowGlider(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1;this.dx=.5}mxUtils.extend(mxFloorplanWindowGlider,mxShape);mxFloorplanWindowGlider.prototype.customProperties=[{name:"dx",dispName:"Window size",type:"float",min:0,max:1,defVal:.3}];mxFloorplanWindowGlider.prototype.cst={WINDOW_GLIDER:"mxgraph.floorplan.windowGlider"};
|
||||
mxFloorplanWindowGlider.prototype.paintVertexShape=function(a,d,e,b,c){var f=b*Math.max(0,Math.min(b,parseFloat(mxUtils.getValue(this.style,"dx",this.dx))));a.translate(d,e);a.rect(0,.5*c-5,b,10);a.fillAndStroke();a.rect(0,.5*c,.5*b,1);a.fillAndStroke();a.rect(f,.5*c-1,.5*b,1);a.fillAndStroke()};mxCellRenderer.registerShape(mxFloorplanWindowGlider.prototype.cst.WINDOW_GLIDER,mxFloorplanWindowGlider);
|
||||
Graph.handleFactory[mxFloorplanWindowGlider.prototype.cst.WINDOW_GLIDER]=function(a){return[Graph.createHandle(a,["dx"],function(a){var d=Math.max(0,Math.min(.5,parseFloat(mxUtils.getValue(this.state.style,"dx",this.dx))));return new mxPoint(a.x+d*a.width,a.y+5)},function(a,e){this.state.style.dx=Math.round(100*Math.max(0,Math.min(.5,(e.x-a.x)/a.width)))/100})]};
|
||||
function mxFloorplanWindowGarden(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1;this.windowPanes=3}mxUtils.extend(mxFloorplanWindowGarden,mxShape);mxFloorplanWindowGarden.prototype.customProperties=[{name:"windowPanes",dispName:"Panes",type:"int",min:0,max:20,defVal:3}];mxFloorplanWindowGarden.prototype.cst={WINDOW_GARDEN:"mxgraph.floorplan.windowGarden"};
|
||||
mxFloorplanWindowGarden.prototype.paintVertexShape=function(a,d,e,b,c){var f=Math.min(mxUtils.getValue(this.style,"windowPanes",this.windowPanes),20),g=(b-14-2*(f-1))/f;a.translate(d,e);a.rect(0,c-10,5,10);a.fillAndStroke();a.rect(b-5,c-10,5,10);a.fillAndStroke();a.begin();a.moveTo(5,c);a.lineTo(5,0);a.lineTo(b-5,0);a.lineTo(b-5,c);a.lineTo(b-5-2,c);a.lineTo(b-5-2,2);for(d=1;d<f;d++)a.lineTo(b-5-2-d*g-2*(d-1),2),a.lineTo(b-5-2-d*g-2*(d-1),c),a.lineTo(b-5-4-2*(d-1)-d*g,c),a.lineTo(b-5-4-2*(d-1)-d*
|
||||
g,2);a.lineTo(7,2);a.lineTo(7,c);a.close();a.fillAndStroke()};mxCellRenderer.registerShape(mxFloorplanWindowGarden.prototype.cst.WINDOW_GARDEN,mxFloorplanWindowGarden);function mxFloorplanWindowBow(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1;this.windowPanes=3}mxUtils.extend(mxFloorplanWindowBow,mxShape);mxFloorplanWindowBow.prototype.cst={WINDOW_BOW:"mxgraph.floorplan.windowBow"};
|
||||
mxFloorplanWindowBow.prototype.paintVertexShape=function(a,d,e,b,c){a.translate(d,e);d=Math.min(.5*b,c);a.begin();a.moveTo(0,.5*(c-d));a.lineTo(d,.5*(c+d));a.lineTo(b-d,.5*(c+d));a.lineTo(b,.5*(c-d));a.stroke()};mxCellRenderer.registerShape(mxFloorplanWindowBow.prototype.cst.WINDOW_BOW,mxFloorplanWindowBow);function mxFloorplanWindowBay(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1;this.windowPanes=3}mxUtils.extend(mxFloorplanWindowBay,mxShape);
|
||||
mxFloorplanWindowBay.prototype.cst={WINDOW_BAY:"mxgraph.floorplan.windowBay"};mxFloorplanWindowBay.prototype.paintVertexShape=function(a,d,e,b,c){a.translate(d,e);a.begin();a.moveTo(0,0);a.lineTo(.15*b,.6*c);a.lineTo(.35*b,c);a.lineTo(.65*b,c);a.lineTo(.85*b,.6*c);a.lineTo(b,0);a.stroke()};mxCellRenderer.registerShape(mxFloorplanWindowBay.prototype.cst.WINDOW_BAY,mxFloorplanWindowBay);
|
||||
function mxFloorplanDoorAccordion(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1;this.dx=.5}mxUtils.extend(mxFloorplanDoorAccordion,mxShape);mxFloorplanDoorAccordion.prototype.customProperties=[{name:"dx",dispName:"Door size",type:"float",min:0,max:1,defVal:.3}];mxFloorplanDoorAccordion.prototype.cst={DOOR_ACCORDION:"mxgraph.floorplan.doorAccordion"};
|
||||
mxFloorplanDoorAccordion.prototype.paintVertexShape=function(a,d,e,b,c){var f=b*Math.max(0,Math.min(b,parseFloat(mxUtils.getValue(this.style,"dx",this.dx)))),f=Math.max(5,f),f=Math.min(b-5,f),g=parseFloat(mxUtils.getValue(this.style,"strokeWidth",this.dx));a.translate(d,e);a.rect(0,.5*c-5,5,10);a.fillAndStroke();a.rect(b-5,.5*c-5,5,10);a.fillAndStroke();a.setStrokeWidth(3*g);d=f-5;a.begin();a.moveTo(5,.5*c);a.lineTo(5+.1*d,0);a.lineTo(5+.3*d,c);a.lineTo(5+.5*d,0);a.lineTo(5+.7*d,c);a.lineTo(5+.9*
|
||||
d,0);a.lineTo(5+d,.5*c);a.stroke()};mxCellRenderer.registerShape(mxFloorplanDoorAccordion.prototype.cst.DOOR_ACCORDION,mxFloorplanDoorAccordion);
|
||||
Graph.handleFactory[mxFloorplanDoorAccordion.prototype.cst.DOOR_ACCORDION]=function(a){return[Graph.createHandle(a,["dx"],function(a){var d=Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.state.style,"dx",this.dx))));return new mxPoint(a.x+d*a.width,a.y+5)},function(a,e){this.state.style.dx=Math.round(100*Math.max(0,Math.min(1,(e.x-a.x)/a.width)))/100})]};function mxFloorplanDoorDoubleAction(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1}
|
||||
mxUtils.extend(mxFloorplanDoorDoubleAction,mxShape);mxFloorplanDoorDoubleAction.prototype.cst={DOOR_DOUBLE_ACTION:"mxgraph.floorplan.doorDoubleAction"};mxFloorplanDoorDoubleAction.prototype.paintVertexShape=function(a,d,e,b,c){a.translate(d,e);this.background(a,d,e,b,c)};
|
||||
mxFloorplanDoorDoubleAction.prototype.background=function(a,d,e,b,c){a.rect(0,.5*c-2.5,b,5);a.fillAndStroke();a.begin();a.moveTo(b,.5*c+2.5);a.arcTo(b,b,0,0,1,0,.5*c+2.5+b);a.lineTo(0,.5*c+2.5);a.stroke();a.setDashed(!0);a.begin();a.moveTo(b,.5*c-2.5);a.arcTo(b,b,0,0,0,0,.5*c-2.5-b);a.lineTo(0,.5*c-2.5);a.stroke()};mxCellRenderer.registerShape(mxFloorplanDoorDoubleAction.prototype.cst.DOOR_DOUBLE_ACTION,mxFloorplanDoorDoubleAction);
|
||||
function mxShapeFlowchartDocument2(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1;this.size=.5}mxUtils.extend(mxShapeFlowchartDocument2,mxActor);mxShapeFlowchartDocument2.prototype.cst={DOCUMENT2:"mxgraph.flowchart.document2"};mxShapeFlowchartDocument2.prototype.customProperties=[{name:"size",dispName:"Wave Size",type:"float",min:0,max:1,defVal:.25}];
|
||||
mxShapeFlowchartDocument2.prototype.paintVertexShape=function(a,d,e,b,c){a.translate(d,e);d=c*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,"size",this.size))));a.begin();a.moveTo(b-5,0);a.arcTo(5,5,0,0,1,b,5);a.lineTo(b,c-d/2);a.quadTo(3*b/4,c-1.4*d,b/2,c-d/2);a.quadTo(b/4,c-d*(1-1.4),0,c-d/2);a.lineTo(0,d/2);a.lineTo(0,5);a.arcTo(5,5,0,0,1,5,0);a.close();a.fillAndStroke()};mxCellRenderer.registerShape(mxShapeFlowchartDocument2.prototype.cst.DOCUMENT2,mxShapeFlowchartDocument2);
|
||||
mxShapeFlowchartDocument2.prototype.constraints=[new mxConnectionConstraint(new mxPoint(.25,0),!1),new mxConnectionConstraint(new mxPoint(.5,0),!1),new mxConnectionConstraint(new mxPoint(.75,0),!1),new mxConnectionConstraint(new mxPoint(0,.25),!1),new mxConnectionConstraint(new mxPoint(0,.5),!1),new mxConnectionConstraint(new mxPoint(0,.75),!1),new mxConnectionConstraint(new mxPoint(1,.25),!1),new mxConnectionConstraint(new mxPoint(1,.5),!1),new mxConnectionConstraint(new mxPoint(1,.75),!1)];
|
||||
|
|
2511
src/main/webapp/js/viewer.min.js
vendored
2511
src/main/webapp/js/viewer.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -53,60 +53,89 @@
|
|||
var div = document.createElement('div');
|
||||
div.style.fontFamily = 'Arial';
|
||||
|
||||
var keys = [];
|
||||
|
||||
for (var i = 0; i < localStorage.length; i++)
|
||||
window.parent.listBrowserFiles(function(filesInfo)
|
||||
{
|
||||
var key = localStorage.key(i);
|
||||
var value = localStorage.getItem(key);
|
||||
|
||||
if (key.length > 0 && key.charAt(0) != '.' && value.length > 0 &&
|
||||
(value.substring(0, 8) === '<mxfile ' || value.substring(0, 11) === '<mxlibrary>' ||
|
||||
value.substring(0, 5) === '<?xml') || value.substring(0, 12) === '<!--[if IE]>')
|
||||
{
|
||||
keys.push(key);
|
||||
}
|
||||
}
|
||||
|
||||
if (keys.length == 0)
|
||||
if (filesInfo.length == 0)
|
||||
{
|
||||
window.parent.mxUtils.write(div, window.parent.mxResources.get('noFiles'));
|
||||
window.parent.mxUtils.br(div);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sorts the array by filename (key)
|
||||
keys.sort(function (a, b)
|
||||
// Sorts the array by filename (titles)
|
||||
filesInfo.sort(function (a, b)
|
||||
{
|
||||
return a.toLowerCase().localeCompare(b.toLowerCase());
|
||||
return a.title.toLowerCase().localeCompare(b.title.toLowerCase());
|
||||
});
|
||||
|
||||
for (var i = 0; i < keys.length; i++)
|
||||
{
|
||||
var key = keys[i];
|
||||
var table = document.createElement('table');
|
||||
var hrow = document.createElement('tr');
|
||||
hrow.style.backgroundColor = '#D6D6D6';
|
||||
hrow.style.height = '25px';
|
||||
hrow.style.textAlign = 'left';
|
||||
table.appendChild(hrow);
|
||||
var hName = document.createElement('th');
|
||||
window.parent.mxUtils.write(hName, window.parent.mxResources.get('name'));
|
||||
hrow.appendChild(hName);
|
||||
var hModified = document.createElement('th');
|
||||
hModified.style.width = '130px';
|
||||
window.parent.mxUtils.write(hModified, window.parent.mxResources.get('lastModified'));
|
||||
hrow.appendChild(hModified);
|
||||
var hSize = document.createElement('th');
|
||||
window.parent.mxUtils.write(hSize, window.parent.mxResources.get('size'));
|
||||
hSize.style.width = '70px';
|
||||
hrow.appendChild(hSize);
|
||||
var hCtrl = document.createElement('th');
|
||||
hCtrl.style.width = '23px';
|
||||
hrow.appendChild(hCtrl);
|
||||
table.style.fontSize = '12pt';
|
||||
table.style.width = '100%';
|
||||
|
||||
// Ignores "dot" files and dropbox cookies
|
||||
if (key.length > 0)
|
||||
for (var i = 0; i < filesInfo.length; i++)
|
||||
{
|
||||
var fileInfo = filesInfo[i];
|
||||
|
||||
if (fileInfo.title.length > 0)
|
||||
{
|
||||
var row = document.createElement('tr');
|
||||
table.appendChild(row);
|
||||
|
||||
if (i & 1 == 1)
|
||||
{
|
||||
row.style.backgroundColor = '#E6E6E6';
|
||||
}
|
||||
|
||||
var nameTd = document.createElement('td');
|
||||
row.appendChild(nameTd);
|
||||
var link = document.createElement('a');
|
||||
link.style.fontDecoration = 'none';
|
||||
link.style.fontSize = '14pt';
|
||||
|
||||
window.parent.mxUtils.write(link, key);
|
||||
window.parent.mxUtils.write(link, fileInfo.title);
|
||||
link.setAttribute('href', 'javascript:void(0);');
|
||||
div.appendChild(link);
|
||||
nameTd.appendChild(link);
|
||||
|
||||
var modifiedTd = document.createElement('td');
|
||||
row.appendChild(modifiedTd);
|
||||
var str = window.parent.EditorUi.prototype.timeSince(new Date(fileInfo.lastModified));
|
||||
|
||||
if (str == null)
|
||||
{
|
||||
str = window.parent.mxResources.get('lessThanAMinute');
|
||||
}
|
||||
|
||||
window.parent.mxUtils.write(modifiedTd, window.parent.mxResources.get('timeAgo', [str]));
|
||||
|
||||
var sizeTd = document.createElement('td');
|
||||
row.appendChild(sizeTd);
|
||||
window.parent.mxUtils.write(sizeTd, window.parent.EditorUi.prototype.formatFileSize(fileInfo.size));
|
||||
|
||||
var ctrlTd = document.createElement('td');
|
||||
row.appendChild(ctrlTd);
|
||||
ctrlTd.style.textAlign = 'center';
|
||||
var img = document.createElement('span');
|
||||
img.className = 'geSprite geSprite-delete';
|
||||
img.style.position = 'relative';
|
||||
img.style.cursor = 'pointer';
|
||||
img.style.display = 'inline-block';
|
||||
img.style.cssFloat = 'right';
|
||||
img.style.styleFloat = 'right';
|
||||
img.style.paddingRight = '20px';
|
||||
div.appendChild(img);
|
||||
|
||||
window.parent.mxUtils.br(div);
|
||||
ctrlTd.appendChild(img);
|
||||
|
||||
window.parent.mxEvent.addListener(img, 'click', (function(k)
|
||||
{
|
||||
|
@ -114,11 +143,13 @@
|
|||
{
|
||||
if (window.parent.mxUtils.confirm(window.parent.mxResources.get('delete') + ' "' + k + '"?'))
|
||||
{
|
||||
localStorage.removeItem(k);
|
||||
window.parent.deleteBrowserFile(k, function()
|
||||
{
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
};
|
||||
})(key));
|
||||
})(fileInfo.title));
|
||||
|
||||
window.parent.mxEvent.addListener(link, 'click', (function(k)
|
||||
{
|
||||
|
@ -127,8 +158,8 @@
|
|||
if (window.parent.openNew && window.parent.baseUrl != null)
|
||||
{
|
||||
var of = window.parent.openFile;
|
||||
var data = localStorage.getItem(k);
|
||||
|
||||
window.parent.openBrowserFile(k, function(data)
|
||||
{
|
||||
window.parent.openWindow(window.parent.baseUrl + '#L' + encodeURIComponent(k), function()
|
||||
{
|
||||
of.cancel(false);
|
||||
|
@ -136,27 +167,42 @@
|
|||
{
|
||||
of.setData(data, k);
|
||||
});
|
||||
}, function()
|
||||
{
|
||||
//TODO add error
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
window.parent.openFile.setData(localStorage.getItem(k), k);
|
||||
window.parent.openBrowserFile(k, function(data)
|
||||
{
|
||||
window.parent.openFile.setData(data, k);
|
||||
}, function()
|
||||
{
|
||||
//TODO add error
|
||||
});
|
||||
}
|
||||
};
|
||||
})(key));
|
||||
}
|
||||
})(fileInfo.title));
|
||||
}
|
||||
}
|
||||
|
||||
window.parent.mxUtils.br(div);
|
||||
div.appendChild(table);
|
||||
}
|
||||
|
||||
var closeButton = window.parent.mxUtils.button(window.parent.mxResources.get('close'), function()
|
||||
{
|
||||
hideWindow(true);
|
||||
});
|
||||
|
||||
closeButton.className = 'geBtn';
|
||||
closeButton.style.position = 'fixed';
|
||||
closeButton.style.bottom = '0px';
|
||||
closeButton.style.right = '0px';
|
||||
div.appendChild(closeButton);
|
||||
|
||||
document.body.appendChild(div);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -6,7 +6,7 @@ if (workbox)
|
|||
workbox.precaching.precacheAndRoute([
|
||||
{
|
||||
"url": "js/app.min.js",
|
||||
"revision": "991b4ef9193bf09d2e2f5efbe1f7e94b"
|
||||
"revision": "17ebe97b870bd9b55fee7861e86bb615"
|
||||
},
|
||||
{
|
||||
"url": "js/extensions.min.js",
|
||||
|
@ -14,7 +14,7 @@ if (workbox)
|
|||
},
|
||||
{
|
||||
"url": "js/diagramly/ElectronApp.js",
|
||||
"revision": "d8fdc81b19a75ea223f26cab343b401d"
|
||||
"revision": "0669ba361d68da2bd7ed3676c7add5ea"
|
||||
},
|
||||
{
|
||||
"url": "js/stencils.min.js",
|
||||
|
@ -22,15 +22,15 @@ if (workbox)
|
|||
},
|
||||
{
|
||||
"url": "js/shapes.min.js",
|
||||
"revision": "87caed91dc56473486dd90291eadd057"
|
||||
"revision": "fca9101e6fffc0c4d4b4d660c4589b3b"
|
||||
},
|
||||
{
|
||||
"url": "index.html",
|
||||
"revision": "d02fab970652db6d01c214ad995cdc32"
|
||||
"revision": "3a5fb082978b54a5d844f374eb556689"
|
||||
},
|
||||
{
|
||||
"url": "open.html",
|
||||
"revision": "cb5b1553e62c4c21fae0a3890bd9bc10"
|
||||
"revision": "d10cdcb6f34a8c8aa9d6a649d6cc8904"
|
||||
},
|
||||
{
|
||||
"url": "app.html",
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue