David Benson 8 lat temu
rodzic
commit
5a3ca0a893

+ 12 - 0
ChangeLog

@@ -1,3 +1,15 @@
+14-AUG-2017: 7.1.0
+
+- Improves Lucidchart import
+- Improves Gliffy import
+- Uses mxGraph 3.7.5 beta 8
+- Fixes ignored horizontal/vertical flip for connection points
+
+11-AUG-2017: 7.0.9
+
+- Fixes path to clipart images for SVG export in Chrome App
+- Adds perimeter for parallelogram, trapezoid, step and hexagon
+
 11-AUG-2017: 7.0.8
 
 - Fixes error handling in Confluence Cloud add-on

+ 1 - 1
VERSION

@@ -1 +1 @@
-7.0.8
+7.1.0

Plik diff jest za duży
+ 5 - 4
etc/mxgraph/mxClient.js


+ 12 - 2
src/com/mxgraph/io/gliffy/importer/GliffyDiagramConverter.java

@@ -340,6 +340,7 @@ public class GliffyDiagramConverter
 		StringBuilder style = new StringBuilder();
 
 		mxGeometry geometry = new mxGeometry(gliffyObject.x, gliffyObject.y, gliffyObject.width, gliffyObject.height);
+		gliffyObject.adjustGeo(geometry);
 		cell.setGeometry(geometry);
 		
 		GliffyObject textObject = null;
@@ -527,7 +528,7 @@ public class GliffyDiagramConverter
 				
 				GliffyObject laneTxt = gLane.children.get(0);
 				mxLane.setValue(laneTxt.getText());
-				laneStyle.append(laneTxt.graphic.getText().getStyle());
+				laneStyle.append(laneTxt.graphic.getText().getStyle(0, 0));
 				//for debugging, add gliffy id to the output in the style 
 				laneStyle.append("gliffyId=" + gLane.id + ";");
 				mxLane.setStyle(laneStyle.toString());
@@ -598,8 +599,17 @@ public class GliffyDiagramConverter
 			
 			if(!gliffyObject.isLine())
 			{
+				GliffyText txt = textObject.graphic.getText();
+				
+				if (gliffyObject.isSwimlane())
+				{
+					txt.setForceTopPaddingShift(true);
+					txt.setValign("middle");
+				}
+				
 				cell.setValue(textObject.getText());
-				style.append(textObject.graphic.getText().getStyle());
+				gliffyObject.adjustTextPos(textObject);
+				style.append(textObject == gliffyObject ? txt.getStyle(0, 0) : txt.getStyle(textObject.x, textObject.y));
 			}
 		}
 		

+ 11 - 6
src/com/mxgraph/io/gliffy/importer/gliffyTranslation.properties

@@ -130,10 +130,10 @@ com.gliffy.shape.uml.uml_v2.class.note=note;size=10
 com.gliffy.shape.uml.uml_v2.class.anchor_line=endArrow=none;endSize=12;dashed=1
 # UML v1
 com.gliffy.shape.uml.uml_v1.default.package=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left
-com.gliffy.shape.uml.uml_v1.default.class=rect;verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica
+com.gliffy.shape.uml.uml_v1.default.class=rect;fillColor=none;strokeColor=none
 com.gliffy.shape.uml.uml_v1.default.simple_class=rect
 com.gliffy.shape.uml.uml_v1.default.note=note;size=10
-com.gliffy.shape.uml.uml_v1.default.object=rect;verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica
+com.gliffy.shape.uml.uml_v1.default.object=rect;fillColor=none;strokeColor=none
 com.gliffy.shape.uml.uml_v1.default.interface=ellipse
 com.gliffy.shape.uml.uml_v1.default.node=cube;size=10;direction=south
 com.gliffy.shape.uml.uml_v1.default.component=component;align=left;spacingLeft=36
@@ -143,11 +143,12 @@ com.gliffy.shape.uml.uml_v1.default.association=edgeStyle=orthogonalEdgeStyle
 com.gliffy.shape.uml.uml_v1.default.aggregation=edgeStyle=orthogonalEdgeStyle
 com.gliffy.shape.uml.uml_v1.default.composition=edgeStyle=orthogonalEdgeStyle
 com.gliffy.shape.uml.uml_v1.default.dependency=edgeStyle=orthogonalEdgeStyle;dashed=1
-com.gliffy.shape.uml.uml_v1.default.object_timeline=umlLifeline;perimeter=lifelinePerimeter;size=20
+com.gliffy.shape.uml.uml_v1.default.object_timeline=rect;fillColor=none;strokeColor=none
 com.gliffy.shape.uml.uml_v1.default.activation=rect
-com.gliffy.shape.uml.uml_v1.default.lifeline=umlLifeline;perimeter=lifelinePerimeter
+com.gliffy.shape.uml.uml_v1.default.lifeline=stencil(nZFNDsIgEIVPwx6ZjS4NtveYtkRIKxDAVm8vP5qA3RgTNrw330zmDQHuJVpBGEVvxRgIXAhjKzqFwxJlFh0fnJnFpqYgi620FE6F5EJH6JkAH3Ccr87c9fSW6Ck94BYTVUlZvZk1zXyUfrTMeda/fg8tSlfQgbbYv9zxR66lPl36r3WjUm0c083ZNXW5aJdXVsstoHsB);dashed=1
 com.gliffy.shape.uml.uml_v1.default.message=edgeStyle=none
-com.gliffy.shape.uml.uml_v1.default.self_message=curved=1
+#TODO this shape has a shape graphics instead of a line!
+com.gliffy.shape.uml.uml_v1.default.self_message=filledEdge;fixDash=1;startArrow=none;endArrow=block;endFill=1;endSize=6;edgeStyle=orthogonalEdgeStyle;curved=1
 com.gliffy.shape.uml.uml_v1.default.actor=umlActor;verticalLabelPosition=bottom;verticalAlign=bottom
 com.gliffy.shape.uml.uml_v1.default.use_case=ellipse
 # UML v2 SEQUENCE
