{
x = 0;
}
- else if (x >= width)
- {
- x = alwidth - 1;
- }
if (y < 0)
{
y = 0;
}
- else if (y >= sequencesHeight)
- {
- y = alheight - 1;
- }
//
// Convert x value to residue position
int endRes = xAsRes + vpwidth - 1;
// check in case we went off the edge of the alignment
- if (endRes > alwidth)
+ int visAlignWidth = hiddenCols.findColumnPosition(alwidth);
+ if (endRes > visAlignWidth - 1)
{
// went past the end of the alignment, adjust backwards
- endRes = alwidth;
+ endRes = visAlignWidth - 1;
// recalc xAsRes backwards from endRes
// add 1 because width includes xAsRes
- xAsRes = endRes - vpwidth + 1;
+ xAsRes = hiddenCols.adjustForHiddenColumns(endRes - vpwidth + 1);
}
//
int endSeq = yAsSeq + vpheight - 1;
// check in case we went off the edge of the alignment
- if (endSeq > alheight)
+ int visAlignHeight = hiddenSeqs.findIndexWithoutHiddenSeqs(alheight);
+ if (hiddenSeqs.findIndexWithoutHiddenSeqs(endSeq) > visAlignHeight - 1)
{
// went past the end of the alignment, adjust backwards
- endSeq = alheight;
+ endSeq = visAlignHeight - 1;
// recalc yAsSeq backwards from endSeq
yAsSeq = endSeq - vpheight + 1;
}
import org.testng.annotations.Test;
@Test(singleThreaded = true)
-public class OverviewDimensionsTest {
-
- SequenceI seq1 = new Sequence(
- "Seq1",
- "ABCABCABCABCABCABCABCABCBACBACBACBACABCABCABCABCABCABCABCABCBACBACBACBACABCABCABCABCABCABCABCABCBACBACBACBAC");
-
- SequenceI seq2 = new Sequence(
- "Seq2",
- "ABCABCABCABCABCABCABCABCBACBACBACBACABCABCABCABCABCABCABCABCBACBACBACBACABCABCABCABCABCABCABCABCBACBACBACBAC");
-
- SequenceI seq3 = new Sequence(
- "Seq3",
- "ABCABCABCABCABCABCABCABCBACBACBACBACABCABCABCABCABCABCABCABCBACBACBACBACABCABCABCABCABCABCABCABCBACBACBACBAC");
-
- SequenceI seq4 = new Sequence(
- "Seq4",
- "ABCABCABCABCABCABCABCABCBACBACBACBACABCABCABCABCABCABCABCABCBACBACBACBACABCABCABCABCABCABCABCABCBACBACBACBAC");
-
- SequenceI seq5 = new Sequence(
- "Seq5",
- "ABCABCABCABCABCABCABCABCBACBACBACBACABCABCABCABCABCABCABCABCBACBACBACBACABCABCABCABCABCABCABCABCBACBACBACBAC");
-
+public class OverviewDimensionsTest
+{
AlignmentI al;
OverviewDimensions od;
// click to left of hidden cols, with overlap
// boxX and scrollCol adjusted for hidden cols, width normal
- /* xpos = Math.round((float) 145 * od.getWidth() / alwidth) - boxWidth;
- mouseClick(od, xpos, 0);
- assertEquals(
- od.getBoxX(),
- Math.round((firstHidden - 1) * od.getWidth() / alwidth)
- - boxWidth);
- assertEquals(od.getBoxY(), 0);
- assertEquals(od.getBoxWidth(), boxWidth);
- assertEquals(od.getBoxHeight(), boxHeight);
- assertEquals(od.getScrollCol(),
- Math.round(od.getBoxX() * alwidth / od.getWidth()));
- assertEquals(od.getScrollRow(), 0);
- */
+ xpos = Math.round((float) 145 * od.getWidth() / alwidth) - boxWidth;
+ mouseClick(od, xpos, 0);
+ assertEquals(od.getBoxX(),
+ Math.round((firstHidden - 1) * od.getWidth() / alwidth)
+ - boxWidth);
+ assertEquals(od.getBoxY(), 0);
+ assertEquals(od.getBoxWidth(), boxWidth);
+ assertEquals(od.getBoxHeight(), boxHeight);
+ assertEquals(od.getScrollCol(),
+ Math.round(od.getBoxX() * alwidth / od.getWidth()));
+ assertEquals(od.getScrollRow(), 0);
+
// click in hidden cols
// boxX and scrollCol adjusted for hidden cols, width normal
// TODO breaks as above test