瀏覽代碼

8.9.2 release

Former-commit-id: b9392203f3bea81209addbf28dc07cf4663175ff
Gaudenz Alder 7 年之前
父節點
當前提交
fc9214f760

+ 7 - 0
ChangeLog

@@ -1,3 +1,10 @@
+06-JUL-2018: 8.9.2
+
+- Enables tags dialog in read-only files
+- Fixes cell detection in fast preview
+- Fixes improved shape search index
+- Fixes undo for webcola plugin
+
 04-JUL-2018: 8.9.1
 
 - Fixes initial scroll offset in minimal UI

+ 1 - 1
VERSION

@@ -1 +1 @@
-8.9.1
+8.9.2

+ 1 - 1
src/main/webapp/cache.manifest

@@ -1,7 +1,7 @@
 CACHE MANIFEST
 
 # THIS FILE WAS GENERATED. DO NOT MODIFY!
-# 07/04/2018 09:49 PM
+# 07/06/2018 02:28 PM
 
 app.html
 index.html?offline=1

文件差異過大導致無法顯示
+ 281 - 280
src/main/webapp/js/app.min.js


文件差異過大導致無法顯示
+ 405 - 404
src/main/webapp/js/atlas-viewer.min.js


文件差異過大導致無法顯示
+ 128 - 127
src/main/webapp/js/atlas.min.js


+ 7 - 0
src/main/webapp/js/diagramly/Dialogs.js

@@ -6323,6 +6323,13 @@ var TagsWindow = function(editorUi, x, y, w, h)
 		{
 			graph.setSelectionCells(cells);
 		}
+		else
+		{
+			for (var i = 0; i < cells.length; i++)
+			{
+				graph.highlightCell(cells[i]);
+			}
+		}
 	});
 	
 	showBtn.setAttribute('title', mxResources.get('show'));

+ 1 - 1
src/main/webapp/js/diagramly/EditorUi.js

@@ -10663,7 +10663,7 @@
 		this.actions.get('makeCopy').setEnabled(file != null && !file.isRestricted());
 		this.actions.get('editDiagram').setEnabled(active && (file == null || !file.isRestricted()));
 		this.actions.get('publishLink').setEnabled(file != null && !file.isRestricted());
-		this.actions.get('tags').setEnabled(active && (file == null || !file.isRestricted()));
+		this.actions.get('tags').setEnabled(this.diagramContainer.style.visibility != 'hidden');
 		this.actions.get('find').setEnabled(this.diagramContainer.style.visibility != 'hidden');
 		this.actions.get('layers').setEnabled(this.diagramContainer.style.visibility != 'hidden');
 		this.actions.get('outline').setEnabled(this.diagramContainer.style.visibility != 'hidden');

文件差異過大導致無法顯示
+ 8 - 9
src/main/webapp/js/diagramly/sidebar/Sidebar.js


文件差異過大導致無法顯示
+ 45 - 44
src/main/webapp/js/embed-static.min.js


+ 25 - 25
src/main/webapp/js/mxgraph/Format.js

