Просмотр исходного кода

7.2.9 release

Former-commit-id: 655827b41cbd7ace6b92e34c574a663f54caaf00
Gaudenz Alder 8 лет назад
Родитель
Сommit
2a6671f55c

+ 4 - 0
ChangeLog

@@ -1,3 +1,7 @@
+25-AUG-2017: 7.2.9
+
+- Moves clickable label links to tooltip in edit mode
+
 25-AUG-2017: 7.2.8
 
 - Fixes open in new window for local exports

+ 1 - 1
VERSION

@@ -1 +1 @@
-7.2.8
+7.2.9

+ 1 - 1
war/cache.manifest

@@ -1,7 +1,7 @@
 CACHE MANIFEST
 
 # THIS FILE WAS GENERATED. DO NOT MODIFY!
-# 08/25/2017 09:23 AM
+# 08/25/2017 12:29 PM
 
 app.html
 index.html?offline=1

Разница между файлами не показана из-за своего большого размера
+ 153 - 151
war/js/app.min.js


Разница между файлами не показана из-за своего большого размера
+ 120 - 118
war/js/atlas-viewer.min.js


Разница между файлами не показана из-за своего большого размера
+ 272 - 270
war/js/atlas.min.js


+ 25 - 8
war/js/diagramly/Trees.js