@@ -1580,4 +1581,8 @@ com.gliffy.stencil.rectangle.no_fill_line_bottom_dashed_v1=partialRectangle;top=
 com.gliffy.stencil.boundary_lifeline.uml_v2=umlBoundary
 com.gliffy.stencil.object_timeline.uml_v1=line;direction=south;dashed=1
 com.gliffy.stencil.control_lifeline.uml_v2=umlControl
-com.gliffy.stencil.entity_lifeline.uml_v2=umlEntity
+com.gliffy.stencil.entity_lifeline.uml_v2=umlEntity
+com.gliffy.stencil.ui.ui_v3.containers_content.speech_bubble=rect;rounded=1
+com.gliffy.stencil.ui.ui_v3.containers_content.speech_bubble_right=mxgraph.basic.orthogonal_triangle;direction=south
+com.gliffy.stencil.ui.ui_v3.containers_content.speech_bubble_left=mxgraph.basic.orthogonal_triangle;direction=south;flipH=1
+com.gliffy.stencil.rectangle.basic_v1=rect

+ 52 - 2
src/com/mxgraph/io/gliffy/model/GliffyObject.java

@@ -2,12 +2,15 @@ package com.mxgraph.io.gliffy.model;
 
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import com.mxgraph.io.gliffy.importer.PostDeserializer.PostDeserializable;
 import com.mxgraph.model.mxCell;
+import com.mxgraph.model.mxGeometry;
 
 /**
  * Class representing Gliffy diagram object
@@ -20,6 +23,8 @@ public class GliffyObject implements PostDeserializable
 	private static Set<String> GROUP_SHAPES = new HashSet<String>();
 
 	private static Set<String> MINDMAP_SHAPES = new HashSet<>();
+	
+	private static Map<String, double[]> SHAPES_COORD_FIX = new HashMap<>();
 
 	public float x;
 
@@ -131,11 +136,23 @@ public class GliffyObject implements PostDeserializable
 		GROUP_SHAPES.add("com.gliffy.shape.uml.uml_v2.sequence.lifeline");
 		GROUP_SHAPES.add("com.gliffy.shape.uml.uml_v2.sequence.entity_lifeline");
 		GROUP_SHAPES.add("com.gliffy.shape.uml.uml_v2.sequence.control_lifeline");
-		
+		GROUP_SHAPES.add("com.gliffy.shape.ui.ui_v3.containers_content.speech_bubble_right");
+		GROUP_SHAPES.add("com.gliffy.shape.ui.ui_v3.containers_content.speech_bubble_left");
+		//UML V1
+		GROUP_SHAPES.add("com.gliffy.shape.uml.uml_v1.default.object_timeline");
+		GROUP_SHAPES.add("com.gliffy.shape.uml.uml_v1.default.class");
+		GROUP_SHAPES.add("com.gliffy.shape.uml.uml_v1.default.object");
+
 		MINDMAP_SHAPES.add("com.gliffy.shape.mindmap.mindmap_v1.default.main_topic");
 		MINDMAP_SHAPES.add("com.gliffy.shape.mindmap.mindmap_v1.default.subtopic");
 		MINDMAP_SHAPES.add("com.gliffy.shape.mindmap.mindmap_v1.default.child_node");
 
+		
+		SHAPES_COORD_FIX.put("com.gliffy.shape.flowchart.flowchart_v1.default.paper_tape", new double[]{0, -0.1, 0, 0.2});
+		SHAPES_COORD_FIX.put("com.gliffy.shape.uml.uml_v1.default.node", new double[]{0, -10, 10, 10});
+		SHAPES_COORD_FIX.put("com.gliffy.shape.uml.uml_v2.deployment.node", new double[]{0, -10, 10, 10});
+		SHAPES_COORD_FIX.put("com.gliffy.shape.uml.uml_v2.deployment.device_node", new double[]{0, -10, 10, 10});
+		SHAPES_COORD_FIX.put("com.gliffy.shape.uml.uml_v2.deployment.execution_environment_node", new double[]{0, -10, 10, 10});
 	}
 
 	public GliffyObject()
@@ -163,6 +180,11 @@ public class GliffyObject implements PostDeserializable
 	 * @return
 	 */
 	public GliffyObject getTextObject()
+	{
+		return getTextObject(0, 0);
+	}
+	
+	private GliffyObject getTextObject(double x, double y)
 	{
 
 		if (isText())
@@ -178,11 +200,13 @@ public class GliffyObject implements PostDeserializable
 		{
 			if (child.getGraphic() != null && child.getGraphic().getType().equals(Graphic.Type.TEXT))
 			{
+				child.x += x;
+				child.y += y;
 				return child;
 			}
 			else
 			{
-				GliffyObject txtObj = child.getTextObject();
+				GliffyObject txtObj = child.getTextObject(child.x, child.y);
 				
 				if (txtObj != null)
 					return txtObj;
@@ -397,4 +421,30 @@ public class GliffyObject implements PostDeserializable
 				child.y += -yMin;
 		}
 	}
+	
+	public void adjustGeo(mxGeometry geo)
+	{
+		double[] arr = SHAPES_COORD_FIX.get(uid);
+		
+		if (arr != null)
+		{
+			double x = geo.getX(), y = geo.getY(), w = geo.getWidth(), h = geo.getHeight();
+			
+			geo.setX(x + (Math.abs(arr[0]) < 1 ? w * arr[0]: arr[0]));
+			geo.setY(y + (Math.abs(arr[1]) < 1 ? h * arr[1]: arr[1]));
+			geo.setWidth(w + (Math.abs(arr[2]) < 1 ? w * arr[2]: arr[2]));
+			geo.setHeight(h + (Math.abs(arr[3]) < 1 ? h * arr[3]: arr[3]));
+		}
+	}
+
+	public void adjustTextPos(GliffyObject textObject) 
+	{
+		double[] arr = SHAPES_COORD_FIX.get(uid);
+		
+		if (arr != null)
+		{
+			textObject.x -= (Math.abs(arr[0]) < 1 ? width * arr[0]: arr[0]);
+			textObject.y -= (Math.abs(arr[1]) < 1 ? height * arr[1]: arr[1]);
+		}
+	}
 }

