-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactions.js
More file actions
62 lines (56 loc) · 2.45 KB
/
actions.js
File metadata and controls
62 lines (56 loc) · 2.45 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
function startLoaderIcon() {
document.getElementById("loading-go").style.visibility = 'visible';
}
function endLoaderIcon() {
document.getElementById("loading-go").style.visibility = 'hidden';
}
function do_actions() {
var action = $('#actions').find('option:selected').text();
var act_name = $('#act_name').html();
$('#parent_canvas').empty();
$('#parent_canvas').append('<div id="canvas" class="main"></div>');
startLoaderIcon();
if (action == "Load and Draw") {
if (act_name == 'gen') load_generator(true, false, endLoaderIcon,false);
else if(act_name == 'free') load_free(endLoaderIcon);
else load_graph(act_name, true, false, endLoaderIcon,false);
} else if (action == "Load Only") {
if (act_name == 'gen') load_generator(false, false, endLoaderIcon, false);
else if(act_name == 'free') load_free(endLoaderIcon);
else load_graph(act_name, false, false, endLoaderIcon, false);
} else if (action == "Fit Canvas") {
cy.fit();
} else if (action == "Clear Canvas") {
clearCanvas();
} else if (action == "Canvas to Image") {
var jpg64 = cy.jpg();
window.open(jpg64);
} else if (action == "WebGL") {
if (act_name == 'gen') load_generator(true, true, endLoaderIcon,false);
else if(act_name == 'free') load_free(endLoaderIcon)
else load_graph(act_name, true, true, endLoaderIcon,false);
} else if (action == "3D Force Directed") {
if (act_name == 'gen') load_generator(true, true, endLoaderIcon, true);
else if(act_name == 'free') load_free(endLoaderIcon)
else load_graph(act_name, true, true, endLoaderIcon, true);
}
// trigger the graph creation event on the document node
var event = new CustomEvent('newGraph', { detail: action });
document.dispatchEvent(event);
}
function do_saves() {
var output = $('#output').find('option:selected').text();
if(output == "G6 Format") {
server(serverAddr + 'save/g6--'+uuid,function (data) {
$("#outputResults").html(data.results);
});
} else if(output == "Adjacency List") {
} else if(output == "Adjacency Matrix") {
} else if(output == "GraphTea Format") {
window.open(serverAddr + 'tea/currentGraph--'+uuid);
// server(serverAddr + 'tea/currentGraph--'+uuid,function (data) {
// });
} else if(output == "LaTeX") {
window.open(serverAddr + 'tex/currentGraph--'+uuid);
}
}