From 574cc751946fa0949a484ef1109682b57a53ef89 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Sun, 5 Apr 2015 18:08:55 +0300 Subject: client: selection: enable selection of link via 0 depth selection of both nodes; resolve #393 shift selection still works, but now it's a bit not obvious when you shift select a link: - it acts as inverting the source and destination node. - an alternative could be to special case for both or single or none of the nodes already selected - a correct fix would be to track separately the nodes and links selection states. Right now we only have a nodes selection state (array of root nodes, the ones the user selected, and array of selected nodes, the ones we highlight as such). --- src/client/view/graph_view.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/client/view/graph_view.js') diff --git a/src/client/view/graph_view.js b/src/client/view/graph_view.js index 75bd8cef..f8f1c4ad 100644 --- a/src/client/view/graph_view.js +++ b/src/client/view/graph_view.js @@ -399,7 +399,7 @@ function GraphView(spec) { } if (!temporary) { svgInput.enable(this.querySelector('text'), d, nodeTextX(d)); - (d3.event.shiftKey ? selection.invert : selection.update)([d]); + (d3.event.shiftKey ? selection.invert_nodes : selection.select_nodes)([d]); showNodeInfo(graph.find_node__by_id(model_id_from_dom_id(this.id))); } d3.event.stopPropagation(); @@ -510,16 +510,14 @@ function GraphView(spec) { // after this events bubbles to the svg element return; } - var that = this, - src = this.link.__src, - dst = this.link.__dst; + var that = this; view.edge_info.on_delete(function () { view.edge_info.hide(); graph.links__delete([that.link.id]); }); view.edge_info.show(d); - (d3.event.shiftKey? selection.invert : selection.update)([src, dst]); + (d3.event.shiftKey? selection.invert_link : selection.select_link)(this.link); }); //var selected_N = selection: @@ -682,7 +680,7 @@ function GraphView(spec) { return; } d3.event.stopPropagation(); - (d3.event.shiftKey ? selection.invert : selection.update)([d]); + (d3.event.shiftKey ? selection.invert_nodes : selection.select_nodes)([d]); if(!temporary) { showNodeInfo(d); } -- cgit v1.3.1