Commit cd79a816 authored by marc duez's avatar marc duez

segmenter.js : auto adjust slider only when adding sequence to an empty segmenter

parent 48fd194e
Pipeline #112599 failed with stages
in 48 seconds
...@@ -523,12 +523,13 @@ Segment.prototype = { ...@@ -523,12 +523,13 @@ Segment.prototype = {
updateElem: function (list) { updateElem: function (list) {
var self = this; var self = this;
list.sort(function(a,b){ return self.m.clone(b).getSize() - self.m.clone(a).getSize() }) list.sort(function(a,b){ return self.m.clone(b).getSize() - self.m.clone(a).getSize() })
var sliderNeedUpdate = (Object.keys(this.sequence).length==0)//slider move only if we add sequence to an empty segmenter
for (var i = 0; i < list.length; i++) { for (var i = 0; i < list.length; i++) {
var cloneID = list[i]; var cloneID = list[i];
var liDom = this.index[cloneID]; var liDom = this.index[cloneID];
if (this.m.clone(cloneID).isSelected()) { // the clone is selected if (this.m.clone(cloneID).isSelected()) { // the clone is selected
this.addToSegmenter(cloneID); this.addToSegmenter(cloneID);
liDom = this.index[cloneID]; liDom = this.index[cloneID];
...@@ -550,7 +551,8 @@ Segment.prototype = { ...@@ -550,7 +551,8 @@ Segment.prototype = {
liDom.display("main", "none"); // > hide the dom element liDom.display("main", "none"); // > hide the dom element
} }
} }
this.show();
if (sliderNeedUpdate) this.show();
this.updateAlignmentButton() this.updateAlignmentButton()
//this.updateSegmenterWithHighLighSelection(); //this.updateSegmenterWithHighLighSelection();
this.updateStats(); this.updateStats();
...@@ -871,13 +873,10 @@ Segment.prototype = { ...@@ -871,13 +873,10 @@ Segment.prototype = {
}, },
/** /**
* move the horizontal slider to focus the most interesting parts of the sequences * TODO: move the horizontal slider to focus the most interesting parts of the sequences
* */ * */
show: function () { show: function () {
var li = document.getElementById("listSeq") if (object.keys(sequence).length > 0) {
.getElementsByTagName("li");
if (li.length > 0) {
var id = li[0].id.substr(3);
var mid = 999999 var mid = 999999
$(this.div_segmenter) $(this.div_segmenter)
.animate({ .animate({
......
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