+ 20 - 5
src/com/mxgraph/io/gliffy/model/GliffyText.java

@@ -32,6 +32,8 @@ public class GliffyText implements PostDeserializer.PostDeserializable
 
 	public String overflow;
 	
+	private boolean forceTopPaddingShift = false;
+	
 	private static Pattern pattern = Pattern.compile("<p(.*?)<\\/p>");
 
 	private static Pattern textAlign = Pattern.compile(".*(text-align: ?(left|center|right);).*", Pattern.DOTALL);
@@ -56,7 +58,7 @@ public class GliffyText implements PostDeserializer.PostDeserializable
 	{
 	}
 
-	public String getStyle()
+	public String getStyle(float x, float y)
 	{
 		StringBuilder sb = new StringBuilder();
 
@@ -78,7 +80,7 @@ public class GliffyText implements PostDeserializer.PostDeserializable
 		{
 			sb.append("verticalAlign=").append(valign).append(";");
 			
-			if ("middle".equals(valign))
+			if (!forceTopPaddingShift && "middle".equals(valign))
 				topPaddingShift = 0;
 		}
 
@@ -100,10 +102,14 @@ public class GliffyText implements PostDeserializer.PostDeserializable
 				sb.append("align=center;");
 		}
 
-		sb.append("spacingLeft=").append(paddingLeft).append(";");
+		sb.append("spacingLeft=").append(paddingLeft + x).append(";");
 		sb.append("spacingRight=").append(paddingRight).append(";");
-		sb.append("spacingTop=").append(paddingTop - topPaddingShift).append(";");
-		sb.append("spacingBottom=").append(paddingBottom).append(";");
+		
+		if (forceTopPaddingShift || !"middle".equals(valign))
+		{
+			sb.append("spacingTop=").append(paddingTop - topPaddingShift + y).append(";");
+			sb.append("spacingBottom=").append(paddingBottom).append(";");
+		}
 
 		//We should wrap only if overflow is none. (TODO better support left & right overflow) 
 		if ("none".equals(overflow))
@@ -142,4 +148,13 @@ public class GliffyText implements PostDeserializer.PostDeserializable
 		return null;
 	}
 
+	public void setValign(String valign) 
+	{
+		this.valign = valign;
+	}
+
+	public void setForceTopPaddingShift(boolean forceTopPaddingShift) 
+	{
+		this.forceTopPaddingShift = forceTopPaddingShift;
+	}
 }

+ 1 - 1
war/cache.manifest

@@ -1,7 +1,7 @@
 CACHE MANIFEST
 
 # THIS FILE WAS GENERATED. DO NOT MODIFY!
-# 08/11/2017 12:06 PM
+# 08/14/2017 05:19 PM
 
 app.html
 index.html?offline=1

Plik diff jest za duży
+ 86 - 80
war/js/app.min.js


Plik diff jest za duży
+ 428 - 422
war/js/atlas-viewer.min.js


Plik diff jest za duży
+ 223 - 210
war/js/atlas.min.js


+ 1 - 1
war/js/diagramly/App.js

@@ -1063,7 +1063,7 @@ App.prototype.init = function()
 			this.updateAd(0);
 		}));
 
-		if (mxSettings.getOpenCounter() > 10)
+		if (mxSettings.getOpenCounter() > 10 && urlParams['embed'] != '1')
 		{
 			thread2 = window.setTimeout(mxUtils.bind(this, function()
 			{

+ 13 - 13
war/js/diagramly/EditorUi.js

@@ -2973,17 +2973,17 @@
 				var svg = '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n' +
 					mxUtils.getXml(svgRoot);
 				
-	    		if (this.isLocalFileSave() || svg.length <= MAX_REQUEST_SIZE)
-	    		{
-	    	    	this.saveData(filename, 'svg', svg, 'image/svg+xml');
-	    		}
-	    		else
-	    		{
-	    			this.handleError({message: mxResources.get('drawingTooLarge')}, mxResources.get('error'), mxUtils.bind(this, function()
-	    			{
-	    				mxUtils.popup(svg);
-	    			}));
-	    		}
+		    		if (this.isLocalFileSave() || svg.length <= MAX_REQUEST_SIZE)
+		    		{
+		    			this.saveData(filename, 'svg', svg, 'image/svg+xml');
+		    		}
+		    		else
+		    		{
+		    			this.handleError({message: mxResources.get('drawingTooLarge')}, mxResources.get('error'), mxUtils.bind(this, function()
+		    			{
+		    				mxUtils.popup(svg);
+		    			}));
+		    		}
 			});
 			
 			this.convertMath(this.editor.graph, svgRoot, false, mxUtils.bind(this, function()
@@ -4983,7 +4983,7 @@
 				{
 					this.insertLucidChart(data, dx, dy, crop, done);
 					
-					if (this.updateAd != null && !this.lucidchartTweetShown)
+					if (this.updateAd != null && !this.lucidchartTweetShown && urlParams['embed'] != '1')
 					{
 						this.adsHtml.push('<a title="' + mxResources.get('loveIt', ['draw.io']) +
 							'" target="_blank" href="https://twitter.com/intent/tweet?text=' +
@@ -8235,7 +8235,7 @@
 											parent.postMessage(JSON.stringify(msg), '*');
 					        			}));
 					        		}
-								}
+							}
 				        		
 				        		return;
 				        	}

