Skip to content

Commit

Permalink
fixed off-by-one error
Browse files Browse the repository at this point in the history
  • Loading branch information
jsmirob committed Feb 27, 2013
1 parent 106e892 commit 06de729
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/JBrowse/View/Track/Wiggle/XYPlot.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,32 +86,31 @@ var XYPlot = declare( [WiggleBase, YScaleMixin],

dojo.forEach( pixels, function(p,i) {
var score = toY(p);
var w = Math.ceil(scale);

// draw the background color if we are configured to do so
if( bgColor && score >= 0 ) {
context.fillStyle = bgColor;
context.fillRect( i, 0, w, canvasHeight );
context.fillRect( i, 0, 1, canvasHeight );
}

if( score <= canvasHeight ) { // if the rectangle is visible at all

if( score <= originY ) {
// bar goes upward
context.fillStyle = posColor;
context.fillRect( i, score, w, originY-score+1);
context.fillRect( i, score, 1, originY-score+1);
if( !disableClipMarkers && score < 0 ) { // draw clip marker if necessary
context.fillStyle = clipColor || negColor;
context.fillRect( i, 0, w, 2 );
context.fillRect( i, 0, 1, 2 );
}
}
else {
// bar goes downward
context.fillStyle = negColor;
context.fillRect( i, originY, w, score-originY+1 );
context.fillRect( i, originY, 1, score-originY+1 );
if( !disableClipMarkers && score >= canvasHeight ) { // draw clip marker if necessary
context.fillStyle = clipColor || posColor;
context.fillRect( i, canvasHeight-3, w, 2 );
context.fillRect( i, canvasHeight-3, 1, 2 );
}
}
}
Expand Down

0 comments on commit 06de729

Please sign in to comment.