Commit ed2596aa authored by Marc Duez's avatar Marc Duez

model/scatterplot.js : improve callback/chaining ( avoid asynchronous update bug)

parent 6b1a897d
......@@ -32,7 +32,7 @@ Germline.prototype = {
/*
* system (igh/trg) / type (V,D,J)
* */
load : function (system, type) {
load : function (system, type, callback) {
var self = this;
this.init()
......@@ -43,7 +43,7 @@ Germline.prototype = {
if (typeof germline[name] != 'undefined'){
this.allele = germline[name]
}else{
return
return callback
}
this.gene = {}
......@@ -112,5 +112,7 @@ Germline.prototype = {
this.gene[elem2].color = colorGenerator((30 + ((i - 1) / key.length) * 290),
color_s, color_v);
}
return callback
}
}
\ No newline at end of file
......@@ -386,21 +386,21 @@ Model.prototype = {
* */
changeGermline: function (system) {
this.loadGermline(system)
this.update()
.update()
},
/* charge le germline définit a l'initialisation dans le model
* détermine le nombre d'allele pour chaque gene et y attribue une couleur
* */
loadGermline: function (system) {
console.log("loadGermline : " + system)
system = typeof system !== 'undefined' ? system : this.system;
if (system == "multi") system = Object.keys(this.system_segmented)[0]
this.germlineV.load(system, "V")
this.germlineD.load(system, "D")
this.germlineJ.load(system, "J")
return this;
return this.germlineV.load(system, "V", this)
.germlineD.load(system, "D", this)
.germlineJ.load(system, "J", this)
}, //end loadGermline
/*
......@@ -977,11 +977,14 @@ Model.prototype = {
}
}
this.updateModel()
//check if current germline is in the selected_system
if (this.system_selected.indexOf(this.germlineV.system) == -1 ) this.loadGermline(this.system_selected[0])
if (this.system_selected.indexOf(this.germlineV.system) == -1 ){
this.loadGermline(this.system_selected[0])
}
this.resize()
this.update()
.update()
},
/*
......@@ -1478,6 +1481,8 @@ Model.prototype = {
for (var i = 0; i < this.view.length; i++) {
this.view[i].resize(speed);
}
return this
},
......
......@@ -1032,30 +1032,34 @@ ScatterPlot.prototype = {
var elapsedTime = 0;
this.compute_size()
if (this.splitY == "bar" && !this.reinit) {
this.updateBar();
}
else {
for (var i = 0; i < this.nodes.length; i++) {
this.updateClone(i);
}
this.force.start();
this.updateElemStyle();
}
if (this.m.germlineV.system != this.system){
this.system =this.m.germlineV.system
this.changeSplitMethod(this.splitX, this.splitY)
}
this.updateMenu();
this.initGrid();
.updateClones()
.updateMenu()
.initGrid();
//Donne des informations quant au temps de MàJ des données
elapsedTime = new Date()
.getTime() - startTime;
myConsole.log("update sp: " + elapsedTime + "ms");
},
updateClones:function(){
if (this.splitY == "bar" && !this.reinit) {
this.updateBar();
}
else {
for (var i = 0; i < this.nodes.length; i++) {
this.updateClone(i);
}
this.force.start();
this.updateElemStyle();
}
if (this.m.germlineV.system != this.system){
this.system =this.m.germlineV.system
this.changeSplitMethod(this.splitX, this.splitY)
}
return this;
},
/* Fonction permettant de mettre à jour les données liées à tous les clones présents dans une liste -> FONCTION DEPRECATED ?????
* @param list: Une liste contenant tous les clones à mettre à jour
......@@ -1254,6 +1258,8 @@ ScatterPlot.prototype = {
if (!self.reinit) this.axis_x_update(this.axisX.labels);
if (!self.reinit) this.axis_y_update(this.axisY.labels);
if (!self.reinit) this.system_label_update(this.systemGrid.label);
return this;
},
/* Function which allows to verify if we can switch to an accessible distribution
......@@ -1591,6 +1597,8 @@ ScatterPlot.prototype = {
.selectedIndex = select_x
document.getElementById("select_y")
.selectedIndex = select_y
return this;
},
/* Fonction permettant de 'cacher' un node
......
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