+ 345 - 28
war/js/diagramly/Extensions.js

@@ -1717,23 +1717,23 @@
 //			'PEOrificeBlock' NA
 			'PERotameterBlock' : s + 'pid.flow_sensors.rotameter;flipH=1;',
 //Venn Gradient
-			'VennGradientColor1' : 'shape=ellipse;',
-			'VennGradientColor2' : 'shape=ellipse;',
-			'VennGradientColor3' : 'shape=ellipse;',
-			'VennGradientColor4' : 'shape=ellipse;',
-			'VennGradientColor5' : 'shape=ellipse;',
-			'VennGradientColor6' : 'shape=ellipse;',
-			'VennGradientColor7' : 'shape=ellipse;',
-			'VennGradientColor8' : 'shape=ellipse;',
+			'VennGradientColor1' : 'shape=ellipse;strokeColor=#49c1a1;fillOpacity=35;',
+			'VennGradientColor2' : 'shape=ellipse;strokeColor=#7769e0;fillOpacity=35;',
+			'VennGradientColor3' : 'shape=ellipse;strokeColor=#efd95d;fillOpacity=35;',
+			'VennGradientColor4' : 'shape=ellipse;strokeColor=#e24adb;fillOpacity=35;',
+			'VennGradientColor5' : 'shape=ellipse;strokeColor=#e55050;fillOpacity=35;',
+			'VennGradientColor6' : 'shape=ellipse;strokeColor=#f49769;fillOpacity=35;',
+			'VennGradientColor7' : 'shape=ellipse;strokeColor=#7ae266;fillOpacity=35;',
+			'VennGradientColor8' : 'shape=ellipse;strokeColor=#47b0e5;fillOpacity=35;',
 //Venn Plain
-			'VennPlainColor1' : 'shape=ellipse;',
-			'VennPlainColor2' : 'shape=ellipse;',
-			'VennPlainColor3' : 'shape=ellipse;',
-			'VennPlainColor4' : 'shape=ellipse;',
-			'VennPlainColor5' : 'shape=ellipse;',
-			'VennPlainColor6' : 'shape=ellipse;',
-			'VennPlainColor7' : 'shape=ellipse;',
-			'VennPlainColor8' : 'shape=ellipse;',
+			'VennPlainColor1' : 'shape=ellipse;strokeColor=#49c1a1;fillOpacity=35;',
+			'VennPlainColor2' : 'shape=ellipse;strokeColor=#7769e0;fillOpacity=35;',
+			'VennPlainColor3' : 'shape=ellipse;strokeColor=#efd95d;fillOpacity=35;',
+			'VennPlainColor4' : 'shape=ellipse;strokeColor=#e24adb;fillOpacity=35;',
+			'VennPlainColor5' : 'shape=ellipse;strokeColor=#e55050;fillOpacity=35;',
+			'VennPlainColor6' : 'shape=ellipse;strokeColor=#f49769;fillOpacity=35;',
+			'VennPlainColor7' : 'shape=ellipse;strokeColor=#7ae266;fillOpacity=35;',
+			'VennPlainColor8' : 'shape=ellipse;strokeColor=#47b0e5;fillOpacity=35;',
 //iOS Devices
 			'iOS7DeviceiPhone5Portrait' : s + 'ios.iPhone;bgStyle=bgGreen;', //EXT
 			'iOS7DeviceiPhone5Landscape' : s + 'ios.iPhone;bgStyle=bgGreen;', //EXT
@@ -2089,7 +2089,7 @@
 				cell.value = convertText(p);
 
 				//adds font size
