Commit 6d919304 authored by Mikaël Salson's avatar Mikaël Salson

Merge branch 'feature-c/4413-fix-a-bunch-of-non-blocking-js-error' into 'dev'

Feature c/4413 fix a bunch of non blocking js error

Closes #4413

See merge request !771
parents aa20efdd e8554e1d
Pipeline #160434 failed with stages
in 7 minutes and 37 seconds
......@@ -499,6 +499,8 @@ Graph.prototype = {
*
* */
resize: function (div_width, div_height) {
if(!this.m.isReady()) return //don't resize if model is not ready
var div = document.getElementById(this.id)
var speed = 0
......
......@@ -63,8 +63,7 @@ function Model() {
this.NORM_EXPECTED = "expected"
this.NORM_EXTERNAL = "external"
this.normalization_mode = this.NORM_FALSE
this.axes = new Axis(this)
this.available_axes = this.axes.available()
this.available_axes = Axis.prototype.available()
setInterval(function(){return self.updateIcon()}, 100);
}
......
......@@ -248,6 +248,7 @@ Model_loader.prototype = {
* */
parseJsonData: function (data, limit) {
self = this;
this.is_ready = false
//convert data to json if necessary
if (typeof data == "string") {
......@@ -395,6 +396,7 @@ Model_loader.prototype = {
this.distributions = data.distributions
this.loadAllDistribClones()
}
this.is_ready = true
return this
}
......@@ -527,7 +529,7 @@ Model_loader.prototype = {
* */
parseJsonAnalysis: function (analysis) {
var self = this
this.is_ready = false
if (typeof analysis == "string") {
try {
......@@ -633,6 +635,8 @@ Model_loader.prototype = {
}else{
console.log({"type": "flash", "msg": "invalid version for this .analysis file" , "priority": 1});
}
this.is_ready = true
},
/**
......@@ -884,4 +888,10 @@ Model_loader.prototype = {
this.average_quality = this.average_quality/count;
},
// return True if the model is loaded
// return False if the model is empty or currently loading
isReady: function() {
return this.is_ready
}
};
......@@ -545,6 +545,8 @@ ScatterPlot.prototype = {
* @param {float} [div_height]
* */
resize: function(div_width, div_height) {
if(!this.m.isReady()) return //don't resize if model is not ready
var print = true
if (typeof div_height == 'undefined') {
var div = document.getElementById(this.id)
......@@ -820,7 +822,7 @@ ScatterPlot.prototype = {
* update all clones (color / position / axis)
* */
updateClones: function() {
for (var i = 0; i < this.nodes.length; i++) {
for (var i = 0; i < this.m.clones.length; i++) {
this.updateClone(i);
}
......@@ -896,8 +898,7 @@ ScatterPlot.prototype = {
var clone = this.m.clone(cloneID)
var node = this.nodes[cloneID]
if (this.m.clone(cloneID)
.isActive()) {
if (clone && clone.isActive()) {
var seqID, size;
if (clone.hasSizeDistrib()){
......
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