@@ -353,7 +353,7 @@ EditorUi.prototype.addTrees = function()
 		{
 			var newSource = target;
 			
-			if (isTreeVertex(target))
+			if (cells != null && isTreeVertex(target))
 			{
 				// Handles only drag from tree or from sidebar with dangling edges
 				for (var i = 0; i < cells.length; i++)
@@ -361,13 +361,13 @@ EditorUi.prototype.addTrees = function()
 					if (isTreeVertex(cells[i]) || (graph.model.isEdge(cells[i]) &&
 						graph.model.getTerminal(cells[i], true) == null))
 					{
-						target = null;
+						target = graph.model.getParent(cells[i]);
 						break;
 					}
 				}
 
 				// Applies distance between previous and current parent for non-sidebar drags
-				if (newSource != null && target == null && this.view.getState(cells[0]) != null)
+				if (newSource != null && target != newSource && this.view.getState(cells[0]) != null)
 				{
 					var edges = graph.getIncomingEdges(cells[0]);
 					
@@ -391,7 +391,7 @@ EditorUi.prototype.addTrees = function()
 
 			result = graphMoveCells.apply(this, arguments);
 			
-			if (result.length == cells.length)
+			if (result != null && cells != null && result.length == cells.length)
 			{
 				for (var i = 0; i < result.length; i++)
 				{
@@ -427,7 +427,7 @@ EditorUi.prototype.addTrees = function()
 								{
 									var temp = newSource;
 									
-									if (temp == null)
+									if (temp == null || temp == graph.model.getParent(cells[i]))
 									{
 										temp = graph.model.getTerminal(edges[0], true);
 									}
@@ -566,8 +566,11 @@ EditorUi.prototype.addTrees = function()
 				clones[1].geometry.x = cell.geometry.x + cell.geometry.width - clones[1].geometry.width; 
 			}
 			
-			clones[1].geometry.x -= pgeo.x;
-			clones[1].geometry.y -= pgeo.y;
+			if (graph.view.currentRoot != parent)
+			{
+				clones[1].geometry.x -= pgeo.x;
+				clones[1].geometry.y -= pgeo.y;
+			}
 			
 			// Moves existing siblings
 			var state = graph.view.getState(cell);
@@ -687,8 +690,16 @@ EditorUi.prototype.addTrees = function()
 			graph.model.setTerminal(clones[0], cell, false);
 
 			// Makes space for new parent
+			var parent = graph.model.getParent(cell);
+			var pgeo = parent.geometry;
 			var subtree = [];
 			
+			if (graph.view.currentRoot != parent)
+			{
+				clones[1].geometry.x -= pgeo.x;
+				clones[1].geometry.y -= pgeo.y;
+			}
+			
 			graph.traverse(cell, true, function(vertex, edge)
 			{
 				if (edge != null)
@@ -725,7 +736,7 @@ EditorUi.prototype.addTrees = function()
 			
 			graph.moveCells(subtree, dx, dy);
 
-			return graph.addCells(clones);
+			return graph.addCells(clones, parent);
 		}
 		finally
 		{
@@ -748,6 +759,12 @@ EditorUi.prototype.addTrees = function()
 			var pgeo = parent.geometry;
 			var targets = [];
 			
+			// Not offset if inside group
+			if (graph.view.currentRoot == parent)
+			{
+				pgeo = new mxRectangle();
+			}
+
 			for (var i = 0; i < edges.length; i++)
 			{
 				var target = graph.model.getTerminal(edges[i], false);

+ 0 - 4
war/js/diagramly/sidebar/Sidebar-Basic.js

@@ -12,14 +12,10 @@
 		
 		this.addPaletteFunctions('basic', mxResources.get('basic'), false,
 		[
-			this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;left=0;right=0;fillColor=none;', 120, 60, '', 'Partial Rectangle'),
 			this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;top=0;bottom=0;fillColor=none;', 120, 60, '', 'Partial Rectangle'),
-			this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;left=0;right=0;top=0;fillColor=none;routingCenterY=0.5;', 120, 60, '', 'Partial Rectangle'),
 			this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;right=0;top=0;bottom=0;fillColor=none;routingCenterX=-0.5;', 120, 60, '', 'Partial Rectangle'),
 			this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;bottom=0;right=0;fillColor=none;', 120, 60, '', 'Partial Rectangle'),
 			this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;top=0;left=0;fillColor=none;', 120, 60, '', 'Partial Rectangle'),
-			this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;bottom=1;right=1;top=0;bottom=1;fillColor=none;routingCenterX=-0.5;', 120, 60, '', 'Partial Rectangle'),
-		 	this.createEdgeTemplateEntry('shape=filledEdge;fixDash=1;rounded=0;endArrow=none;strokeWidth=10;fillColor=#ffffff;edgeStyle=orthogonalEdgeStyle;', 120, 60, '', 'Filled Edge'),
 			this.createVertexTemplateEntry(s2 + '4_point_star', w, h, '', '4 Point Star', null, null, this.getTagsForStencil(gn, '4_point_star', dt).join(' ')),
 			this.createVertexTemplateEntry(s2 + '6_point_star', w, h * 0.9, '', '6 Point Star', null, null, this.getTagsForStencil(gn, '6_point_star', dt).join(' ')),
 			this.createVertexTemplateEntry(s2 + '8_point_star', w, h, '', '8 Point Star', null, null, this.getTagsForStencil(gn, '8_point_star', dt).join(' ')),

Разница между файлами не показана из-за своего большого размера
+ 240 - 238
war/js/embed-static.min.js


+ 14 - 2
war/js/mxgraph/Format.js

@@ -88,7 +88,7 @@ Format.prototype.initSelectionState = function()
 {
 	return {vertices: [], edges: [], x: null, y: null, width: null, height: null, style: {},
 		containsImage: false, containsLabel: false, fill: true, glass: true, rounded: true,
-		comic: true, autoSize: false, image: true, shadow: true};
+		comic: true, autoSize: false, image: true, shadow: true, lineJumps: true};
 };
 
 /**
@@ -174,6 +174,7 @@ Format.prototype.updateSelectionStateForCell = function(result, cell, cells)
 		result.autoSize = result.autoSize || this.isAutoSizeState(state);
 		result.glass = result.glass && this.isGlassState(state);
 		result.rounded = result.rounded && this.isRoundedState(state);
+		result.lineJumps = result.lineJumps && this.isLineJumpState(state);
 		result.comic = result.comic && this.isComicState(state);
 		result.image = result.image && this.isImageState(state);
 		result.shadow = result.shadow && this.isShadowState(state);
@@ -239,6 +240,16 @@ Format.prototype.isRoundedState = function(state)
 			shape == 'doubleArrow' || shape == 'flexArrow' || shape == 'card' || shape == 'umlLifeline');
 };
 
+/**
+ * Returns information about the current selection.
+ */
+Format.prototype.isLineJumpState = function(state)
+{
+	var shape = mxUtils.getValue(state.style, mxConstants.STYLE_SHAPE, null);
+	
+	return shape == 'connector' || shape == 'filledEdge';
+};
+
 /**
  * Returns information about the current selection.
  */
@@ -4203,7 +4214,8 @@ StyleFormatPanel.prototype.addLineJumps = function(container)
 {
 	var ss = this.format.getSelectionState();
 	
-	if (Graph.lineJumpsEnabled && ss.edges.length > 0 && ss.vertices.length == 0)
+	if (Graph.lineJumpsEnabled && ss.edges.length > 0 &&
+		ss.vertices.length == 0 && ss.lineJumps)
 	{
 		container.style.padding = '8px 0px 24px 18px';
 		

+ 109 - 48
war/js/mxgraph/Graph.js

@@ -1054,27 +1054,30 @@ Graph.prototype.labelLinkClicked = function(state, elt, evt)
 	
 	if (href != null && !this.isPageLink(href))
 	{
-		var target = state.view.graph.isBlankLink(href) ?
-			state.view.graph.linkTarget : '_top';
-		href = state.view.graph.getAbsoluteUrl(href);
-
-		// Workaround for blocking in same iframe
-		if (target == '_self' && window != window.top)
-		{
-			window.location.href = href;
-		}
-		else
+		if (!this.isEnabled())
 		{
-			// Avoids page reload for anchors (workaround for IE but used everywhere)
-			if (href.substring(0, this.baseUrl.length) == this.baseUrl &&
-				href.charAt(this.baseUrl.length) == '#' &&
-				target == '_top' && window == window.top)
+			var target = state.view.graph.isBlankLink(href) ?
+				state.view.graph.linkTarget : '_top';
+			href = state.view.graph.getAbsoluteUrl(href);
+	
+			// Workaround for blocking in same iframe
+			if (target == '_self' && window != window.top)
 			{
-				window.location.hash = href.split('#')[1];
+				window.location.href = href;
 			}
 			else
 			{
-				window.open(href, target);
+				// Avoids page reload for anchors (workaround for IE but used everywhere)
+				if (href.substring(0, this.baseUrl.length) == this.baseUrl &&
+					href.charAt(this.baseUrl.length) == '#' &&
+					target == '_top' && window == window.top)
+				{
+					window.location.hash = href.split('#')[1];
+				}
+				else
+				{
+					window.open(href, target);
+				}
 			}
 		}
 		
@@ -1899,6 +1902,19 @@ Graph.prototype.convertValueToString = function(cell)
 	return mxGraph.prototype.convertValueToString.apply(this, arguments);
 };
 
+/**
+ * Returns the link for the given cell.
+ */
+Graph.prototype.getLinksForState = function(state)
+{
+	if (state != null && state.text != null && state.text.node != null)
+	{
+		return state.text.node.getElementsByTagName('a');
+	}
+	
+	return null;
+};
+
 /**
  * Returns the link for the given cell.
  */
@@ -3397,6 +3413,19 @@ HoverIcons.prototype.setCurrentState = function(state)
 					var p0 = pts[i];
 					var list = [];
 					
+					// Ignores waypoint on straight segments
+					if (i < pts.length - 2)
+					{
+						var pn = pts[i + 2];
+						
+						if (mxUtils.ptSegDistSq(p0.x, p0.y, pn.x, pn.y,
+							p1.x, p1.y) < 1 * this.scale * this.scale)
+						{
+							p1 = pn;
+							i++;
+						}
+					}
+					
 					changed = addPoint(0, p0.x, p0.y) || changed;
 					
 					// Processes all previous edges
@@ -5720,6 +5749,8 @@ if (typeof mxVertexHandler != 'undefined')
 		 */
 		Graph.prototype.createLinkForHint = function(link, label)
 		{
+			label = (label != null) ? label : link;
+			
 			var a = document.createElement('a');
 			a.setAttribute('href', this.getAbsoluteUrl(link));
 			a.setAttribute('title', link);
@@ -7188,7 +7219,8 @@ if (typeof mxVertexHandler != 'undefined')
 			
 			this.changeHandler = mxUtils.bind(this, function(sender, evt)
 			{
-				this.updateLinkHint(this.graph.getLinkForCell(this.state.cell));
+				this.updateLinkHint(this.graph.getLinkForCell(this.state.cell),
+					this.graph.getLinksForState(this.state));
 				update();
 			});
 			
@@ -7203,9 +7235,10 @@ if (typeof mxVertexHandler != 'undefined')
 			this.graph.addListener(mxEvent.EDITING_STOPPED, this.editingHandler);
 
 			var link = this.graph.getLinkForCell(this.state.cell);
-			this.updateLinkHint(link);
+			var links = this.graph.getLinksForState(this.state);
+			this.updateLinkHint(link, links);
 			
-			if (link != null)
+			if (link != null || (links != null && links.length > 0))
 			{
 				redraw = true;
 			}
@@ -7216,9 +7249,10 @@ if (typeof mxVertexHandler != 'undefined')
 			}
 		};
 	
-		mxVertexHandler.prototype.updateLinkHint = function(link)
+		mxVertexHandler.prototype.updateLinkHint = function(link, links)
 		{
-			if (link == null || this.graph.getSelectionCount() > 1)
+			if ((link == null && (links == null || links.length == 0)) ||
+				this.graph.getSelectionCount() > 1)
 			{
 				if (this.linkHint != null)
 				{
@@ -7226,7 +7260,7 @@ if (typeof mxVertexHandler != 'undefined')
 					this.linkHint = null;
 				}
 			}
-			else if (link != null)
+			else if (link != null || (links != null && links.length > 0))
 			{
 				if (this.linkHint == null)
 				{
@@ -7235,33 +7269,49 @@ if (typeof mxVertexHandler != 'undefined')
 					this.linkHint.style.fontSize = '90%';
 					this.linkHint.style.opacity = '1';
 					this.linkHint.style.filter = '';
-					this.updateLinkHint(link);
 					
 					this.graph.container.appendChild(this.linkHint);
 				}
 
-				var a = this.graph.createLinkForHint(link, link);
 				this.linkHint.innerHTML = '';
-				this.linkHint.appendChild(a);
-	
-				if (this.graph.isEnabled() && typeof this.graph.editLink === 'function')
-				{
-					var changeLink = document.createElement('img');
-					changeLink.setAttribute('src', IMAGE_PATH + '/edit.gif');
-					changeLink.setAttribute('title', mxResources.get('editLink'));
-					changeLink.setAttribute('width', '11');
-					changeLink.setAttribute('height', '11');
-					changeLink.style.marginLeft = '10px';
-					changeLink.style.marginBottom = '-1px';
-					changeLink.style.cursor = 'pointer';
-					this.linkHint.appendChild(changeLink);
+				
+				if (link != null)
+				{
+					this.linkHint.appendChild(this.graph.createLinkForHint(link));
 					
-					mxEvent.addListener(changeLink, 'click', mxUtils.bind(this, function(evt)
+					if (this.graph.isEnabled() && typeof this.graph.editLink === 'function')
 					{
-						this.graph.setSelectionCell(this.state.cell);
-						this.graph.editLink();
-						mxEvent.consume(evt);
-					}));
+						var changeLink = document.createElement('img');
+						changeLink.setAttribute('src', IMAGE_PATH + '/edit.gif');
+						changeLink.setAttribute('title', mxResources.get('editLink'));
+						changeLink.setAttribute('width', '11');
+						changeLink.setAttribute('height', '11');
+						changeLink.style.marginLeft = '10px';
+						changeLink.style.marginBottom = '-1px';
+						changeLink.style.cursor = 'pointer';
+						this.linkHint.appendChild(changeLink);
+						
+						mxEvent.addListener(changeLink, 'click', mxUtils.bind(this, function(evt)
+						{
+							this.graph.setSelectionCell(this.state.cell);
+							this.graph.editLink();
+							mxEvent.consume(evt);
+						}));
+					}
+				}
+
+				if (links != null)
+				{
+					for (var i = 0; i < links.length; i++)
+					{
+						var div = document.createElement('div');
+						div.style.marginTop = '6px';
+						div.appendChild(this.graph.createLinkForHint(
+								links[i].getAttribute('href'),
+								mxUtils.getTextContent(links[i])));
+						
+						this.linkHint.appendChild(div);
+					}
 				}
 			}
 		};
@@ -7301,7 +7351,8 @@ if (typeof mxVertexHandler != 'undefined')
 			
 			this.changeHandler = mxUtils.bind(this, function(sender, evt)
 			{
-				this.updateLinkHint(this.graph.getLinkForCell(this.state.cell));
+				this.updateLinkHint(this.graph.getLinkForCell(this.state.cell),
+					this.graph.getLinksForState(this.state));
 				update();
 				this.redrawHandles();
 			});
@@ -7309,10 +7360,11 @@ if (typeof mxVertexHandler != 'undefined')
 			this.graph.getModel().addListener(mxEvent.CHANGE, this.changeHandler);
 	
 			var link = this.graph.getLinkForCell(this.state.cell);
+			var links = this.graph.getLinksForState(this.state);
 									
-			if (link != null)
+			if (link != null || (links != null && links.length > 0))
 			{
-				this.updateLinkHint(link);
+				this.updateLinkHint(link, links);
 				this.redrawHandles();
 			}
 		};
@@ -7340,16 +7392,25 @@ if (typeof mxVertexHandler != 'undefined')
 				var c = new mxPoint(this.state.getCenterX(), this.state.getCenterY());
 				var tmp = new mxRectangle(this.state.x, this.state.y - 22, this.state.width + 24, this.state.height + 22);
 				var bb = mxUtils.getBoundingBox(tmp, this.state.style[mxConstants.STYLE_ROTATION] || '0', c);
-				var rs = (bb != null) ? mxUtils.getBoundingBox(this.state, this.state.style[mxConstants.STYLE_ROTATION] || '0') : this.state;
+				var rs = (bb != null) ? mxUtils.getBoundingBox(this.state,
+					this.state.style[mxConstants.STYLE_ROTATION] || '0') : this.state;
+				var tb = (this.state.text != null) ? this.state.text.boundingBox : null;
 				
 				if (bb == null)
 				{
 					bb = this.state;
 				}
 				
+				var b = bb.y + bb.height;
+				
+				if (tb != null)
+				{
+					b = Math.max(b, tb.y + tb.height);
+				}
+				
 				this.linkHint.style.left = Math.round(rs.x + (rs.width - this.linkHint.clientWidth) / 2) + 'px';
-				this.linkHint.style.top = Math.round(bb.y + bb.height + this.verticalOffset / 2 +
-						6 + this.state.view.graph.tolerance) + 'px';
+				this.linkHint.style.top = Math.round(b + this.verticalOffset / 2 + 6 +
+					this.state.view.graph.tolerance) + 'px';
 			}
 		};
 

+ 5 - 5
war/js/mxgraph/Sidebar.js

@@ -965,14 +965,10 @@ Sidebar.prototype.addBasicPalette = function(dir)
 	this.addStencilPalette('basic', mxResources.get('basic'), dir + '/basic.xml',
 		';whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#000000;strokeWidth=2',
 		null, null, null, null, [
-			this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;left=0;right=0;fillColor=none;', 120, 60, '', 'Partial Rectangle'),
 			this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;top=0;bottom=0;fillColor=none;', 120, 60, '', 'Partial Rectangle'),
-			this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;left=0;right=0;top=0;fillColor=none;routingCenterY=0.5;', 120, 60, '', 'Partial Rectangle'),
 			this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;right=0;top=0;bottom=0;fillColor=none;routingCenterX=-0.5;', 120, 60, '', 'Partial Rectangle'),
 			this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;bottom=0;right=0;fillColor=none;', 120, 60, '', 'Partial Rectangle'),
-			this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;top=0;left=0;fillColor=none;', 120, 60, '', 'Partial Rectangle'),
-			this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;bottom=1;right=1;top=0;bottom=1;fillColor=none;routingCenterX=-0.5;', 120, 60, '', 'Partial Rectangle'),
-		 	this.createEdgeTemplateEntry('shape=filledEdge;rounded=0;fixDash=1;endArrow=none;strokeWidth=10;fillColor=#ffffff;edgeStyle=orthogonalEdgeStyle;', 120, 60, '', 'Filled Edge')
+			this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;top=0;left=0;fillColor=none;', 120, 60, '', 'Partial Rectangle')
 	]);
 };
 
@@ -1055,9 +1051,13 @@ Sidebar.prototype.addMiscPalette = function(expand)
 	 	this.createVertexTemplateEntry('icon;html=1;image=' + this.gearImage, 60, 60, 'Icon', 'Icon', false, null, 'icon image symbol'),
 	 	this.createVertexTemplateEntry('label;whiteSpace=wrap;html=1;image=' + this.gearImage, 140, 60, 'Label', 'Label 1', null, null, 'label image icon symbol'),
 	 	this.createVertexTemplateEntry('label;whiteSpace=wrap;html=1;align=center;verticalAlign=bottom;spacingLeft=0;spacingBottom=4;imageAlign=center;imageVerticalAlign=top;image=' + this.gearImage, 120, 80, 'Label', 'Label 2', null, null, 'label image icon symbol'),
+		this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;left=0;right=0;fillColor=none;', 120, 60, '', 'Partial Rectangle'),
+		this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;left=0;right=0;top=0;fillColor=none;routingCenterY=0.5;', 120, 60, '', 'Partial Rectangle'),
+		this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;bottom=1;right=1;top=0;bottom=1;fillColor=none;routingCenterX=-0.5;', 120, 60, '', 'Partial Rectangle'),
 	    this.createEdgeTemplateEntry('shape=flexArrow;endArrow=classic;html=1;fillColor=#ffffff;', 50, 50, '', 'Directional Arrow', null, lineTags + 'directional directed'),
 	    this.createEdgeTemplateEntry('shape=flexArrow;endArrow=classic;startArrow=classic;html=1;fillColor=#ffffff;', 50, 50, '', 'Bidirectional Arrow', null, lineTags + 'bidirectional'),
 	 	this.createEdgeTemplateEntry('edgeStyle=segmentEdgeStyle;endArrow=classic;html=1;', 50, 50, '', 'Manual Line', null, lineTags + 'manual'),
+	 	this.createEdgeTemplateEntry('shape=filledEdge;rounded=0;fixDash=1;endArrow=none;strokeWidth=10;fillColor=#ffffff;edgeStyle=orthogonalEdgeStyle;', 120, 60, '', 'Filled Edge'),
 	 	this.createEdgeTemplateEntry('edgeStyle=elbowEdgeStyle;elbow=horizontal;endArrow=classic;html=1;', 50, 50, '', 'Horizontal Elbow', null, lineTags + 'elbow horizontal'),
 	 	this.createEdgeTemplateEntry('edgeStyle=elbowEdgeStyle;elbow=vertical;endArrow=classic;html=1;', 50, 50, '', 'Vertical Elbow', null, lineTags + 'elbow vertical'),
 	 	this.addEntry('curve', mxUtils.bind(this, function()

Разница между файлами не показана из-за своего большого размера
+ 240 - 238
war/js/reader.min.js


Разница между файлами не показана из-за своего большого размера
+ 120 - 118
war/js/viewer.min.js