*/
protected abstract void resetAlignmentDims();
- protected void setBoxPosition(int startRes, int endRes, int startSeq,
- int endSeq)
+ protected void setBoxPosition(int startRes, int startSeq, int vpwidth,
+ int vpheight)
{
resetAlignmentDims();
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);
+ boxWidth = Math.round((float) vpwidth * width / alwidth);
+
// boxHeight is the height in sequences translated to pixels
- boxHeight = Math.round((float) (endSeq - startSeq + 1)
- * sequencesHeight / alheight);
+ boxHeight = Math.round((float) vpheight * sequencesHeight / alheight);
}
}
\ No newline at end of file
}
else
{
- xAsRes = ranges.getEndRes();
+ xAsRes = ranges.getStartRes();
}
}
}
else
{
- yAsSeq = ranges.getEndSeq();
+ yAsSeq = ranges.getStartSeq();
}
}
public void setBoxPosition(HiddenSequences hiddenSeqs,
HiddenColumns hiddenCols)
{
- // work with visible values of startRes and endRes
- int startRes = ranges.getStartRes();
- int endRes = ranges.getEndRes();
-
- // work with visible values of startSeq and endSeq
- int startSeq = ranges.getStartSeq();
- int endSeq = ranges.getEndSeq();
-
- setBoxPosition(startRes, endRes, startSeq, endSeq);
+ setBoxPosition(ranges.getStartRes(), ranges.getStartSeq(),
+ ranges.getViewportWidth(), ranges.getViewportHeight());
}
@Override
}
else
{
- visXAsRes = ranges.getEndRes();
+ visXAsRes = ranges.getStartRes();
}
}
}
else
{
- visYAsSeq = ranges.getEndSeq();
+ visYAsSeq = ranges.getStartSeq();
}
}
// update viewport
- ranges.setStartRes(xAsRes);
- ranges.setStartSeq(yAsSeq);
+ ranges.setStartRes(visXAsRes);
+ ranges.setStartSeq(visYAsSeq);
}
HiddenColumns hiddenCols)
{
// work with absolute values of startRes and endRes
- int startRes = hiddenCols
- .adjustForHiddenColumns(ranges.getStartRes());
+ int startRes = hiddenCols.adjustForHiddenColumns(ranges.getStartRes());
int endRes = hiddenCols.adjustForHiddenColumns(ranges.getEndRes());
// work with absolute values of startSeq and endSeq
int startSeq = hiddenSeqs.adjustForHiddenSeqs(ranges.getStartSeq());
int endSeq = hiddenSeqs.adjustForHiddenSeqs(ranges.getEndSeq());
- setBoxPosition(startRes, endRes, startSeq, endSeq);
+ setBoxPosition(startRes, startSeq, endRes - startRes + 1, endSeq
+ - startSeq + 1);
}
@Override