From 56d2d3cd4a556fd88fd3018716a7b3f974a4e305 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Sun, 15 Feb 2015 12:19:55 +0200 Subject: add underscore, implement ctrl-click to append to selection --- src/client/view/selection.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/client/view/selection.js') diff --git a/src/client/view/selection.js b/src/client/view/selection.js index 7cade769..f5d4c895 100644 --- a/src/client/view/selection.js +++ b/src/client/view/selection.js @@ -1,5 +1,5 @@ -define(['rz_core', 'Bacon'], -function(rz_core, Bacon) { +define(['rz_core', 'Bacon', 'underscore'], +function(rz_core, Bacon, _) { function get_main_graph() { @@ -149,11 +149,12 @@ var inner_update = function(nodes) connectedComponent(nodes); } -var update = function(nodes) { - var set = !arr_compare(nodes, root_nodes); +var update = function(nodes, append) { + var new_nodes = append ? _.union(root_nodes, nodes) : nodes; + var not_same = !arr_compare(new_nodes, root_nodes); - if (set) { - inner_update(nodes); + if (not_same) { + inner_update(new_nodes); } } -- cgit v1.3.1