|
@@ -1246,6 +1246,378 @@
|
|
|
this.mode = mode;
|
|
|
};
|
|
|
|
|
|
+ /**
|
|
|
+ * Loads the given file descriptor. The descriptor may define the following properties:
|
|
|
+ *
|
|
|
+ * - url: The url to load the data from (proxy is used if CORS is not enabled)
|
|
|
+ * - data: The data to be inserted. If both, data and url are defined, then the data
|
|
|
+ * is preprendended to the data returned from the given URL.
|
|
|
+ * - format: Currently, only 'csv' is supported as an optional value. Default is XML.
|
|
|
+ * - update: Optional URL to fetch updates from (POST request with the page XML).
|
|
|
+ * - interval: Optional interval for fetching updates. Default is 60000 (60 seconds).
|
|
|
+ */
|
|
|
+ EditorUi.prototype.loadDescriptor = function(desc, success, error)
|
|
|
+ {
|
|
|
+ var hash = window.location.hash;
|
|
|
+
|
|
|
+ var loadData = mxUtils.bind(this, function(data)
|
|
|
+ {
|
|
|
+ var realData = (desc.data != null) ? desc.data : '';
|
|
|
+
|
|
|
+ if (data != null && data.length > 0)
|
|
|
+ {
|
|
|
+ if (realData.length > 0)
|
|
|
+ {
|
|
|
+ realData += '\n';
|
|
|
+ }
|
|
|
+
|
|
|
+ realData += data;
|
|
|
+ }
|
|
|
+
|
|
|
+ var xml = (desc.format != 'csv' && realData.length > 0) ? realData : this.emptyDiagramXml;
|
|
|
+ var tempFile = new LocalFile(this, xml, (urlParams['title'] != null) ?
|
|
|
+ decodeURIComponent(urlParams['title']) : this.defaultFilename, true);
|
|
|
+ tempFile.getHash = function()
|
|
|
+ {
|
|
|
+ return hash;
|
|
|
+ };
|
|
|
+ this.fileLoaded(tempFile);
|
|
|
+
|
|
|
+ if (desc.format == 'csv')
|
|
|
+ {
|
|
|
+ this.importCsv(realData, mxUtils.bind(this, function(cells)
|
|
|
+ {
|
|
|
+ this.editor.undoManager.clear();
|
|
|
+ this.editor.setModified(false);
|
|
|
+ this.editor.setStatus('');
|
|
|
+ }));
|
|
|
+ }
|
|
|
+
|
|
|
+ // Installs updates
|
|
|
+ if (desc.update != null)
|
|
|
+ {
|
|
|
+ var interval = (desc.interval != null) ? parseInt(desc.interval) : 60000;
|
|
|
+ var currentThread = null;
|
|
|
+
|
|
|
+ var doUpdate = mxUtils.bind(this, function()
|
|
|
+ {
|
|
|
+ var page = this.currentPage;
|
|
|
+
|
|
|
+ mxUtils.post(desc.update, 'xml=' + encodeURIComponent(
|
|
|
+ mxUtils.getXml(this.editor.getGraphXml())),
|
|
|
+ mxUtils.bind(this, function(req)
|
|
|
+ {
|
|
|
+ if (page === this.currentPage)
|
|
|
+ {
|
|
|
+ if (req.getStatus() >= 200 && req.getStatus() <= 300)
|
|
|
+ {
|
|
|
+ var doc = this.updateDiagram(req.getText());
|
|
|
+ schedule();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ this.handleError({message: mxResources.get('error') + ' ' + req.getStatus()});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }), mxUtils.bind(this, function(err)
|
|
|
+ {
|
|
|
+ this.handleError(err);
|
|
|
+ }));
|
|
|
+ });
|
|
|
+
|
|
|
+ var schedule = mxUtils.bind(this, function()
|
|
|
+ {
|
|
|
+ window.clearTimeout(currentThread);
|
|
|
+ currentThread = window.setTimeout(doUpdate, interval);
|
|
|
+ });
|
|
|
+
|
|
|
+ this.editor.addListener('pageSelected', mxUtils.bind(this, function()
|
|
|
+ {
|
|
|
+ schedule();
|
|
|
+ doUpdate();
|
|
|
+ }));
|
|
|
+
|
|
|
+ schedule();
|
|
|
+ doUpdate();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (success != null)
|
|
|
+ {
|
|
|
+ success();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if (desc.url != null)
|
|
|
+ {
|
|
|
+ var realUrl = desc.url;
|
|
|
+
|
|
|
+ if ((/^https?:\/\//.test(realUrl)) && !this.isCorsEnabledForUrl(realUrl))
|
|
|
+ {
|
|
|
+ realUrl = PROXY_URL + '?url=' + encodeURIComponent(desc.url);
|
|
|
+ }
|
|
|
+
|
|
|
+ // LATER: Remove cache-control header
|
|
|
+ this.loadUrl(realUrl, mxUtils.bind(this, function(data)
|
|
|
+ {
|
|
|
+ loadData(data);
|
|
|
+ }), mxUtils.bind(this, function(err)
|
|
|
+ {
|
|
|
+ if (error != null)
|
|
|
+ {
|
|
|
+ error(err)
|
|
|
+ }
|
|
|
+ }));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ loadData(desc.data);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Translates this point by the given vector.
|
|
|
+ *
|
|
|
+ * @param {number} dx X-coordinate of the translation.
|
|
|
+ * @param {number} dy Y-coordinate of the translation.
|
|
|
+ */
|
|
|
+ EditorUi.prototype.updateDiagram = function(xml)
|
|
|
+ {
|
|
|
+ var doc = null;
|
|
|
+
|
|
|
+ function createOverlay(desc)
|
|
|
+ {
|
|
|
+ var overlay = new mxCellOverlay(desc.image || graph.warningImage,
|
|
|
+ desc.tooltip, desc.align, desc.valign, desc.offset);
|
|
|
+
|
|
|
+ // Installs a handler for clicks on the overlay
|
|
|
+ overlay.addListener(mxEvent.CLICK, function(sender, evt)
|
|
|
+ {
|
|
|
+ editorUi.alert(desc.tooltip);
|
|
|
+ });
|
|
|
+
|
|
|
+ return overlay;
|
|
|
+ };
|
|
|
+
|
|
|
+ if (xml != null && xml.length > 0)
|
|
|
+ {
|
|
|
+ doc = mxUtils.parseXml(xml);
|
|
|
+ var node = (doc != null) ? doc.documentElement : null;
|
|
|
+
|
|
|
+ if (node != null && node.nodeName == 'updates')
|
|
|
+ {
|
|
|
+ var graph = this.editor.graph;
|
|
|
+ var model = graph.getModel();
|
|
|
+ model.beginUpdate();
|
|
|
+ var fit = null;
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ node = node.firstChild;
|
|
|
+
|
|
|
+ while (node != null)
|
|
|
+ {
|
|
|
+ if (node.nodeName == 'update')
|
|
|
+ {
|
|
|
+ // Resolves the cell ID
|
|
|
+ var cell = model.getCell(node.getAttribute('id'));
|
|
|
+
|
|
|
+ if (cell != null)
|
|
|
+ {
|
|
|
+ // Changes the value
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var value = node.getAttribute('value');
|
|
|
+
|
|
|
+ if (value != null)
|
|
|
+ {
|
|
|
+ var valueNode = mxUtils.parseXml(value).documentElement;
|
|
|
+
|
|
|
+ if (valueNode != null)
|
|
|
+ {
|
|
|
+ if (valueNode.getAttribute('replace-value') == '1')
|
|
|
+ {
|
|
|
+ model.setValue(cell, valueNode);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var attrs = valueNode.attributes;
|
|
|
+
|
|
|
+ for (var j = 0; j < attrs.length; j++)
|
|
|
+ {
|
|
|
+ graph.setAttributeForCell(cell, attrs[j].nodeName,
|
|
|
+ (attrs[j].nodeValue.length > 0) ? attrs[j].nodeValue : null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (e)
|
|
|
+ {
|
|
|
+ if (window.console != null)
|
|
|
+ {
|
|
|
+ console.log('Error in value for ' + cell.id + ': ' + e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Changes the style
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var style = node.getAttribute('style');
|
|
|
+
|
|
|
+ if (style != null)
|
|
|
+ {
|
|
|
+ graph.model.setStyle(cell, style);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (e)
|
|
|
+ {
|
|
|
+ if (window.console != null)
|
|
|
+ {
|
|
|
+ console.log('Error in style for ' + cell.id + ': ' + e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Adds or removes an overlay icon
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var icon = node.getAttribute('icon');
|
|
|
+
|
|
|
+ if (icon != null)
|
|
|
+ {
|
|
|
+ var desc = (icon.length > 0) ? JSON.parse(icon) : null;
|
|
|
+
|
|
|
+ if (desc == null || !desc.append)
|
|
|
+ {
|
|
|
+ graph.removeCellOverlays(cell);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (desc != null)
|
|
|
+ {
|
|
|
+ graph.addCellOverlay(cell, createOverlay(desc));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (e)
|
|
|
+ {
|
|
|
+ if (window.console != null)
|
|
|
+ {
|
|
|
+ console.log('Error in icon for ' + cell.id + ': ' + e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Replaces the geometry
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var geo = node.getAttribute('geometry');
|
|
|
+
|
|
|
+ if (geo != null)
|
|
|
+ {
|
|
|
+ geo = JSON.parse(geo);
|
|
|
+ var curr = graph.getCellGeometry(cell);
|
|
|
+
|
|
|
+ if (curr != null)
|
|
|
+ {
|
|
|
+ curr = curr.clone();
|
|
|
+
|
|
|
+ // Partially overwrites geometry
|
|
|
+ for (key in geo)
|
|
|
+ {
|
|
|
+ var val = parseFloat(geo[key]);
|
|
|
+
|
|
|
+ if (key == 'dx')
|
|
|
+ {
|
|
|
+ curr.x += val;
|
|
|
+ }
|
|
|
+ else if (key == 'dy')
|
|
|
+ {
|
|
|
+ curr.y += val;
|
|
|
+ }
|
|
|
+ else if (key == 'dw')
|
|
|
+ {
|
|
|
+ curr.width += val;
|
|
|
+ }
|
|
|
+ else if (key == 'dh')
|
|
|
+ {
|
|
|
+ curr.height += val;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ curr[key] = parseFloat(geo[key]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ graph.model.setGeometry(cell, curr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (e)
|
|
|
+ {
|
|
|
+ if (window.console != null)
|
|
|
+ {
|
|
|
+ console.log('Error in icon for ' + cell.id + ': ' + e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } // if cell != null
|
|
|
+ } // if node.nodeName == 'update
|
|
|
+ else if (node.nodeName == 'model')
|
|
|
+ {
|
|
|
+ // Finds first child element
|
|
|
+ var dataNode = node.firstChild;
|
|
|
+
|
|
|
+ while (dataNode != null && dataNode.nodeType != mxConstants.NODETYPE_ELEMENT)
|
|
|
+ {
|
|
|
+ dataNode = dataNode.nextSibling;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (dataNode != null)
|
|
|
+ {
|
|
|
+ var dec = new mxCodec(node.firstChild);
|
|
|
+ dec.decode(dataNode, model);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (node.nodeName == 'view')
|
|
|
+ {
|
|
|
+ if (node.hasAttribute('scale'))
|
|
|
+ {
|
|
|
+ graph.view.scale = parseFloat(node.getAttribute('scale'));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (node.hasAttribute('dx') || node.hasAttribute('dy'))
|
|
|
+ {
|
|
|
+ graph.view.translate = new mxPoint(parseFloat(node.getAttribute('dx') || 0),
|
|
|
+ parseFloat(node.getAttribute('dy') || 0));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (node.nodeName == 'fit')
|
|
|
+ {
|
|
|
+ if (node.hasAttribute('max-scale'))
|
|
|
+ {
|
|
|
+ fit = parseFloat(node.getAttribute('max-scale'));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ fit = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ node = node.nextSibling;
|
|
|
+ } // end of while
|
|
|
+ }
|
|
|
+ finally
|
|
|
+ {
|
|
|
+ model.endUpdate();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (fit != null && this.chromelessResize)
|
|
|
+ {
|
|
|
+ this.chromelessResize(true, fit);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return doc;
|
|
|
+ };
|
|
|
+
|
|
|
/**
|
|
|
* Translates this point by the given vector.
|
|
|
*
|
|
@@ -2096,8 +2468,8 @@
|
|
|
|
|
|
if (evt.dataTransfer.files.length > 0)
|
|
|
{
|
|
|
- this.importFiles(evt.dataTransfer.files, 0, 0, this.maxImageSize, mxUtils.bind(this, function(data, mimeType, x, y, w, h, img, doneFn, file)
|
|
|
- {
|
|
|
+ this.importFiles(evt.dataTransfer.files, 0, 0, this.maxImageSize, mxUtils.bind(this, function(data, mimeType, x, y, w, h, img, doneFn, file)
|
|
|
+ {
|
|
|
if (data != null && mimeType.substring(0, 6) == 'image/')
|
|
|
{
|
|
|
var style = 'shape=image;verticalLabelPosition=bottom;verticalAlign=top;aspect=fixed;image=' +
|
|
@@ -2178,7 +2550,7 @@
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- if (file != null && img != null && ((/(\.vsdx)($|\?)/i.test(img)) || /(\.vssx)($|\?)/i.test(img) || (/(\.vsd)($|\?)/i.test(img))))
|
|
|
+ if (file != null && img != null && ((/(\.vsdx?)($|\?)/i.test(img)) || /(\.vssx)($|\?)/i.test(img)))
|
|
|
{
|
|
|
this.importVisio(file, function(xml)
|
|
|
{
|
|
@@ -5232,11 +5604,11 @@
|
|
|
{
|
|
|
if (req.getStatus() >= 200 && req.getStatus() <= 299)
|
|
|
{
|
|
|
- if (success != null)
|
|
|
- {
|
|
|
- var data = req.getText();
|
|
|
-
|
|
|
- // Returns PNG as base64 encoded data URI
|
|
|
+ if (success != null)
|
|
|
+ {
|
|
|
+ var data = req.getText();
|
|
|
+
|
|
|
+ // Returns PNG as base64 encoded data URI
|
|
|
if (binary)
|
|
|
{
|
|
|
// NOTE: This requires BinaryToArray VB script in the page
|
|
@@ -5259,23 +5631,23 @@
|
|
|
dataUriPrefix = (dataUriPrefix != null) ? dataUriPrefix : 'data:image/png;base64,';
|
|
|
data = dataUriPrefix + this.base64Encode(data);
|
|
|
}
|
|
|
-
|
|
|
- success(data);
|
|
|
- }
|
|
|
+
|
|
|
+ success(data);
|
|
|
+ }
|
|
|
}
|
|
|
else if (error != null)
|
|
|
- {
|
|
|
- error({code: App.ERROR_UNKNOWN}, req);
|
|
|
- }
|
|
|
+ {
|
|
|
+ error({code: App.ERROR_UNKNOWN}, req);
|
|
|
+ }
|
|
|
}), function()
|
|
|
{
|
|
|
- if (error != null)
|
|
|
- {
|
|
|
- error({code: App.ERROR_UNKNOWN});
|
|
|
- }
|
|
|
+ if (error != null)
|
|
|
+ {
|
|
|
+ error({code: App.ERROR_UNKNOWN});
|
|
|
+ }
|
|
|
}, binary, this.timeout, function()
|
|
|
{
|
|
|
- if (retry && error != null)
|
|
|
+ if (retry && error != null)
|
|
|
{
|
|
|
error({code: App.ERROR_TIMEOUT, retry: fn});
|
|
|
}
|
|
@@ -5466,18 +5838,18 @@
|
|
|
{
|
|
|
if (/(\.vsd)($|\?)/i.test(filename) && VSD_CONVERT_URL != null)
|
|
|
{
|
|
|
- var formData = new FormData();
|
|
|
- formData.append("file1", file);
|
|
|
+ var formData = new FormData();
|
|
|
+ formData.append('file1', file, filename);
|
|
|
+
|
|
|
+ var xhr = new XMLHttpRequest();
|
|
|
+ xhr.open('POST', VSD_CONVERT_URL);
|
|
|
+ xhr.responseType = 'blob';
|
|
|
|
|
|
- var xhr = new XMLHttpRequest();
|
|
|
- xhr.open('POST', VSD_CONVERT_URL);
|
|
|
- xhr.responseType = "blob";
|
|
|
-
|
|
|
- xhr.onreadystatechange = mxUtils.bind(this, function()
|
|
|
- {
|
|
|
- if (xhr.readyState == 4)
|
|
|
- {
|
|
|
- if (xhr.status >= 200 && xhr.status <= 299)
|
|
|
+ xhr.onreadystatechange = mxUtils.bind(this, function()
|
|
|
+ {
|
|
|
+ if (xhr.readyState == 4)
|
|
|
+ {
|
|
|
+ if (xhr.status >= 200 && xhr.status <= 299)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
@@ -5488,14 +5860,14 @@
|
|
|
onerror(e);
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- onerror({});
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- xhr.send(formData);
|
|
|
+ else
|
|
|
+ {
|
|
|
+ onerror({});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ xhr.send(formData);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -5972,11 +6344,7 @@
|
|
|
}
|
|
|
}));
|
|
|
}
|
|
|
-// else if (file != null && filename != null && ((/(\.vsdx)($|\?)/i.test(filename)) || /(\.vssx)($|\?)/i.test(filename) || /(\.vsd)($|\?)/i.test(filename)))
|
|
|
-// {
|
|
|
-//
|
|
|
-// }
|
|
|
- else if (file != null && filename != null && ((/(\.vsdx)($|\?)/i.test(filename)) || /(\.vssx)($|\?)/i.test(filename) || /(\.vsd)($|\?)/i.test(filename)))
|
|
|
+ else if (file != null && filename != null && ((/(\.vsdx?)($|\?)/i.test(filename)) || /(\.vssx)($|\?)/i.test(filename)))
|
|
|
{
|
|
|
// LATER: done and async are a hack before making this asynchronous
|
|
|
async = true;
|
|
@@ -6384,7 +6752,7 @@
|
|
|
});
|
|
|
|
|
|
// Handles special cases
|
|
|
- if (/(\.vsdx)($|\?)/i.test(file.name) || /(\.vssx)($|\?)/i.test(file.name) || /(\.vsd)($|\?)/i.test(file.name))
|
|
|
+ if (/(\.vsdx?)($|\?)/i.test(file.name) || /(\.vssx)($|\?)/i.test(file.name))
|
|
|
{
|
|
|
fn(null, file.type, x + index * gs, y + index * gs, 240, 160, file.name, function(cells)
|
|
|
{
|
|
@@ -8193,7 +8561,7 @@
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- if (/(\.vsdx)($|\?)/i.test(name) || /(\.vssx)($|\?)/i.test(name) || /(\.vsd)($|\?)/i.test(name))
|
|
|
+ if (/(\.vsdx?)($|\?)/i.test(name) || /(\.vssx)($|\?)/i.test(name))
|
|
|
{
|
|
|
this.importVisio(file, mxUtils.bind(this, function(xml)
|
|
|
{
|
|
@@ -9245,10 +9613,10 @@
|
|
|
if (this.importCsvDialog == null)
|
|
|
{
|
|
|
this.importCsvDialog = new TextareaDialog(this, mxResources.get('csv') + ':',
|
|
|
- Editor.defaultCsvValue, mxUtils.bind(this, function(newValue)
|
|
|
- {
|
|
|
- this.importCsv(newValue);
|
|
|
- }), null, null, 620, 430, null, true, true, mxResources.get('import'));
|
|
|
+ Editor.defaultCsvValue, mxUtils.bind(this, function(newValue)
|
|
|
+ {
|
|
|
+ this.importCsv(newValue);
|
|
|
+ }), null, null, 620, 430, null, true, true, mxResources.get('import'));
|
|
|
}
|
|
|
|
|
|
this.showDialog(this.importCsvDialog.container, 640, 520, true, true);
|
|
@@ -9258,7 +9626,7 @@
|
|
|
/**
|
|
|
* TODO: Move to Editor
|
|
|
*/
|
|
|
- EditorUi.prototype.importCsv = function(text)
|
|
|
+ EditorUi.prototype.importCsv = function(text, done)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
@@ -9289,8 +9657,15 @@
|
|
|
// Delayed after optional layout
|
|
|
var afterInsert = function()
|
|
|
{
|
|
|
- graph.setSelectionCells(select);
|
|
|
- graph.scrollCellToVisible(graph.getSelectionCell());
|
|
|
+ if (done != null)
|
|
|
+ {
|
|
|
+ done(select);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ graph.setSelectionCells(select);
|
|
|
+ graph.scrollCellToVisible(graph.getSelectionCell());
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
// Computes unscaled, untranslated graph bounds
|
|
@@ -9581,9 +9956,9 @@
|
|
|
var cell = cells[i];
|
|
|
|
|
|
for (var j = 0; j < ignore.length; j++)
|
|
|
- {
|
|
|
+ {
|
|
|
graph.setAttributeForCell(cell, mxUtils.trim(ignore[j]), null);
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -9616,27 +9991,27 @@
|
|
|
if (layout == 'circle')
|
|
|
{
|
|
|
var circleLayout = new mxCircleLayout(graph);
|
|
|
- circleLayout.resetEdges = false;
|
|
|
-
|
|
|
- var circleLayoutIsVertexIgnored = circleLayout.isVertexIgnored;
|
|
|
-
|
|
|
- // Ignore other cells
|
|
|
- circleLayout.isVertexIgnored = function(vertex)
|
|
|
- {
|
|
|
- return circleLayoutIsVertexIgnored.apply(this, arguments) ||
|
|
|
- mxUtils.indexOf(cells, vertex) < 0;
|
|
|
- };
|
|
|
-
|
|
|
- this.executeLayout(function()
|
|
|
- {
|
|
|
- circleLayout.execute(graph.getDefaultParent());
|
|
|
- postProcess();
|
|
|
- }, true, afterInsert);
|
|
|
+ circleLayout.resetEdges = false;
|
|
|
+
|
|
|
+ var circleLayoutIsVertexIgnored = circleLayout.isVertexIgnored;
|
|
|
|
|
|
- afterInsert = null;
|
|
|
+ // Ignore other cells
|
|
|
+ circleLayout.isVertexIgnored = function(vertex)
|
|
|
+ {
|
|
|
+ return circleLayoutIsVertexIgnored.apply(this, arguments) ||
|
|
|
+ mxUtils.indexOf(cells, vertex) < 0;
|
|
|
+ };
|
|
|
+
|
|
|
+ this.executeLayout(function()
|
|
|
+ {
|
|
|
+ circleLayout.execute(graph.getDefaultParent());
|
|
|
+ postProcess();
|
|
|
+ }, true, afterInsert);
|
|
|
+
|
|
|
+ afterInsert = null;
|
|
|
}
|
|
|
else if (layout == 'horizontaltree' || layout == 'verticaltree' ||
|
|
|
- (layout == 'auto' && select.length == 2 * cells.length - 1 && roots.length == 1))
|
|
|
+ (layout == 'auto' && select.length == 2 * cells.length - 1 && roots.length == 1))
|
|
|
{
|
|
|
// Required for layouts to work with new cells
|
|
|
graph.view.validate();
|