X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fviewmodel%2FOverviewDimensions.java;fp=src%2Fjalview%2Fviewmodel%2FOverviewDimensions.java;h=b4c7c6d027bba733fba857769eb51635d0d4bc23;hb=2baf7a0fe3faf4133a387359b8ce2ba475176eec;hp=9b55e555a0e4fd19d46c73130df73b4a4678166a;hpb=5ae21c312e4dcc80389bc4f5c534db9428db2217;p=jalview.git diff --git a/src/jalview/viewmodel/OverviewDimensions.java b/src/jalview/viewmodel/OverviewDimensions.java index 9b55e55..b4c7c6d 100644 --- a/src/jalview/viewmodel/OverviewDimensions.java +++ b/src/jalview/viewmodel/OverviewDimensions.java @@ -39,6 +39,8 @@ public class OverviewDimensions private AlignViewportI av; + private ViewportPositionProps posProps; + private float scalew = 1f; private float scaleh = 1f; @@ -72,6 +74,7 @@ public class OverviewDimensions 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() @@ -84,7 +87,8 @@ public class OverviewDimensions graphHeight = 0; } - if (av.getAlignment().getWidth() > av.getAlignment().getHeight()) + if (posProps.getAlignmentWidthInCols() > posProps + .getAlignmentHeightInRows()) { // wider width = MAX_WIDTH; @@ -132,14 +136,21 @@ public class OverviewDimensions 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()) { @@ -188,11 +199,21 @@ public class OverviewDimensions .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); } /**