- * Check box dimensions and scroll positions and correct if necessary
- */
- public void setBoxPositionByMouse(int x, int y)
- {
- int alwidth = av.getAlignment().getWidth();
- int alheight = av.getAlignment().getAbsoluteHeight();
-
- boxX = x;
- boxY = y;
- if (boxY < 0)
- {
- boxY = 0;
- }
- else if (boxY > (sequencesHeight - boxHeight))
- {
- boxY = sequencesHeight - boxHeight;
- }
-
- if (boxX < 0)
- {
- boxX = 0;
- }
- else if (boxX > (width - boxWidth))
- {
- if (av.hasHiddenColumns())
- {
- // Try smallest possible box
- boxWidth = Math.round((float) (posProps.getEndRes()
- - posProps.getStartRes() + 1)
- * width / alwidth);
- }
- boxX = width - boxWidth;
- }
-
- scrollCol = Math.round((float) boxX * alwidth / width);
- scrollRow = Math.round((float) boxY * alheight / sequencesHeight);
-
- if (av.hasHiddenColumns())
- {
- // doesn't seem to do anything useful
- /*if (!av.getColumnSelection().isVisible(scrollCol))
- {
- return;
- }*/
-
- scrollCol = av.getColumnSelection().findColumnPosition(scrollCol);
- }
-
- if (av.hasHiddenRows())
- {
- scrollRow = av.getAlignment().getHiddenSequences()
- .findIndexWithoutHiddenSeqs(scrollRow);
- }
- }
-
- /**
- * Update the overview panel box when the associated alignment panel is
- * changed
- *
- */
- public void setBoxPosition()
- {
- int alwidth = av.getAlignment().getWidth();
- int alheight = av.getAlignment().getAbsoluteHeight();
-
- int startRes = av.getPosProps().getAbsoluteStartRes();
- int endRes = av.getPosProps().getAbsoluteEndRes();
-
- int startSeq = av.getPosProps().getAbsoluteStartSeq();
- int endSeq = av.getPosProps().getAbsoluteEndSeq();
-
- boxX = Math.round((float) startRes * width / alwidth);
- boxY = Math.round((float) startSeq * sequencesHeight / alheight);
-
- boxWidth = Math
- .round((float) (endRes - startRes + 1) * width / alwidth);
- boxHeight = Math.round((float) (endSeq - startSeq) * sequencesHeight
- / alheight);
- }
-
- /**