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

js/list.js, js/segmenter.js: reduce calls to m.clone(id)

parent 8d69ebdb
......@@ -485,7 +485,8 @@ List.prototype = {
for (var i = 0; i < self.m.clusters[cloneID].length; i++) {
(function (i) {
var id = self.m.clusters[cloneID][i]
var color = self.m.clone(id).getColor();
var clone = self.m.clone(id)
var color = clone.getColor();
var div_clone = document.createElement('div');
div_clone.id = "_" + id;
div_clone.id2 = id;
......@@ -494,7 +495,7 @@ List.prototype = {
div_clone.onmouseover = function () {
self.m.focusIn(id);
}
if (self.m.clone(id).isSelected) div_clone.className = "listElem selected";
if (clone.isSelected) div_clone.className = "listElem selected";
var span_name = document.createElement('span');
span_name.className = "nameBox";
......@@ -505,8 +506,8 @@ List.prototype = {
span_name.onclick = function (e) {
self.clickList(e, id);
}
span_name.appendChild(document.createTextNode(self.m.clone(id).getCode()));
span_name.title = self.m.clone(id).getCode();
span_name.appendChild(document.createTextNode(clone.getCode()));
span_name.title = clone.getCode();
var span_info = document.createElement('span')
span_info.className = "infoBox";
......@@ -529,7 +530,7 @@ List.prototype = {
var r = 100
if (clusterSize != 0) {
span_stat.appendChild(document.createTextNode( (self.m.clone(id).get('reads', self.m.t)*100/clusterReads).toFixed(1) + "%"));
span_stat.appendChild(document.createTextNode( (clone.get('reads', self.m.t)*100/clusterReads).toFixed(1) + "%"));
} else {
span_stat.appendChild(document.createTextNode("0%"))
}
......
......@@ -484,9 +484,12 @@ Segment.prototype = {
self.m.clone(cloneID).unselect();
self.aligned = false;
}
seq_name.appendChild(document.createTextNode(this.m.clone(cloneID).getShortName()));
seq_name.title = this.m.clone(cloneID).getName();
seq_name.style.color = this.m.clone(cloneID).color;
var clone = this.m.clone(cloneID)
seq_name.appendChild(document.createTextNode(clone.getShortName()));
seq_name.title = clone.getName();
seq_name.style.color = clone.color;
// Tag
var svg_star = document.createElement('span')
......@@ -496,8 +499,8 @@ Segment.prototype = {
}
svg_star.appendChild(icon('icon-star-2', 'clone tag'))
svg_star.setAttribute('id', 'color' + cloneID);
if (typeof this.m.clone(cloneID).tag != 'undefined')
svg_star.style.color = this.m.tag[this.m.clone(cloneID).getTag()].color
if (typeof clone.tag != 'undefined')
svg_star.style.color = this.m.tag[clone.getTag()].color
// Size
......@@ -506,8 +509,8 @@ Segment.prototype = {
seq_size.onclick = function () {
self.m.clone(cloneID).unselect();
}
seq_size.style.color = this.m.clone(cloneID).color;
seq_size.appendChild(document.createTextNode(this.m.clone(cloneID).getStrSize()));
seq_size.style.color = clone.color;
seq_size.appendChild(document.createTextNode(clone.getStrSize()));
// Info
var span_info = document.createElement('span')
......@@ -524,8 +527,8 @@ Segment.prototype = {
var info = '' ;
if (this.m.clone(cloneID).seg.imgt!=null){
info = (this.m.clone(cloneID).seg.imgt["Functionality"].toLowerCase().indexOf("unproductive") > -1)
if (clone.seg.imgt!=null){
info = (clone.seg.imgt["Functionality"].toLowerCase().indexOf("unproductive") > -1)
? icon('icon-plus-squared', 'productive')
: icon('icon-minus-squared', 'unproductive') ;
}
......
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