@@ -3169,37 +3169,37 @@ TextFormatPanel.prototype.addFont = function(container)
 		
 		var btns = [
 		        this.editorUi.toolbar.addButton('geSprite-insertcolumnbefore', mxResources.get('insertColumnBefore'),
-				function()
+	     		mxUtils.bind(this, function()
 				{
 					try
 					{
-				        	if (currentTable != null)
-				        	{
-				        		graph.selectNode(graph.insertColumn(currentTable, (tableCell != null) ? tableCell.cellIndex : 0));
-				        	}
+				       	if (currentTable != null)
+				       	{
+				       		graph.selectNode(graph.insertColumn(currentTable, (tableCell != null) ? tableCell.cellIndex : 0));
+				       	}
 					}
 					catch (e)
 					{
-						alert(e);
+						this.editorUi.handleError(e);
 					}
-				}, tablePanel),
+				}), tablePanel),
 				this.editorUi.toolbar.addButton('geSprite-insertcolumnafter', mxResources.get('insertColumnAfter'),
-				function()
+				mxUtils.bind(this, function()
 				{
 					try
 					{
 						if (currentTable != null)
-				        	{
-								graph.selectNode(graph.insertColumn(currentTable, (tableCell != null) ? tableCell.cellIndex + 1 : -1));
-				        	}
+				       	{
+							graph.selectNode(graph.insertColumn(currentTable, (tableCell != null) ? tableCell.cellIndex + 1 : -1));
+				       	}
 					}
 					catch (e)
 					{
-						alert(e);
+						this.editorUi.handleError(e);
 					}
-				}, tablePanel),
+				}), tablePanel),
 				this.editorUi.toolbar.addButton('geSprite-deletecolumn', mxResources.get('deleteColumn'),
-				function()
+				mxUtils.bind(this, function()
 				{
 					try
 					{
@@ -3210,11 +3210,11 @@ TextFormatPanel.prototype.addFont = function(container)
 					}
 					catch (e)
 					{
-						alert(e);
+						this.editorUi.handleError(e);
 					}
-				}, tablePanel),
+				}), tablePanel),
 				this.editorUi.toolbar.addButton('geSprite-insertrowbefore', mxResources.get('insertRowBefore'),
-				function()
+				mxUtils.bind(this, function()
 				{
 					try
 					{
@@ -3225,11 +3225,11 @@ TextFormatPanel.prototype.addFont = function(container)
 					}
 					catch (e)
 					{
-						alert(e);
+						this.editorUi.handleError(e);
 					}
-				}, tablePanel),
+				}), tablePanel),
 				this.editorUi.toolbar.addButton('geSprite-insertrowafter', mxResources.get('insertRowAfter'),
-				function()
+				mxUtils.bind(this, function()
 				{
 					try
 					{
@@ -3240,11 +3240,11 @@ TextFormatPanel.prototype.addFont = function(container)
 					}
 					catch (e)
 					{
-						alert(e);
+						this.editorUi.handleError(e);
 					}
-				}, tablePanel),
+				}), tablePanel),
 				this.editorUi.toolbar.addButton('geSprite-deleterow', mxResources.get('deleteRow'),
-				function()
+				mxUtils.bind(this, function()
 				{
 					try
 					{
@@ -3255,9 +3255,9 @@ TextFormatPanel.prototype.addFont = function(container)
 					}
 					catch (e)
 					{
-						alert(e);
+						this.editorUi.handleError(e);
 					}
-				}, tablePanel)];
+				}), tablePanel)];
 		this.styleButtons(btns);
 		btns[2].style.marginRight = '9px';
 		

+ 65 - 5
src/main/webapp/js/mxgraph/Graph.js

@@ -1144,19 +1144,70 @@ Graph.prototype.init = function(container)
 	/**
 	 * Function: getCellAt
 	 * 
-	 * Overrides to transform incoming coordinates.
+	 * Needs to modify original method for recursive call.
 	 */
 	Graph.prototype.getCellAt = function(x, y, parent, vertices, edges, ignoreFn)
 	{
 		if (this.useCssTransforms)
 		{
-			x /= this.currentScale - this.currentTranslate.x;
-			y /= this.currentScale - this.currentTranslate.y;
+			x = x / this.currentScale - this.currentTranslate.x;
+			y = y / this.currentScale - this.currentTranslate.y;
 		}
 		
-		return mxGraph.prototype.getCellAt.apply(this, arguments);
+		return this.getScaledCellAt.apply(this, arguments);
 	};
 
