diff options
| author | Alon Levy <alon@pobox.com> | 2014-10-06 15:05:49 +0300 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2014-10-07 08:51:43 +0300 |
| commit | 7a0e1027dd7d8c0cbf60f406a64b24c0a9f284b8 (patch) | |
| tree | f88ebbc253eff42b13f730dfc0c6fcf959e3cc4f /scripts | |
| parent | ece695b8a51a749095d692e3bfbbd39061f4cb3b (diff) | |
rhizicore: update: add no_relayout parameter, plus don't keep assigning tick event handler
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/rhizicore.js | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/scripts/rhizicore.js b/scripts/rhizicore.js index d96e7226..0b7253a0 100644 --- a/scripts/rhizicore.js +++ b/scripts/rhizicore.js @@ -24,8 +24,8 @@ var force; function myGraph(el) { - this.update = function(){ - update(); + this.update = function(no_relayout) { + update(no_relayout); } ///FUNCTIONS @@ -488,6 +488,7 @@ function myGraph(el) { .gravity(0.12) .charge(-1800) .size([w, h]) + .on("tick", tick) .start(); nodes = force.nodes(); @@ -498,7 +499,7 @@ function myGraph(el) { exit:'exitlink graph', }; - var update = function() { + var update = function(no_relayout) { link = vis.select("#link-group").selectAll(".link") .data(links); @@ -677,8 +678,6 @@ function myGraph(el) { node.exit().remove(); - force.on("tick", tick); - //update deliverables deliverables = []; for (var i = 0; i < nodes.length; i++) { @@ -696,6 +695,13 @@ function myGraph(el) { force.nodes(nodes) .links(links) .start(); + 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 + tick(); + } else { + force.alpha(0.1).start(); + } } update(); |