-				var isV = 0;
+				var isV = false;
 				
 				if (p.Text != null)
 				{
@@ -2098,7 +2098,7 @@
 						var m = p.Text.m;
 						var i = 0;
 						
-						while ((isV == 0) && (i < m.length))
+						while ((!isV) && (i < m.length))
 						{
 							var currM = m[i];
 							
@@ -2106,10 +2106,10 @@
 							{
 								if (currM.v != null)
 								{
-									isV = 1;
+									isV = true;
 
 									var fontSize = currM.v;
-									fontSize = Math.round(fontSize / 1.7);
+									fontSize = 1 + Math.round(fontSize / 1.8);
 									cell.style += 'fontSize=' + fontSize + ';';
 								}
 							}
@@ -2124,7 +2124,7 @@
 				}
 				
 				//adds font color
-				var isC = 0;
+				var isC = false;
 				
 				if (p.Text != null)
 				{
@@ -2133,7 +2133,7 @@
 						var m = p.Text.m;
 						var i = 0;
 						
-						while ((isC == 0) && (i < m.length))
+						while ((!isC) && (i < m.length))
 						{
 							var currM = m[i];
 							
@@ -2141,7 +2141,7 @@
 							{
 								if (currM.v != null)
 								{
-									isC = 1;
+									isC = true;
 									
 									var currV = currM.v;
 									
@@ -2159,8 +2159,279 @@
 							i++;
 						}
 					}
+
+					var fontStyle = 0;
+
+					//check for bold text
+					var isBT = false;
+					
+					if (p.Text.m != null)
+					{
+						var m = p.Text.m;
+						var i = 0;
+						
+						while ((!isBT) && (i < m.length))
+						{
+							var currM = m[i];
+							
+							if (currM.n == 'b')
+							{
+								if (currM.v != null && currM.v)
+								{
+									isBT = true;
+									fontStyle += 1;
+								}
+							}
+							
+							i++;
+						}
+					}
+						
+					//check for italic text
+					var isIT = false;
+					
+					if (p.Text.m != null)
+					{
+						var m = p.Text.m;
+						var i = 0;
+						
+						while ((!isIT) && (i < m.length))
+						{
+							var currM = m[i];
+							
+							if (currM.n == 'i')
+							{
+								if (currM.v != null && currM.v)
+								{
+									isIT = true;
+									fontStyle += 2;
+								}
+							}
+							
+							i++;
+						}
+					}
+						
+					//check for underline text
+					var isUT = false;
+					
+					if (p.Text.m != null)
+					{
+						var m = p.Text.m;
+						var i = 0;
+						
+						while ((!isUT) && (i < m.length))
+						{
+							var currM = m[i];
+							
+							if (currM.n == 'u')
+							{
+								if (currM.v != null && currM.v)
+								{
+									isUT = true;
+									fontStyle += 4;
+								}
+							}
+							
+							i++;
+						}
+					}
+					
+					if (fontStyle > 0)
+					{
+						cell.style += 'fontStyle=' + fontStyle + ';';
+					}
+					
+					//adds text alignment
+					var isA = false;
+					
+					if (p.Text != null)
+					{
+						if (p.Text.m != null)
+						{
+							var m = p.Text.m;
+							var i = 0;
+							
+							while ((!isA) && (i < m.length))
+							{
+								var currM = m[i];
+								
+								if (currM.n == 'a')
+								{
+									if (currM.v != null)
+									{
+										isA = true;
+										
+										var currV = currM.v;
+										
+										cell.style += 'align=' + currV + ';';
+									}
+								}
+								
+								i++;
+							}
+						}
+					}
+
+					//adds left spacing
+					var isIL = false;
+					
+					if (p.Text != null)
+					{
+						if (p.Text.m != null)
+						{
+							var m = p.Text.m;
+							var i = 0;
+							
+							while ((!isIL) && (i < m.length))
+							{
+								var currM = m[i];
+								
+								if (currM.n == 'il')
+								{
+									if (currM.v != null)
+									{
+										isIL = true;
+										
+										var currV = currM.v;
+										
+										cell.style += 'spacingLeft=' + currV + ';';
+									}
+								}
+								
+								i++;
+							}
+						}
+					}
+
+					//adds right spacing
+					var isIR = false;
+					
+					if (p.Text != null)
+					{
+						if (p.Text.m != null)
+						{
+							var m = p.Text.m;
+							var i = 0;
+							
+							while ((!isIR) && (i < m.length))
+							{
+								var currM = m[i];
+								
+								if (currM.n == 'ir')
+								{
+									if (currM.v != null)
+									{
+										isIR = true;
+										
+										var currV = currM.v;
+										
+										cell.style += 'spacingRight=' + currV + ';';
+									}
+								}
+								
+								i++;
+							}
+						}
+					}
+
+					//adds top spacing
+					var isMT = false;
+					
+					if (p.Text != null)
+					{
+						if (p.Text.m != null)
+						{
+							var m = p.Text.m;
+							var i = 0;
+							
+							while ((!isMT) && (i < m.length))
+							{
+								var currM = m[i];
+								
+								if (currM.n == 'mt')
+								{
+									if (currM.v != null)
+									{
+										isMT = true;
+										
+										var currV = currM.v;
+										
+										cell.style += 'spacingTop=' + currV + ';';
+									}
+								}
+								
+								i++;
+							}
+						}
+					}
+
+					//adds bottom spacing
+					var isMB = false;
+					
+					if (p.Text != null)
+					{
+						if (p.Text.m != null)
+						{
+							var m = p.Text.m;
+							var i = 0;
+							
+							while ((!isMB) && (i < m.length))
+							{
+								var currM = m[i];
+								
+								if (currM.n == 'mb')
+								{
+									if (currM.v != null)
+									{
+										isMB = true;
+										
+										var currV = currM.v;
+										
+										cell.style += 'spacingBottom=' + currV + ';';
+									}
+								}
+								
+								i++;
+							}
+						}
+					}
+
+					//adds global spacing
+					if (typeof p.InsetMargin === 'number')
+					{
+							cell.style += 'spacing=' + parseInt(p.InsetMargin) + ';';
+					}
+					
+					//adds opacity
+					if (typeof p.LineColor === 'string')
+					{
+						if (p.LineColor.length > 7)
+						{
+							var sOpac = "0x" + p.LineColor.substring(p.LineColor.length - 2, p.LineColor.length);
+							cell.style += 'strokeOpacity=' + Math.round(parseInt(sOpac) / 2.55) + ';';
+						}
+					}
+					
+					if (typeof p.FillColor === 'string')
+					{
+						if (p.FillColor.length > 7)
+						{
+							var fOpac = "0x" + p.FillColor.substring(p.FillColor.length - 2, p.FillColor.length);
+							cell.style += 'fillOpacity=' + Math.round(parseInt(fOpac) / 2.55) + ';';
+						}
+					}
+
+					// adds text vertical alignment
+					if (p.Text_VAlign != null)
+					{
+						if (typeof p.Text_VAlign === 'string')
+						{
+							cell.style += 'verticalAlign=' + p.Text_VAlign + ';';
+						}
+					}
 				}
-				
+
 				// Converts images
 				if (a.Class == 'ImageSearchBlock2')
 				{
@@ -2170,8 +2441,9 @@
 				// Adds styles
 				cell.style += createStyle(mxConstants.STYLE_STROKEWIDTH, p.LineWidth, '1');
 				
-				//stencils with hardcoded stroke color
-				var hardStroke = ['DefaultTextBlock', 'UI2HotspotBlock'];
+//				stencils with hardcoded stroke color
+				var hardStroke = ['VennPlainColor1', 'VennPlainColor2', 'VennPlainColor3', 'VennPlainColor4', 'VennPlainColor5', 'VennPlainColor6', 'VennPlainColor7', 'VennPlainColor8',
+					'VennGradientColor1', 'VennGradientColor2', 'VennGradientColor3', 'VennGradientColor4', 'VennGradientColor5', 'VennGradientColor6', 'VennGradientColor7', 'VennGradientColor8'];
 				
 				if (!hardStroke.includes(a.Class))
 				{
@@ -2181,8 +2453,9 @@
 				cell.style += createStyle(mxConstants.STYLE_ALIGN, p.TextAlign, 'center');
 				cell.style += createStyle(mxConstants.STYLE_VERTICAL_ALIGN, p.TextVAlign, 'middle');
 				
-				//stencils with hardcoded opacity
-				var hardOpacity = ['UI2HotspotBlock'];
+//				stencils with hardcoded opacity
+				var hardOpacity = ['VennPlainColor1', 'VennPlainColor2', 'VennPlainColor3', 'VennPlainColor4', 'VennPlainColor5', 'VennPlainColor6', 'VennPlainColor7', 'VennPlainColor8', 
+					'VennGradientColor1', 'VennGradientColor2', 'VennGradientColor3', 'VennGradientColor4', 'VennGradientColor5', 'VennGradientColor6', 'VennGradientColor7', 'VennGradientColor8'];
 
 				if (!hardOpacity.includes(a.Class))
 				{
@@ -2263,6 +2536,10 @@
 						{
 							cell.style += createStyle(mxConstants.STYLE_FILLCOLOR, p.FillColor.substring(0, 7), '#FFFFFF');
 						}
+						else
+						{
+							cell.style += createStyle(mxConstants.STYLE_FILLCOLOR, 'none');
+						}
 					}
 				}
 
@@ -2304,6 +2581,46 @@
 							}
 						}
 					}
