{
resetAlignmentDims();
- int x = mousex;
- int y = mousey;
+ int xAsRes = getLeftXFromCentreX(mousex, hiddenCols);
+ int yAsSeq = getTopYFromCentreY(mousey, hiddenSeqs);
- if (x < 0)
+ if (xAsRes < 0)
{
- x = 0;
+ xAsRes = 0;
}
- if (y < 0)
+ if (yAsSeq < 0)
{
- y = 0;
+ yAsSeq = 0;
}
//
// correction
// convert x to residues - this is an absolute position
- int xAsRes = Math.round((float) x * alwidth / width);
+ // int xAsRes = Math.round((float) x * alwidth / width);
// get viewport width in residues
int vpwidth = ranges.getViewportWidth();
//
// convert y to residues
- int yAsSeq = Math.round((float) y * alheight / sequencesHeight);
+ // int yAsSeq = Math.round((float) y * alheight / sequencesHeight);
// get viewport height in sequences
// add 1 because height includes both endSeq and startSeq
alwidth = ranges.getVisibleAlignmentWidth();
alheight = ranges.getVisibleAlignmentHeight();
}
+
+ @Override
+ protected int getLeftXFromCentreX(int mousex, HiddenColumns hidden)
+ {
+ int vpx = Math.round((float) mousex * alwidth / width);
+ return vpx - ranges.getViewportWidth() / 2;
+ }
+
+ @Override
+ protected int getTopYFromCentreY(int mousey, HiddenSequences hidden)
+ {
+ int vpy = Math.round((float) mousey * alheight / sequencesHeight);
+ return vpy - ranges.getViewportHeight() / 2;
+ }
}