Commit 31b98f86 authored by marc duez's avatar marc duez Committed by Mathieu Giraud

aligner.js : code quality

parent 7789fc5b
...@@ -114,10 +114,7 @@ Aligner.prototype = { ...@@ -114,10 +114,7 @@ Aligner.prototype = {
menu.appendChild(axis_label); menu.appendChild(axis_label);
$(axis_input).unbind("click"); $(axis_input).unbind("click");
$(axis_input).click(function(e) { self.connect_axisbox(axis_input);
self.updateAxisBox();
e.stopPropagation();
})
} }
this.selectedAxis = [Axis.prototype.getAxisProperties("productivity IMGT"), this.selectedAxis = [Axis.prototype.getAxisProperties("productivity IMGT"),
...@@ -126,22 +123,26 @@ Aligner.prototype = { ...@@ -126,22 +123,26 @@ Aligner.prototype = {
}, },
//check axis selected in menu to update and update axisBox dom elements accordingly //check axis selected in menu to update and update axisBox dom elements accordingly
updateAxisBox:function (){ connect_axisbox:function (elem){
var self = this; var self = this;
var menu = document.getElementById("segmenter_axis_select");
var inputs = menu.getElementsByTagName("input");
var selectedAxis = [];
for (var i in inputs) $(elem).click(function(e) {
if (inputs[i].checked) selectedAxis.push(Axis.prototype.getAxisProperties(inputs[i].value)); var menu = document.getElementById("segmenter_axis_select");
var inputs = menu.getElementsByTagName("input");
if (selectedAxis.length <= 5){ var selectedAxis = [];
self.selectedAxis = selectedAxis;
self.update(); for (var i in inputs)
}else{ if (inputs[i].checked) selectedAxis.push(Axis.prototype.getAxisProperties(inputs[i].value));
console.log({ msg: "selection is limited to 5", type: "flash", priority: 2 });
this.checked = false; if (selectedAxis.length <= 5){
} self.selectedAxis = selectedAxis;
self.update();
}else{
console.log({ msg: "selection is limited to 5", type: "flash", priority: 2 });
this.checked = false;
}
e.stopPropagation();
})
}, },
connect_checkbox: function(elem, layers){ connect_checkbox: function(elem, layers){
......
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