+
+					if (p.Endpoint1.Style != null)
+					{
+						if (p.Endpoint1.Style == 'None')
+						{
+							cell.style += 'startArrow=none;';
+						}
+						else if (p.Endpoint1.Style == 'Arrow')
+						{
+							cell.style += 'startArrow=block;endFill=1;';
+						}
+						else if (p.Endpoint1.Style == 'Hollow Arrow')
+						{
+							cell.style += 'startArrow=block;endFill=0;';
+						}
+						else if (p.Endpoint1.Style == 'Open Arrow')
+						{
+							cell.style += 'startArrow=open;';
+						}
+					}
+					
+					if (p.Endpoint2.Style != null)
+					{
+						if (p.Endpoint2.Style == 'None')
+						{
+							cell.style += 'endArrow=none;';
+						}
+						else if (p.Endpoint2.Style == 'Arrow')
+						{
+							cell.style += 'endArrow=block;endFill=1;';
+						}
+						else if (p.Endpoint2.Style == 'Hollow Arrow')
+						{
+							cell.style += 'endArrow=block;endFill=0;';
+						}
+						else if (p.Endpoint2.Style == 'Open Arrow')
+						{
+							cell.style += 'endArrow=open;';
+						}
+					}
 					
 					// Anchor points and arrows
 					// TODO: Convert waypoints, elbowPoints

Plik diff jest za duży
+ 133 - 127
war/js/embed-static.min.js


Plik diff jest za duży
+ 137 - 130
war/js/extensions.min.js


+ 131 - 18
war/js/mxgraph/Shapes.js

@@ -345,7 +345,32 @@
 		c.close();
 		c.end();
 	};
-
+	
+	TapeShape.prototype.getLabelBounds = function(rect)
+	{
+		if (mxUtils.getValue(this.style, 'boundedLbl', false))
+		{
+			var size = mxUtils.getValue(this.style, 'size', this.size);			
+			var w = rect.width;
+			var h = rect.height;
+			
+			if (this.direction == null ||
+					this.direction == mxConstants.DIRECTION_EAST ||
+					this.direction == mxConstants.DIRECTION_WEST)
+			{
+				var dy = h * size;
+				return new mxRectangle(rect.x, rect.y + dy, w, h - 2 * dy);
+			}
+			else
+			{
+				var dx = w * size;
+				return new mxRectangle(rect.x + dx, rect.y, w - 2 * dx, h);
+			}
+		}
+		
+		return rect;
+	};
+	
 	mxCellRenderer.prototype.defaultShapes['tape'] = TapeShape;
 
 	// Document shape
@@ -1387,16 +1412,32 @@
 			size = mxUtils.getValue(vertex.style, 'size', size);
 		}
 		
-		var dx = bounds.width * Math.max(0, Math.min(1, size));
-		
 		var x = bounds.x;
 		var y = bounds.y;
 		var w = bounds.width;
 		var h = bounds.height;
 
-		var points = [new mxPoint(x + dx, y), new mxPoint(x + w, y),
-						new mxPoint(x + w - dx, y + h), new mxPoint(x, y + h), new mxPoint(x + dx, y)];
-
+		var direction = (vertex != null) ? mxUtils.getValue(
+				vertex.style, mxConstants.STYLE_DIRECTION,
+				mxConstants.DIRECTION_EAST) : mxConstants.DIRECTION_EAST;
+		var vertical = direction == mxConstants.DIRECTION_NORTH
+				|| direction == mxConstants.DIRECTION_SOUTH;
+				
+		var points;
+		
+		if (vertical)
+		{
+			var dy = h * Math.max(0, Math.min(1, size));
+			points = [new mxPoint(x, y), new mxPoint(x + w, y + dy),
+						new mxPoint(x + w, y + h), new mxPoint(x, y + h - dy), new mxPoint(x, y)];
+		}
+		else
+		{
+			var dx = w * Math.max(0, Math.min(1, size));
+			points = [new mxPoint(x + dx, y), new mxPoint(x + w, y),
+							new mxPoint(x + w - dx, y + h), new mxPoint(x, y + h), new mxPoint(x + dx, y)];
+		}	
+		
 		var cx = bounds.getCenterX();
 		var cy = bounds.getCenterY();
 		