+	/**
+	 * Function: getScaledCellAt
+	 * 
+	 * Overridden for recursion.
+	 */
+	Graph.prototype.getScaledCellAt = function(x, y, parent, vertices, edges, ignoreFn)
+	{
+		vertices = (vertices != null) ? vertices : true;
+		edges = (edges != null) ? edges : true;
+
+		if (parent == null)
+		{
+			parent = this.getCurrentRoot();
+			
+			if (parent == null)
+			{
+				parent = this.getModel().getRoot();
+			}
+		}
+
+		if (parent != null)
+		{
+			var childCount = this.model.getChildCount(parent);
+			
+			for (var i = childCount - 1; i >= 0; i--)
+			{
+				var cell = this.model.getChildAt(parent, i);
+				var result = this.getScaledCellAt(x, y, cell, vertices, edges, ignoreFn);
+				
+				if (result != null)
+				{
+					return result;
+				}
+				else if (this.isCellVisible(cell) && (edges && this.model.isEdge(cell) ||
+					vertices && this.model.isVertex(cell)))
+				{
+					var state = this.view.getState(cell);
+
+					if (state != null && (ignoreFn == null || !ignoreFn(state, x, y)) &&
+						this.intersects(state, x, y))
+					{
+						return cell;
+					}
+				}
+			}
+		}
+		
+		return null;
+	};
+
+
 	/**
 	 * Function: repaint
 	 * 
@@ -6363,7 +6414,16 @@ if (typeof mxVertexHandler != 'undefined')
 		Graph.prototype.insertRow = function(table, index)
 		{
 			var bd = table.tBodies[0];
-			var cols = (bd.rows.length > 0) ? bd.rows[0].cells.length : 1;
+			var cells = bd.rows[0].cells;
+			var cols = 0;
+			
+			// Counts columns including colspans
+			for (var i = 0; i < cells.length; i++)
+			{
+				var colspan = cells[i].getAttribute('colspan');
+				cols = (colspan != null) ? parseInt(colspan) : 1;
+			}
+			
 			var row = bd.insertRow(index);
 			
 			for (var i = 0; i < cols; i++)

+ 1 - 1
src/main/webapp/js/mxgraph/Sidebar.js

@@ -944,7 +944,7 @@ Sidebar.prototype.addGeneralPalette = function(expand)
 	 	this.createVertexTemplateEntry('shape=tape;whiteSpace=wrap;html=1;', 120, 100, '', 'Tape'),
 	 	this.createVertexTemplateEntry('shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;', 80, 100, '', 'Note'),
 	    this.createVertexTemplateEntry('shape=card;whiteSpace=wrap;html=1;', 80, 100, '', 'Card'),
-	    this.createVertexTemplateEntry('shape=callout;whiteSpace=wrap;html=1;perimeter=calloutPerimeter;', 120, 80, '', 'Callout'),
+	    this.createVertexTemplateEntry('shape=callout;whiteSpace=wrap;html=1;perimeter=calloutPerimeter;', 120, 80, '', 'Callout', null, null, 'bubble chat thought speech message'),
 	 	this.createVertexTemplateEntry('shape=umlActor;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;html=1;outlineConnect=0;', 30, 60, 'Actor', 'Actor', false, null, 'user person human stickman'),
 	 	this.addEntry('curve', mxUtils.bind(this, function()
 	 	{

文件差異過大導致無法顯示
+ 45 - 44
src/main/webapp/js/reader.min.js


文件差異過大導致無法顯示
+ 405 - 404
src/main/webapp/js/viewer.min.js


+ 13 - 4
src/main/webapp/plugins/tickets.js

@@ -194,6 +194,7 @@ Draw.loadPlugin(function(ui)
 	{
 		if (config != null && (!spin || ui.spinner.spin(document.body, mxResources.get('loading') + '...')))
 		{
+			var validate = false;
 			var pending = 0;
 			
 			graph.view.states.visit(function(id, state)
@@ -215,15 +216,23 @@ Draw.loadPlugin(function(ui)
 							if (updateStyle(state.cell, ticket) |
 								updateData(state.cell, ticket))
 							{
-								state.style = null;
 								graph.view.invalidate(state.cell, true, false);
-								graph.view.validate(state.cell);
+								state.style = null;
+								validate = true;
 							}
 						}
 						
-						if (spin && pending == 0)
+						if (pending == 0)
 						{
-							ui.spinner.stop();
+							if (spin)
+							{
+								ui.spinner.stop();
+							}
+							
+							if (validate)
+							{
+								graph.view.validate();
+							}
 						}
 					})
 				}

+ 17 - 5
src/main/webapp/plugins/webcola/mxWebColaAdaptor.js

@@ -106,7 +106,7 @@ mxWebColaAdaptor.prototype.defaultValues = {
   keepRunning: false // overrides all other options for a forces-all-the-time mode
 };
 
-mxWebColaAdaptor.prototype.updatePositions = function()
+mxWebColaAdaptor.prototype.updatePositions = function(isUndoable)
   /**
    * Default method for updating positions
    * Should be overridden by the caller/user of the adaptor
@@ -143,7 +143,7 @@ mxWebColaAdaptor.prototype.step = function (colaAdaptor)
 {
   if ('doAnimations' in this.options && this.options.doAnimations)
   {
-    this.updatePositions();
+    this.updatePositions(false);
   }
 }
 
@@ -226,7 +226,7 @@ mxWebColaAdaptor.prototype.run = function()
         case END:
         {
           console.log("colaAdaptor: end");
-          layout.updatePositions();
+          layout.updatePositions(true);
           if (!options.keepRunning)
           {
             layout.finish();
@@ -272,8 +272,6 @@ mxWebColaAdaptor.prototype.run = function()
   return this.adaptor;
 }
 
-// module.exports = defaultValues;
-
 function getScreenConstraints(layout, width, height)
 /**
  * Returns a set of constraints covering limits of screen
@@ -318,6 +316,20 @@ mxWebColaAdaptor.prototype.graphToLayout = function(graph, movableVertices)
   var inactiveToActiveMap = activeMaps.inactiveToActiveMap;
   var cells = graph.getModel().cells;
   var view = graph.getView();
+  
+  // Ignores cells that have no states
+  var tmp = {};
+  
+  for (var id in cells)
+  {
+	  if (view.getState(cells[id]) != null)
+	  {
+		  tmp[id] = cells[id];
+	  }
+  }
+  
+  cells = tmp;
+  
   var nodeCells = {};
   var linkCells = {};
   var cellIds = {};

+ 92 - 31
src/main/webapp/plugins/webcola/mxWebColaLayout.js

@@ -23,7 +23,7 @@
  * graph - <mxGraph> that contains the cells.
  *
  **/
