webcola.js
1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* WebCola layout plugin.
*/
Draw.loadPlugin(function(ui)
{
mxscript("plugins/webcola/cola.min.js", null, null, null, true);
mxscript("plugins/webcola/mxWebColaAdaptor.js", null, null, null, true);
mxscript("plugins/webcola/mxWebColaLayout.js", null, null, null, true);
// Adds resource for action
mxResources.parse('webColaLayout=WebCola Layout...');
// Adds action
ui.actions.addAction('webColaLayout', function()
{
// TODO: set mxWebColaAdaptor's doAnimations to the value of editorUi.allowAnimation
// TODO: don't record all animation steps as undo states
var graph = ui.editor.graph;
var layout = new mxWebColaLayout(graph);
var parent = graph.getDefaultParent();
layout.execute(parent);
});
var menu = ui.menus.get('layout');
if (menu != null)
{
var oldFunct = menu.funct;
menu.funct = function(menu, parent)
{
oldFunct.apply(this, arguments);
if (typeof window.mxWebColaLayout === 'function')
{
ui.menus.addMenuItems(menu, ['-', 'webColaLayout'], parent);
}
};
}
});