summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2015-01-21 14:51:21 +0200
committerAlon Levy <alon@pobox.com>2015-01-21 14:52:10 +0200
commitde731590ada4db90749a01b61b81774b91867696 (patch)
tree614650d9c36a870997db2df43a94ce9d7fb3d3f5 /src/client
parent37580fcafdc94c55e880a989dc7103e97ed9edd2 (diff)
Fixes #294 - make selection ignore temporary nodes (bad implementation)
Should have two functions for node+link class setting, one for temporary, one for not, instead of passing this constant (since construction time) value along.
Diffstat (limited to 'src/client')
-rw-r--r--src/client/view/graph_view.js10
-rw-r--r--src/client/view/selection.js8
2 files changed, 9 insertions, 9 deletions
diff --git a/src/client/view/graph_view.js b/src/client/view/graph_view.js
index f8180495..0b336e64 100644
--- a/src/client/view/graph_view.js
+++ b/src/client/view/graph_view.js
@@ -263,12 +263,12 @@ function GraphView(spec) {
link.attr("class", function(d, i){
var temp_and = (d.name && d.name.replace(/ /g,"")=="and" && temporary) ? "temp_and" : "";
- return ["graph link", temp_and, selection.selected_class__link(d)].join(' ');
+ return ["graph link", temp_and, selection.selected_class__link(d, temporary)].join(' ');
});
link.selectAll('path.link')
.attr('class', function(d) {
- return [d.state || "perm", selection.selected_class__link(d), "link graph"].join(' ');
+ return [d.state || "perm", selection.selected_class__link(d, temporary), "link graph"].join(' ');
});
link.exit().remove();
@@ -307,7 +307,7 @@ function GraphView(spec) {
}
})
.attr("class", function(d) {
- return ["linklabel graph", selection.selected_class__link(d)].join(' ');
+ return ["linklabel graph", selection.selected_class__link(d, temporary)].join(' ');
});
linktext.exit().remove();
@@ -324,7 +324,7 @@ function GraphView(spec) {
.call(drag);
node.attr('class', function(d) {
- return ['node', selection.selected_class__node(d)].join(' ');
+ return ['node', selection.selected_class__node(d, temporary)].join(' ');
});
// reorder nodes so selected are last, and so rendered last, and so on top.
// FIXME: with b-ubble removed this is probably broken. actually also before. links are not correctly ordered.
@@ -696,5 +696,5 @@ function GraphView(spec) {
return {
GraphView: GraphView,
};
-
+
});
diff --git a/src/client/view/selection.js b/src/client/view/selection.js
index 090b1a5f..65c318e1 100644
--- a/src/client/view/selection.js
+++ b/src/client/view/selection.js
@@ -116,12 +116,12 @@ var link_selected = function(link) {
return node_selected(link.__src) && node_selected(link.__dst);
}
-var selected_class__node = function(node) {
- return selected_nodes.length > 0 ? (node_selected(node) ? "selected" : "notselected") : "";
+var selected_class__node = function(node, temporary) {
+ return !temporary && selected_nodes.length > 0 ? (node_selected(node) ? "selected" : "notselected") : "";
}
-var selected_class__link = function(link) {
- return selected_nodes.length > 0 ? (link_selected(link) ? "selected" : "notselected") : "";
+var selected_class__link = function(link, temporary) {
+ return !temporary && selected_nodes.length > 0 ? (link_selected(link) ? "selected" : "notselected") : "";
}
var clear = function() {