-function mxWebColaLayout(graph)
+function mxWebColaLayout(graph, layoutType)
 /**
  * Constructs a WebCola-based layout
  * @param graph <mxGraph> that contains the cells.
@@ -31,11 +31,15 @@ function mxWebColaLayout(graph)
  */
 {
   mxGraphLayout.call(this, graph);
+  this.layoutType = layoutType;
+  this.originalGeometries = new mxDictionary();
 };
 
 mxWebColaLayout.prototype = new mxGraphLayout();
 mxWebColaLayout.prototype.constructor = mxWebColaLayout;
 
+mxWebColaLayout.prototype.layoutType = null;
+
 mxWebColaLayout.prototype.execute = function(parent)
   /**
    * Runs re-layouting of the portion of a graph from a given starting cell
@@ -43,14 +47,17 @@ mxWebColaLayout.prototype.execute = function(parent)
    */
 {
   var movableVertices = this.getReachableVertices(parent);
-  this.layout = new mxWebColaAdaptor(this.graph, [600, 600], movableVertices);
-  var self = this;
-  var update = function () {
-    console.log("mxColaLayout: update");
-    self.updateGraph();
-  };
+  var ps = this.graph.getPageSize();
+  this.layout = new mxWebColaAdaptor(this.graph, (this.graph.pageVisible) ?
+		  [ps.width, ps.height] : [800, 800], movableVertices);
+  var initial = true;
+  var update = function (isUndoable) {
+    // console.log("mxColaLayout: update");
+    this.updateGraph(isUndoable, initial);
+    initial = false;
+  }.bind(this);
   this.layout.updatePositions = update;
-  this.resetGraph(this.graph);
+  //this.resetGraph(this.graph);
   var finalLayout = this.computePositions(this.layout);
 };
 
@@ -99,21 +106,29 @@ mxWebColaLayout.prototype.resetGraph = function(graph)
   var model = graph.getModel();
   var cells = model.cells;
   var view = graph.getView();
-  for (var id in cells)
+  model.beginUpdate();
+  try
   {
-    var cell = cells[id];
-    var state = view.getState(cell);
-    var bounds = view.getBoundingBox(state, true);
-    var isFirst = true;
-    if (cell.isVertex()) {
-      var geometry = model.getGeometry(cell);
-      if (geometry != null && typeof geometry != "undefined")
-      {
-        geometry = geometry.clone();
-        geometry.offset = null;
-        model.setGeometry(cell, geometry);
-      }
-    }
+	  for (var id in cells)
+	  {
+	    var cell = cells[id];
+	    var state = view.getState(cell);
+	    var bounds = view.getBoundingBox(state, true);
+	    var isFirst = true;
+	    if (cell.isVertex()) {
+	      var geometry = model.getGeometry(cell);
+	      if (geometry != null && typeof geometry != "undefined")
+	      {
+	        geometry = geometry.clone();
+	        geometry.offset = null;
+	        model.setGeometry(cell, geometry);
+	      }
+	    }
+	  }
+  }
+  finally
+  {
+	  model.endUpdate();
   }
 }
 