@@ -1425,15 +1466,41 @@
 			size = mxUtils.getValue(vertex.style, 'size', size);
 		}
 		
-		var dx = bounds.width * Math.max(0, Math.min(1, size));
-		
 		var x = bounds.x;
 		var y = bounds.y;
 		var w = bounds.width;
 		var h = bounds.height;
 
-		var points = [new mxPoint(x + dx, y), new mxPoint(x + w - dx, y),
+		var direction = (vertex != null) ? mxUtils.getValue(
+				vertex.style, mxConstants.STYLE_DIRECTION,
+				mxConstants.DIRECTION_EAST) : mxConstants.DIRECTION_EAST;
+		
+		var points;
+		
+		if (direction == mxConstants.DIRECTION_EAST)
+		{
+			var dx = w * Math.max(0, Math.min(1, size));
+			points = [new mxPoint(x + dx, y), new mxPoint(x + w - dx, y),
 						new mxPoint(x + w, y + h), new mxPoint(x, y + h), new mxPoint(x + dx, y)];
+		}
+		else if (direction == mxConstants.DIRECTION_WEST)
+		{
+			var dx = w * Math.max(0, Math.min(1, size));
+			points = [new mxPoint(x, y), new mxPoint(x + w, y),
+						new mxPoint(x + w - dx, y + h), new mxPoint(x + dx, y + h), new mxPoint(x, y)];
+		}
+		else if (direction == mxConstants.DIRECTION_NORTH)
+		{
+			var dy = h * Math.max(0, Math.min(1, size));
+			points = [new mxPoint(x, y + dy), new mxPoint(x + w, y),
+						new mxPoint(x + w, y + h), new mxPoint(x, y + h - dy), new mxPoint(x, y + dy)];
+		}
+		else
+		{
+			var dy = h * Math.max(0, Math.min(1, size));
+			points = [new mxPoint(x, y), new mxPoint(x + w, y + dy),
+						new mxPoint(x + w, y + h - dy), new mxPoint(x, y + h), new mxPoint(x, y)];
+		}		
 
 		var cx = bounds.getCenterX();
 		var cy = bounds.getCenterY();
@@ -1463,8 +1530,6 @@
 			size = mxUtils.getValue(vertex.style, 'size', size);
 		}
 		
-		var dx = bounds.width * Math.max(0, Math.min(1, size));
-		
 		var x = bounds.x;
 		var y = bounds.y;
 		var w = bounds.width;
@@ -1473,9 +1538,40 @@
 		var cx = bounds.getCenterX();
 		var cy = bounds.getCenterY();
 		
-		var points = [new mxPoint(x, y), new mxPoint(x + w - dx, y), new mxPoint(x + w, cy),
-						new mxPoint(x + w - dx, y + h), new mxPoint(x, y + h),
-						new mxPoint(x + dx, cy), new mxPoint(x, y)];
+		var direction = (vertex != null) ? mxUtils.getValue(
+				vertex.style, mxConstants.STYLE_DIRECTION,
+				mxConstants.DIRECTION_EAST) : mxConstants.DIRECTION_EAST;
+		
+		var points;
+		
+		if (direction == mxConstants.DIRECTION_EAST)
+		{
+			var dx = w * Math.max(0, Math.min(1, size));
+			points = [new mxPoint(x, y), new mxPoint(x + w - dx, y), new mxPoint(x + w, cy),
+							new mxPoint(x + w - dx, y + h), new mxPoint(x, y + h),
+							new mxPoint(x + dx, cy), new mxPoint(x, y)];
+		}
+		else if (direction == mxConstants.DIRECTION_WEST)
+		{
+			var dx = w * Math.max(0, Math.min(1, size));
+			points = [new mxPoint(x + dx, y), new mxPoint(x + w, y), new mxPoint(x + w - dx, cy),
+							new mxPoint(x + w, y + h), new mxPoint(x + dx, y + h),
+							new mxPoint(x, cy), new mxPoint(x + dx, y)];
+		}
+		else if (direction == mxConstants.DIRECTION_NORTH)
+		{
+			var dy = h * Math.max(0, Math.min(1, size));
+			points = [new mxPoint(x, y + dy), new mxPoint(cx, y), new mxPoint(x + w, y + dy),
+							new mxPoint(x + w, y + h), new mxPoint(cx, y + h - dy),
+							new mxPoint(x, y + h), new mxPoint(x, y + dy)];
+		}
+		else
+		{
+			var dy = h * Math.max(0, Math.min(1, size));
+			points = [new mxPoint(x, y), new mxPoint(cx, y + dy), new mxPoint(x + w, y),
+							new mxPoint(x + w, y + h - dy), new mxPoint(cx, y + h),
+							new mxPoint(x, y + h - dy), new mxPoint(x, y)];
+		}		
 		
 		var p1 = new mxPoint(cx, cy);
 		
@@ -1502,8 +1598,6 @@
 			size = mxUtils.getValue(vertex.style, 'size', size);
 		}
 		
-		var dx = bounds.width * Math.max(0, Math.min(1, size));
-		
 		var x = bounds.x;
 		var y = bounds.y;
 		var w = bounds.width;
@@ -1512,10 +1606,29 @@
 		var cx = bounds.getCenterX();
 		var cy = bounds.getCenterY();
 		
