summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLV-426 <lv-426@taproot.org.il>2014-11-23 11:35:36 +0200
committerLV-426 <lv-426@taproot.org.il>2014-11-23 11:35:36 +0200
commit10a210bb8eff63568e9500251559e224a9df07ab (patch)
tree3cd42f7b6d1ef50aee860821a1ff5bf07d05eaf1 /src
parentaf20dd47d3cb254d4dd2638264fe79385a199832 (diff)
call graph update via presenter, rm graph obj. mangling
Diffstat (limited to 'src')
-rw-r--r--src/rz_core.js33
-rw-r--r--src/textanalysis.js2
-rw-r--r--src/textanalysis.ui.js4
-rw-r--r--src/view/timeline.js4
4 files changed, 23 insertions, 20 deletions
diff --git a/src/rz_core.js b/src/rz_core.js
index ef06040b..34969b8a 100644
--- a/src/rz_core.js
+++ b/src/rz_core.js
@@ -101,7 +101,6 @@ var initDrawingArea = function () {
.on("drag", dragged)
.on("dragend", dragended);
- graph.update = update;
// $('#canvas_d3').dblclick(canvas_handler_dblclick); - see #138
}
@@ -153,7 +152,7 @@ function canvas_handler_dblclick(){
n.name = ''; // will be set by user
graph.addNode(n);
- graph.update();
+ update_view__graph();
var n_ve = locate_visual_element(n); // locate visual element
@@ -182,7 +181,10 @@ var selected_class = function(node) {
return selection ? (node_selected(node) ? "selected" : "notselected") : "";
}
-function update(no_relayout) {
+/**
+ * update view: graph
+ */
+function update_view__graph(no_relayout) {
var node,
link,
link_g,
@@ -229,7 +231,7 @@ function update(no_relayout) {
view.edge_info.on_delete(function () {
graph.removeLink(that.link);
- graph.update(true);
+ update_view__graph(true);
view.edge_info.hide();
});
view.edge_info.show(d);
@@ -238,7 +240,7 @@ function update(no_relayout) {
highlight(dst);
src.state = 'chosen';
dst.state = 'chosen';
- graph.update(true);
+ update_view__graph(true);
});
link.attr("class", function(d, i){
@@ -361,7 +363,7 @@ function update(no_relayout) {
} else {
removeHighlight();
}
- update(true);
+ update_view__graph(true);
});
//if(graphstate==="GANTT"){
@@ -643,13 +645,13 @@ function showInfo(d, i) {
}
graph.editType(d.id,d.type,$('#edittype').val());
graph.editURL(d.id, d.type, $('#editurl').val());
- graph.update(true);
+ update_view__graph(true);
return false;
});
view.node_info.on_delete(function() {
if (confirm('This node and all its connections will be deleted, are you sure?')) {
graph.removeNode(d.id, null);
- graph.update(false);
+ update_view__graph(false);
view.node_info.hide();
}
});
@@ -657,7 +659,7 @@ function showInfo(d, i) {
removeHighlight();
view.node_info.hide();
}
- graph.update(true);
+ update_view__graph(true);
}
function mousedown() {
@@ -667,7 +669,7 @@ function mousedown() {
$('.editlinkinfo').css('left', 0);
removeHighlight();
view.hide();
- graph.update(true);
+ update_view__graph(true);
}
function AddedUnique(newnode) {
@@ -690,7 +692,7 @@ $('#editform').keypress(function(e) {
var newname = element.val();
var d = element.data().d;
graph.editName(d.id, newname);
- graph.update(true);
+ update_view__graph(true);
return false;
}
});
@@ -728,12 +730,12 @@ function editLink(link, d, i) {
graph.editLink(d.__src.id, d.__dst.id, $('#editlinkname').val());
$('.editlinkinfo').css('top', -100);
$('.editlinkinfo').css('left', 0);
- graph.update(true);
+ update_view__graph(true);
return false;
});
- graph.update(true);
+ update_view__graph(true);
}
return {
@@ -742,7 +744,8 @@ return {
load_from_json: function(result) {
graph.load_from_json(result);
recenterZoom();
- update(false);
- }
+ update_view__graph(false);
+ },
+ update_view__graph : update_view__graph,
}
}); /* close define call */
diff --git a/src/textanalysis.js b/src/textanalysis.js
index e5b95f22..d69ad507 100644
--- a/src/textanalysis.js
+++ b/src/textanalysis.js
@@ -443,7 +443,7 @@ var textAnalyser = function (newtext, finalize) {
}
// UPDATE GRAPH ONCE
- graph.update(!finalize && comp.graph_same);
+ rz_core.update_view__graph(!finalize && comp.graph_same);
};
if (finalize) {
diff --git a/src/textanalysis.ui.js b/src/textanalysis.ui.js
index 5d4a1239..8d8fd20a 100644
--- a/src/textanalysis.ui.js
+++ b/src/textanalysis.ui.js
@@ -22,7 +22,7 @@ function analyzeSentence(sentence, finalize)
$('.typeselection').css('left', 0);
break;
}
-
+
var backend_commit = false;
ret.applyToGraph(rz_core.graph, backend_commit);
@@ -70,7 +70,7 @@ function changeType(arg) {
$('.typeselection').html('<table><tr><td style="height:28px"></td></tr><tr><td>' + "Chosen Type: " + nodetype + '</td></tr></table>');
rz_core.graph.findCoordinates(id, null);
}
- rz_core.graph.update(true);
+ rz_core.update_view__graph(true);
}
return {
diff --git a/src/view/timeline.js b/src/view/timeline.js
index 64b766b7..fcc7c53f 100644
--- a/src/view/timeline.js
+++ b/src/view/timeline.js
@@ -12,7 +12,7 @@ function checkSwitch(checkswitch) {
$('body').scrollLeft(0);
graphstate = "GRAPH";
- graph.update();
+ rz_core.update_view__graph();
$('.status').fadeOut(600);
@@ -28,7 +28,7 @@ function checkSwitch(checkswitch) {
graphstate = "GANTT";
- graph.update();
+ rz_core.update_view__graph();
$('.status').fadeIn(600);