Skip to content

Commit

Permalink
Copy over Isaacs's reference changes
Browse files Browse the repository at this point in the history
  • Loading branch information
danvk committed Oct 29, 2015
1 parent c02022d commit 5596f47
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/main/GenomeTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ var GenomeTrack = React.createClass({
}

var contigColon = this.props.range.contig + ':';
var previousBase = null;
for (var pos = range.start - 1; pos <= range.stop; pos++) {
var letter = basePairs[contigColon + pos];

Expand All @@ -90,10 +91,23 @@ var GenomeTrack = React.createClass({
// 0.5 = centered
ctx.fillText(letter, scale(1 + 0.5 + pos), height - 1);
} else {
ctx.fillRect(scale(1 + pos), 0, pxPerLetter - 1, height);
if (pxPerLetter >= style.COVERAGE_MIN_BAR_WIDTH_FOR_GAP) {
// We want a white space between blocks at this size, so we can see
// the difference between bases.
ctx.fillRect(scale(1 + pos) + 0.5, 0, pxPerLetter - 1.5, height);
} else if (previousBase === letter) {
// Otherwise, we want runs of colors to be completely solid ...
ctx.fillRect(scale(1 + pos) - 1.5, 0, pxPerLetter + 1.5, height);
} else {
// ... and minimize the amount of smudging and whitespace between
// bases.
ctx.fillRect(scale(1 + pos) - 0.5, 0, pxPerLetter + 1.5, height);
}
}

ctx.popObject();
ctx.restore();
previousBase = letter;
}
}
}
Expand Down

0 comments on commit 5596f47

Please sign in to comment.