summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2015-04-07 19:44:40 +0300
committerAlon Levy <alon@pobox.com>2015-04-09 06:38:17 +0300
commit85d20659bc170577e6df5d5875755aae516b8cf0 (patch)
tree934eb7b271c7c7578a384c3e193b3d147d50cac9 /src/client
parent144e0a6047b90343fe0531f588dcab2cb99168e7 (diff)
client: graph_view,layouts: use atomic nodes_links
Diffstat (limited to 'src/client')
-rw-r--r--src/client/view/graph_view.js10
-rw-r--r--src/client/view/layouts.js5
2 files changed, 10 insertions, 5 deletions
diff --git a/src/client/view/graph_view.js b/src/client/view/graph_view.js
index 564c3a25..cdf98ba2 100644
--- a/src/client/view/graph_view.js
+++ b/src/client/view/graph_view.js
@@ -733,9 +733,10 @@ function GraphView(spec) {
}
function layout__load_graph() {
- layout
- .nodes(graph.nodes().filter(node__is_shown))
- .links(graph.links().filter(link__is_shown));
+ var nodes_subset = graph.nodes().filter(node__is_shown),
+ links_subset = graph.links().filter(link__is_shown);
+
+ layout.nodes_links(nodes_subset, links_subset);
}
function segment_in_segment(inner_low, inner_high, outer_low, outer_high)
@@ -1231,8 +1232,7 @@ function GraphView(spec) {
.size([w, h])
.on("tick", pushRedraw)
.on("end", record_position_to_local_storage)
- .nodes(graph.nodes())
- .links(graph.links())
+ .nodes_links(graph.nodes(), graph.links())
.restore()
.start();
}
diff --git a/src/client/view/layouts.js b/src/client/view/layouts.js
index 8af9e9b6..7d67011e 100644
--- a/src/client/view/layouts.js
+++ b/src/client/view/layouts.js
@@ -95,6 +95,11 @@ function(consts, $, d3, _, rz_core) {
restore: restore,
stop: save,
start: restore,
+ nodes_links: function (nodes, links) {
+ // to update nodes and links atomically, required for stp and other changes
+ layout.nodes(nodes);
+ return layout.links(links);
+ },
// data
graph: graph,
_nodes: [],