Commit b461f5cd authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

js/*.js: factorize unselectAllUnlessKey(), streamline condition, adds .altKey

Now the same key modifiers are checked throughout all the views.
We add .altKey for OS X.
parent 2a4e5a4b
......@@ -489,7 +489,7 @@ Graph.prototype = {
*
* */
clickGraph: function (cloneID){
if (!d3.event.ctrlKey) this.m.unselectAll()
this.m.unselectAllUnlessKey(d3.event)
this.m.select(cloneID)
},
......
......@@ -891,7 +891,7 @@ List.prototype = {
* @param {integer} cloneID - clone index
* */
clickList: function (e, cloneID) {
if (!(e.ctrlKey || e.metaKey)) this.m.unselectAll()
this.m.unselectAllUnlessKey(d3.event)
this.m.select(cloneID)
},
......
......@@ -829,6 +829,10 @@ Model.prototype = {
this.updateElemStyle(list);
},
unselectAllUnlessKey: function (e) {
if (!(e.ctrlKey || e.altKey || e.metaKey)) this.unselectAll()
},
/**
* Remove an item from the selected Clones list
*/
......
......@@ -1531,8 +1531,7 @@ ScatterPlot.prototype = {
leg.exit()
.remove();
leg.on("click", function(d){
if (!d3.event.ctrlKey)
self.m.unselectAll()
this.m.unselectAllUnlessKey(d3.event)
var listToSelect = [];
var halfRangeColumn = 0.5;
if (self.axisX.labels.length>1)
......@@ -1649,8 +1648,7 @@ ScatterPlot.prototype = {
leg.on("click", function(d){
if (self.mode !="bar"){
// Multi-selection by clicking on a legend
if (!d3.event.ctrlKey)
self.m.unselectAll()
this.m.unselectAllUnlessKey(d3.event)
var listToSelect = [];
var halfRangeLine = 0.5;
if (self.axisY.labels.length>1)
......@@ -2076,7 +2074,7 @@ ScatterPlot.prototype = {
.attr("height", 0)
this.active_selector = false;
if (!(d3.event.ctrlKey || d3.event.metakey)) this.m.unselectAll()
this.m.unselectAllUnlessKey(d3.event)
this.m.multiSelect(nodes_selected)
}
}
......@@ -2087,7 +2085,7 @@ ScatterPlot.prototype = {
* @param {integer} cloneID - clone index
* */
clickNode: function(cloneID) {
if (!d3.event.ctrlKey) this.m.unselectAll()
this.m.unselectAllUnlessKey(d3.event)
this.m.select(cloneID)
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment