From af6a4696a09f7789db06aeb85dbf7cb064d28f78 Mon Sep 17 00:00:00 2001 From: Robert Buels Date: Mon, 2 Apr 2012 11:49:04 -0400 Subject: [PATCH] make GenomeView maxVisible and minVisible report being right at the end of the refseq if they are within less than a pixel width of it. Fixes #24. --- js/GenomeView.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/js/GenomeView.js b/js/GenomeView.js index d654629660..51047459f5 100644 --- a/js/GenomeView.js +++ b/js/GenomeView.js @@ -691,11 +691,24 @@ GenomeView.prototype.centerAtBase = function(base, instantly) { }; GenomeView.prototype.minVisible = function() { - return this.pxToBp(this.x + this.offset); + var mv = this.pxToBp(this.x + this.offset); + + // if we are less than one pixel from the beginning of the ref + // seq, just say we are at the beginning. + if( mv < this.pxToBp(1) ) + return 0; + else + return mv; }; GenomeView.prototype.maxVisible = function() { - return this.pxToBp(this.x + this.offset + this.dim.width); + var mv = this.pxToBp(this.x + this.offset + this.dim.width); + // if we are less than one pixel from the end of the ref + // seq, just say we are at the end. + if( mv > this.ref.end - this.pxToBp(1) ) + return this.ref.end; + else + return mv; }; GenomeView.prototype.showFine = function() {