public void updateViewportFromMouse(int mousex, int mousey,
HiddenSequences hiddenSeqs, HiddenColumns hiddenCols)
{
- resetAlignmentDims();
-
int xAsRes = getLeftXFromCentreX(mousex, hiddenCols);
int yAsSeq = getTopYFromCentreY(mousey, hiddenSeqs);
+ updateViewportFromTopLeft(xAsRes, yAsSeq, hiddenSeqs, hiddenCols);
+
+ }
+
+ @Override
+ public void adjustViewportFromMouse(int mousex, int mousey,
+ HiddenSequences hiddenSeqs, HiddenColumns hiddenCols)
+ {
+ // calculate translation in pixel terms:
+ // get mouse location in viewport coords, add translation in viewport
+ // coords, and update viewport as usual
+ int vpx = Math.round((float) mousex * alwidth / width);
+ int vpy = Math.round((float) mousey * alheight / sequencesHeight);
+
+ updateViewportFromTopLeft(vpx + transX, vpy + transY, hiddenSeqs,
+ hiddenCols);
+
+ }
+
+ @Override
+ protected void updateViewportFromTopLeft(int xAsRes, int yAsSeq,
+ HiddenSequences hiddenSeqs, HiddenColumns hiddenCols)
+ {
+
+ resetAlignmentDims();
+
if (xAsRes < 0)
{
xAsRes = 0;
int vpy = Math.round((float) mousey * alheight / sequencesHeight);
return vpy - ranges.getViewportHeight() / 2;
}
+
+ @Override
+ public void setDragPoint(int x, int y, HiddenSequences hiddenSeqs,
+ HiddenColumns hiddenCols)
+ {
+ // get alignment position of x and box (can get directly from vpranges) and
+ // calc difference
+ int vpx = Math.round((float) x * alwidth / width);
+
+ int vpy = Math.round((float) y * alheight / sequencesHeight);
+
+ transX = ranges.getStartRes() - vpx;
+ transY = ranges.getStartSeq() - vpy;
+
+ }
+
}