diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/model/graph.js | 17 | ||||
| -rw-r--r-- | scripts/rhizicore.js | 11 | ||||
| -rw-r--r-- | scripts/textanalysis.js | 7 |
3 files changed, 22 insertions, 13 deletions
diff --git a/scripts/model/graph.js b/scripts/model/graph.js index 6ea6a3e4..26d833e6 100644 --- a/scripts/model/graph.js +++ b/scripts/model/graph.js @@ -1,7 +1,7 @@ "use strict" -define(['signal', 'consts', 'util', 'textanalysis'], function ( - signal, consts, util, textanalysis) { +define(['signal', 'consts', 'util', 'textanalysis','model/util', 'rz_api_backend', 'rz_api_mesh'], function ( + signal, consts, util, textanalysis, model_util, rz_api_backend, rz_api_mesh) { function Graph(el) { @@ -345,6 +345,7 @@ function Graph(el) { /** * editType: + * * @return true if type changed */ this.editType = function(id, state, newtype) { @@ -438,7 +439,7 @@ function Graph(el) { var findNode = function(id, state) { for (var i = 0; i < nodes.length; i++) { if (nodes[i].id === id || nodes[i].state === state) - return nodes[i] + return nodes[i]; }; } @@ -451,7 +452,7 @@ function Graph(el) { } var findNodes = function(id, state) { - //id=id.toLowerCase(); + // id=id.toLowerCase(); var foundNodes = []; for (var i = 0; i < nodes.length; i++) { if ((id && nodes[i].id === id) || (state && nodes[i].state === state)) @@ -463,7 +464,7 @@ function Graph(el) { var findNodeIndex = function(id, state) { for (var i = 0; i < nodes.length; i++) { if ((id && nodes[i].id === id) || (state && nodes[i].state === state)) - return i + return i; }; } @@ -489,7 +490,6 @@ function Graph(el) { } /** - /** * perform initial DB load from backend */ // @ajax-trans @@ -610,6 +610,7 @@ function Graph(el) { this.links = get_links; }; - - return Graph; + return { + Graph: Graph, + }; }); diff --git a/scripts/rhizicore.js b/scripts/rhizicore.js index 2e20edda..f2359382 100644 --- a/scripts/rhizicore.js +++ b/scripts/rhizicore.js @@ -2,7 +2,7 @@ define('rhizicore', ['jquery', 'd3', 'consts', 'signal', 'util', 'history', 'textanalysis', 'model/graph'], -function($, d3, consts, signal, util, history, textanalysis, Graph) { +function($, d3, consts, signal, util, history, textanalysis, model_graph) { var History = history.History; var addednodes = []; @@ -71,7 +71,7 @@ var initDrawingArea = function () { var el = document.body; - graph = new Graph(el); + graph = new model_graph.Graph(el); //Zoom scale behavior in zoom.js zoomObject = d3.behavior.zoom().scaleExtent([0.1, 3]).on("zoom", zoom); @@ -318,6 +318,7 @@ function update(no_relayout) { force.nodes(graph.nodes()) .links(graph.links()) + if (no_relayout) { // XXX If we are stopped we need to update the text of the links at least, // and this is the simplest way @@ -674,6 +675,9 @@ function customColor(type) { case "bubble": color = "rgba(0,0,0,0.2)"; break; + default: + size = '#080808'; + break; } return color; } @@ -719,6 +723,9 @@ function expand(obj){ obj.size = Math.max(obj.savesize, obj.value.length); } +window.graph = graph; +window.force = force; + return { expand: expand, graph: graph, diff --git a/scripts/textanalysis.js b/scripts/textanalysis.js index dc9d1303..e911adf6 100644 --- a/scripts/textanalysis.js +++ b/scripts/textanalysis.js @@ -1,6 +1,6 @@ "use strict"; -define('textanalysis', [], function() { +define('textanalysis', ['model/util', 'model/diff'], function(model_util, model_diff) { var typeindex = 0; var nodetypes = ["person", "project", "skill", "deliverable", "objective"]; var typeStack = []; @@ -379,6 +379,7 @@ var textAnalyser = function (newtext, finalize) { function (link) { return [link.sourceName, link.targetName]; })); + var k, n, l; if (comp.graph_same && !finalize) { if (comp.old_name && comp.new_name) { @@ -389,7 +390,7 @@ var textAnalyser = function (newtext, finalize) { graph.addLinkByName(l.sourceName, l.targetName, l.name, l.state, ret.drop_conjugator_links); } } else { - //REINITIALISE GRAPH (DUMB BUT IT WORKS) + // REINITIALISE GRAPH (DUMB BUT IT WORKS) graph.removeNodes("temp"); graph.removeLinks("temp"); for (k in ret.nodes) { @@ -418,7 +419,7 @@ var textAnalyser = function (newtext, finalize) { graph.commit_diff_set(diff_set); } - //UPDATE GRAPH ONCE + // UPDATE GRAPH ONCE graph.update(!finalize && comp.graph_same); }; |
