diff options
| author | Alon Levy <alon@pobox.com> | 2015-04-05 18:08:55 +0300 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2015-04-05 18:10:24 +0300 |
| commit | 574cc751946fa0949a484ef1109682b57a53ef89 (patch) | |
| tree | b03d72f1aa4ee61b5e707f29ffc9aa788c85fb37 /src/client/view/graph_view.js | |
| parent | 18194d66ebe18a15fe2e3837f024740ffd5d146a (diff) | |
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).
Diffstat (limited to 'src/client/view/graph_view.js')
| -rw-r--r-- | src/client/view/graph_view.js | 10 |
1 files changed, 4 insertions, 6 deletions
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); } |
