{
x = 0;
}
- else if (x >= alwidth)
+ else if (x >= width)
{
x = alwidth - 1;
}
{
y = 0;
}
- else if (y >= alheight)
+ else if (y >= sequencesHeight)
{
y = alheight - 1;
}
.findColumnPosition(xAsRes));
// get where end res should be by adding the viewport width on
- int endRes = xAsRes + vpwidth;
+ // subtract 1 because the width includes endRes
+ int endRes = xAsRes + vpwidth - 1;
// check in case we went off the edge of the alignment
if (endRes > alwidth)
// went past the end of the alignment, adjust backwards
endRes = alwidth;
// recalc xAsRes backwards from endRes
- xAsRes = endRes - vpwidth;
+ // add 1 because width includes xAsRes
+ xAsRes = endRes - vpwidth + 1;
}
//
int yAsSeq = Math.round((float) y * alheight / sequencesHeight);
// get viewport height in sequences
+ // add 1 because height includes both endSeq and startSeq
int vpheight = props.getEndSeq() - props.getStartSeq() + 1;
// get where y should be when accounting for hidden rows
.findIndexWithoutHiddenSeqs(yAsSeq));
// get where end seq should be by adding the viewport height on
- int endSeq = yAsSeq + vpheight;
+ int endSeq = yAsSeq + vpheight - 1;
// check in case we went off the edge of the alignment
if (endSeq > alheight)
boxY = Math.round((float) startSeq * sequencesHeight / alheight);
// boxWidth is the width in residues translated to pixels
+ // since the box includes both the start and end residues, add 1 to the
+ // difference
boxWidth = Math
.round((float) (endRes - startRes + 1) * width / alwidth);
// boxHeight is the height in sequences translated to pixels
+ // since the box includes both the start and end sequences, add 1 to the
+ // difference
boxHeight = Math.round((float) (endSeq - startSeq + 1)
* sequencesHeight
/ alheight);