Skip to content

Commit

Permalink
fix bug where scrolling container remains large after tracks are hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuels committed May 23, 2012
1 parent ba58977 commit 4d11661
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion js/GenomeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -1113,8 +1113,16 @@ GenomeView.prototype.sizeInit = function() {
});
this.updateOverviewHeight();

this.updateScroll();
};

/**
* @private
*/
GenomeView.prototype.updateScroll = function() {

// may need to update our Y position if our height has changed
var update = { height: this.getHeight(), width: this.getWidth() };
var update = { height: this.getHeight() };
if( this.getY() > 0 ) {
if( this.containerHeight - this.getY() < update.height ) {
//console.log( this.totalTrackHeight, update.height, this.getY() );
Expand Down Expand Up @@ -1550,13 +1558,15 @@ GenomeView.prototype.updateTrackList = function() {

var newIndices = {};
var newHeights = new Array(this.tracks.length);
var totalHeight = 0;
for (var i = 0; i < tracks.length; i++) {
newIndices[tracks[i].name] = i;
if (tracks[i].name in this.trackIndices) {
newHeights[i] = this.trackHeights[this.trackIndices[tracks[i].name]];
} else {
newHeights[i] = 0;
}
totalHeight += newHeights[i];
this.trackIndices[tracks[i].name] = i;
}
this.trackIndices = newIndices;
Expand All @@ -1568,6 +1578,11 @@ GenomeView.prototype.updateTrackList = function() {
if (this.tracks[i].shown)
nextTop += this.trackHeights[i] + this.trackPadding;
}

this.containerHeight = nextTop;
this.scrollContainer.style.height = this.containerHeight + "px";

this.updateScroll();
};

/*
Expand Down

0 comments on commit 4d11661

Please sign in to comment.