summaryrefslogtreecommitdiff
path: root/src/client/view
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/view')
-rw-r--r--src/client/view/graph_view.js6
-rw-r--r--src/client/view/selection.js10
2 files changed, 11 insertions, 5 deletions
diff --git a/src/client/view/graph_view.js b/src/client/view/graph_view.js
index 32540bea..ff7de845 100644
--- a/src/client/view/graph_view.js
+++ b/src/client/view/graph_view.js
@@ -288,7 +288,7 @@ function GraphView(spec) {
graph.links__delete([that.link.id]);
});
view.edge_info.show(d);
- selection.update([src, dst], d3.event.shiftKey);
+ (d3.event.shiftKey? selection.invert : selection.update)([src, dst]);
});
link.attr("class", function(d, i){
@@ -421,7 +421,7 @@ function GraphView(spec) {
}
if (!temporary) {
svgInput.enable(this, d, nodeTextX(d));
- selection.update([d], d3.event.shiftKey);
+ (d3.event.shiftKey ? selection.invert : selection.update)([d]);
showNodeInfo(graph.find_node__by_id(this.parentNode.id));
}
d3.event.stopPropagation();
@@ -484,7 +484,7 @@ function GraphView(spec) {
return;
}
d3.event.stopPropagation();
- selection.update([d], d3.event.shiftKey);
+ (d3.event.shiftKey ? selection.invert : selection.update)([d]);
if(!temporary) {
showNodeInfo(d);
}
diff --git a/src/client/view/selection.js b/src/client/view/selection.js
index 5e24e801..6ac675aa 100644
--- a/src/client/view/selection.js
+++ b/src/client/view/selection.js
@@ -213,9 +213,9 @@ var inner_update = function(nodes)
connectedComponent(nodes);
}
-var update = function(nodes, append)
+var update = function(nodes)
{
- var new_nodes = append ? _.union(root_nodes, nodes) : nodes;
+ var new_nodes = nodes;
var not_same = !arr_compare(new_nodes, root_nodes);
if (not_same) {
@@ -223,6 +223,11 @@ var update = function(nodes, append)
}
}
+var invert = function(nodes)
+{
+ update(_.union(_.difference(root_nodes, nodes), _.difference(nodes, root_nodes)));
+}
+
var setup_toolbar = function(main_graph)
{
var merge_root_selection = function() {
@@ -263,6 +268,7 @@ return {
byVisitors: byVisitors,
connectedComponent: connectedComponent,
clear: clear,
+ invert: invert,
update: update,
selected_class__node: selected_class__node,
selected_class__link: selected_class__link,