-		var points = [new mxPoint(x + dx, y), new mxPoint(x + w - dx, y), new mxPoint(x + w, cy),
+		var direction = (vertex != null) ? mxUtils.getValue(
+				vertex.style, mxConstants.STYLE_DIRECTION,
+				mxConstants.DIRECTION_EAST) : mxConstants.DIRECTION_EAST;
+		var vertical = direction == mxConstants.DIRECTION_NORTH
+				|| direction == mxConstants.DIRECTION_SOUTH;
+		
+		var points;
+		
+		if (vertical)
+		{
+			var dy = h * Math.max(0, Math.min(1, size));
+			points = [new mxPoint(cx, y), new mxPoint(x + w, y + dy), new mxPoint(x + w, y + h - dy),
+							new mxPoint(cx, y + h), new mxPoint(x, y + h - dy),
+							new mxPoint(x, y + dy), new mxPoint(cx, y)];
+		}
+		else
+		{
+			var dx = w * Math.max(0, Math.min(1, size));
+			points = [new mxPoint(x + dx, y), new mxPoint(x + w - dx, y), new mxPoint(x + w, cy),
 						new mxPoint(x + w - dx, y + h), new mxPoint(x + dx, y + h),
 						new mxPoint(x, cy), new mxPoint(x + dx, y)];
-		
+		}		
+
 		var p1 = new mxPoint(cx, cy);
 		
 		if (orthogonal)

Plik diff jest za duży
+ 133 - 127
war/js/reader.min.js


Plik diff jest za duży
+ 5 - 2
war/js/shapes.min.js


Plik diff jest za duży
+ 428 - 422
war/js/viewer.min.js


+ 1 - 1
war/package.json

@@ -29,4 +29,4 @@
   "devDependencies": {
     "electron": "^1.7.5"
   }
-}
+}

+ 95 - 0
war/shapes/mxArrows.js

@@ -56,6 +56,66 @@ mxShapeArrows2Arrow.prototype.paintVertexShape = function(c, x, y, w, h)
 	c.fillAndStroke();
 };
 
+mxShapeArrows2Arrow.prototype.getLabelBounds = function(rect)
+{
+	if (mxUtils.getValue(this.style, "boundedLbl", false))
+	{
+		var w = rect.width;
+		var h = rect.height;
+		
+		var dy, dx;
+		var direction = this.direction || mxConstants.DIRECTION_EAST;
+		
+		if (mxUtils.getValue(this.style, "flipH", false))
+		{
+			if (direction == mxConstants.DIRECTION_WEST)
+				direction = mxConstants.DIRECTION_EAST;
+			else if (direction == mxConstants.DIRECTION_EAST)
+				direction = mxConstants.DIRECTION_WEST;
+		}
+		
+		if (mxUtils.getValue(this.style, "flipV", false))
+		{
+			if (direction == mxConstants.DIRECTION_NORTH)
+				direction = mxConstants.DIRECTION_SOUTH;
+			else if (direction == mxConstants.DIRECTION_SOUTH)
+				direction = mxConstants.DIRECTION_NORTH;
+		}
+		
+		
+		if (direction == mxConstants.DIRECTION_NORTH
+				|| direction == mxConstants.DIRECTION_SOUTH)
+		{
+			dy = w * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
+			dx = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
+		}
+		else
+		{
+			dy = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
+			dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
+		}
+		
+		if (direction == mxConstants.DIRECTION_EAST)
+		{
+			return new mxRectangle(rect.x, rect.y + dy, w - dx, h - 2 * dy);
+		}
+		else if (direction == mxConstants.DIRECTION_WEST)
+		{
+			return new mxRectangle(rect.x + dx, rect.y + dy, w - dx, h - 2 * dy);
+		}
+		else if (direction == mxConstants.DIRECTION_NORTH)
+		{
+			return new mxRectangle(rect.x + dy, rect.y + dx, w - 2 * dy, h - dx);
+		}
+		else
+		{
+			return new mxRectangle(rect.x + dy, rect.y, w - 2 * dy, h - dx);
+		}
+	}
+	
+	return rect;
+};
+
 mxCellRenderer.registerShape(mxShapeArrows2Arrow.prototype.cst.ARROW, mxShapeArrows2Arrow);
 
 mxShapeArrows2Arrow.prototype.constraints = null;
@@ -143,6 +203,41 @@ mxShapeArrows2TwoWayArrow.prototype.paintVertexShape = function(c, x, y, w, h)
 	c.fillAndStroke();
 };
 
+mxShapeArrows2TwoWayArrow.prototype.getLabelBounds = function(rect)
+{
+	if (mxUtils.getValue(this.style, "boundedLbl", false))
+	{
+		var w = rect.width;
+		var h = rect.height;
+		var vertical = this.direction == mxConstants.DIRECTION_NORTH
+						|| this.direction == mxConstants.DIRECTION_SOUTH;
+
+		var dy, dx;
+		
+		if (vertical)
+		{
+			dy = w * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
+			dx = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
+		}
+		else
+		{
+			dy = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
+			dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
+		}
+		
+		if (vertical)
+		{
+			return new mxRectangle(rect.x + dy, rect.y + dx, w - 2 * dy, h - 2 * dx);
+		}
+		else
+		{
+			return new mxRectangle(rect.x + dx, rect.y + dy, w - 2 * dx, h - 2 * dy);
+		}
+	}
+	
+	return rect;
+};
+
 mxCellRenderer.registerShape(mxShapeArrows2TwoWayArrow.prototype.cst.TWO_WAY_ARROW, mxShapeArrows2TwoWayArrow);
 
 mxShapeArrows2TwoWayArrow.prototype.constraints = null;