private AlignViewportI av;
+ private ViewportPositionProps posProps;
+
private float scalew = 1f;
private float scaleh = 1f;
public OverviewDimensions(AlignViewportI avi)
{
this.av = avi;
+ this.posProps = av.getPosProps();
// scale the initial size of overviewpanel to shape of alignment
float initialScale = (float) av.getAlignment().getWidth()
graphHeight = 0;
}
- if (av.getAlignment().getWidth() > av.getAlignment().getHeight())
+ if (posProps.getAlignmentWidthInCols() > posProps
+ .getAlignmentHeightInRows())
{
// wider
width = MAX_WIDTH;
if (av.hasHiddenColumns())
{
// Try smallest possible box
- boxWidth = (int) ((av.getEndRes() - av.getStartRes() + 1)
- * av.getCharWidth() * scalew);
+ boxWidth = (int) (posProps.convertResiduesToPixels(posProps
+ .getEndRes() - posProps.getStartRes() + 1) * scalew);
+
+ // boxWidth = (int) ((av.getEndRes() - av.getStartRes() + 1)
+ // * av.getCharWidth() * scalew);
}
boxX = width - boxWidth;
}
- scrollCol = (int) (boxX / scalew / av.getCharWidth());
- scrollRow = (int) (boxY / scaleh / av.getCharHeight());
+ scrollCol = posProps.convertPixelsToResidues(Math.round(boxX / scalew));
+ scrollRow = posProps
+ .convertPixelsToSequences(Math.round(boxY / scaleh));
+
+ // scrollCol = (int) (boxX / scalew / av.getCharWidth());
+ // scrollRow = (int) (boxY / scaleh / av.getCharHeight());
if (av.hasHiddenColumns())
{
.adjustForHiddenSeqs(endSeq);
}
- boxX = (int) (startRes * av.getCharWidth() * scalew);
- boxY = (int) (startSeq * av.getCharHeight() * scaleh);
+ boxX = Math.round(posProps.convertResiduesToPixels(startRes) * scalew);
+ boxY = Math.round(posProps.convertSequencesToPixels(startSeq) * scaleh);
+
+ // boxX = (int) (startRes * av.getCharWidth() * scalew);
+ // boxY = (int) (startSeq * av.getCharHeight() * scaleh);
+
+ boxWidth = Math.round(posProps.convertResiduesToPixels(endRes
+ - startRes
+ + 1) * scalew);
+ boxHeight = Math.round(posProps.convertSequencesToPixels(endSeq
+ - startSeq)
+ * scaleh);
- boxWidth = (int) ((endRes - startRes + 1) * av.getCharWidth() * scalew);
- boxHeight = (int) ((endSeq - startSeq) * av.getCharHeight() * scaleh);
+ // boxWidth = (int) ((endRes - startRes + 1) * av.getCharWidth() * scalew);
+ // boxHeight = (int) ((endSeq - startSeq) * av.getCharHeight() * scaleh);
}
/**