@@ -184,19 +199,23 @@ mxWebColaLayout.prototype.adjustChildOffsets = function(model, groupCell)
 {
   if (groupCell.children == null || groupCell.children.length == 0)
     return;
+  
   var groupBounds = model.getGeometry(groupCell);
   var offsetX = groupBounds.x;
   var offsetY = groupBounds.y;
   var cellsToVisit = [];
   cellsToVisit = cellsToVisit.concat(groupCell.children);
+  
   while (cellsToVisit.length > 0)
   {
     var child = cellsToVisit.shift();
+    
     if (child.isVertex())
     {
       if (this.layout.isLeafOrCollapsed(child))
       {
         var geometry = model.getGeometry(child);
+        
         if (geometry != null && typeof geometry != "undefined")
         {
           geometry = geometry.clone();
@@ -213,12 +232,11 @@ mxWebColaLayout.prototype.adjustChildOffsets = function(model, groupCell)
   }
 }
 
-mxWebColaLayout.prototype.updateGraph = function()
+mxWebColaLayout.prototype.updateGraph = function(isUndoable = false, initial = false)
   /**
    * Updates graph based on layout's vertex/group positions
    */
 {
-  console.log("updating graph");
   // find X, Y ranges first
   var minX = 1000000;
   var maxX = -1000000;
@@ -240,34 +258,70 @@ mxWebColaLayout.prototype.updateGraph = function()
   var spanY = maxY - minY;
 
   var model = this.graph.getModel();
-  model.beginUpdate();
+  if (isUndoable)
+  {
+    model.beginUpdate();
+  }
   try
   {
     var cells = model.cells;
     var view = this.graph.getView();
+    
     // scan leaves and edges
     for (var id in cells)
     {
       var cell = cells[id];
       var state = view.getState(cell);
       var bounds = view.getBoundingBox(state, true);
+      
       if (cell.isVertex() && this.layout.isLeafOrCollapsed(cell))
       {
         var nodeId = this.layout.cellToNode[id];
+        
         if (typeof nodeId == "undefined")
           continue;
+        
         var node = this.layout.adaptor._nodes[nodeId];
         var geometry = model.getGeometry(cell);
-        if (geometry != null && typeof geometry != "undefined")
+        
+        if (geometry != null)
         {
-          geometry = geometry.clone();
+        	// First run creates a temporary geometry that can
+        	// be changed in-place to update the view and keeps
+        	// a copy of the original geometry to use in the
+        	// final undoable edit to force a change event
+          if (initial)
+          {
+        	this.originalGeometries.put(cell, geometry);
+            geometry = geometry.clone();
+            
+    	    if (model.isVertex(cell))
+    	    {
+   		        geometry.offset = null;
+    	    }
+          }
+          
           geometry.x = node.x - minX;
           geometry.y = node.y - minY;
-          model.setGeometry(cell, geometry);
+          
+          if (isUndoable)
+          {
+        	  // Restores original geometry for the change to be detected
+          	cell.geometry = this.originalGeometries.get(cell);
+            model.setGeometry(cell, geometry);
+          }
+          else if (initial)
+          {
+        	  cell.geometry = geometry;
+          }
+          else
+          {
+            this.graph.view.invalidate(cell, true, true);
+          }
         }
         else
         {
-          alert("vertex cell id:" + id + " has no geometry!");
+          console.log("ERROR: vertex cell id:" + id + " has no geometry!");
         }
       }
       else if (cell.isEdge())
@@ -294,7 +348,14 @@ mxWebColaLayout.prototype.updateGraph = function()
   }
   finally
   {
-    model.endUpdate();
+    if (isUndoable)
+    {
+      model.endUpdate();
+    }
+    else
+    {
+      this.graph.view.validate();
+    }
+    // console.log("Updated graph, undoable=" + isUndoable + " undo level=" + this.graph.model.updateLevel);
   }
-
 }