Commit 13df9d50 authored by Marc Duez's avatar Marc Duez
Browse files

model.js : system select

-debug update problem with system selected from scatterplot
-scatterplot and infoBox use the same set of function to access/change system_selected
-modeljs doesn't check the DOM anymore to update system
parent 12b010a9
......@@ -719,7 +719,7 @@ Builder.prototype = {
if (this.m.system_selected.indexOf(key) != -1)
checkbox.checked=true
checkbox.onchange = function () {
m.update_selected_system()
m.toggle_system(this.id.replace("checkbox_system_",""))
}
var span_system = this.m.systemBox(key)
......
......@@ -692,6 +692,15 @@ Model.prototype = {
}
},
toggle_system: function(system){
if (this.system_available.indexOf(system) != -1) {
var pos = this.system_selected.indexOf(system)
if (pos== -1){ this.system_selected.push(system) }
else{ this.system_selected.splice(pos, 1) }
}
this.update_selected_system()
},
/* compute the number of reads segmented for the current selected system(s)
*
* */
......@@ -701,17 +710,6 @@ Model.prototype = {
for (var i=0 ; i<this.reads.segmented.length; i++){
this.reads.segmented[i]=0
}
//reset system
this.system_selected = []
//check system currently selected in menu
for (var key in this.system_available) {
var system = this.system_available[key]
if (document.getElementById("checkbox_system_"+system).checked){
this.system_selected.push(system)
}
}
//compute new reads.segmented value (sum of reads.segmented of selected system)
for (var i=0; i<this.system_selected.length; i++){
......@@ -723,7 +721,7 @@ Model.prototype = {
this.updateModel()
//check if current germline is in the selected_system
if (this.system_selected.indexOf(this.germlineV.system) == -1 ){
if (this.system_selected.indexOf(this.germlineV.system) == -1 && this.system_selected.length > 0){
this.changeGermline(this.system_selected[0])
}else{
this.resize()
......@@ -1520,7 +1518,7 @@ Model.prototype = {
changeGermline: function (system) {
if (this.system_selected.indexOf(system) == -1){
this.system_selected.push(system)
this.toggle_system(system)
}
this.loadGermline(system)
......
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