X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fviewmodel%2FOverviewDimensions.java;h=d2912d8996be680821b48c109f6e0193c4dd690e;hb=93cdde7955263e9c0fc81621d73cd3157c02b944;hp=a837d53b83d6d435b9d4218ea160c5505acc09c2;hpb=460c037bef9ec113c2a46010c443d85e73347592;p=jalview.git diff --git a/src/jalview/viewmodel/OverviewDimensions.java b/src/jalview/viewmodel/OverviewDimensions.java index a837d53..d2912d8 100644 --- a/src/jalview/viewmodel/OverviewDimensions.java +++ b/src/jalview/viewmodel/OverviewDimensions.java @@ -31,24 +31,41 @@ import java.awt.Graphics; public abstract class OverviewDimensions { protected static final int MAX_WIDTH = 400; + protected static final int MIN_WIDTH = 120; + protected static final int MIN_SEQ_HEIGHT = 40; + protected static final int MAX_SEQ_HEIGHT = 300; private static final int DEFAULT_GRAPH_HEIGHT = 20; protected int width; + protected int sequencesHeight; + protected int graphHeight = DEFAULT_GRAPH_HEIGHT; + protected int boxX = -1; + protected int boxY = -1; + protected int boxWidth = -1; + protected int boxHeight = -1; - protected int scrollCol = -1; - protected int scrollRow = -1; + protected int alwidth; + protected int alheight; + /** + * Create an OverviewDimensions object + * + * @param ranges + * positional properties of the viewport + * @param showAnnotationPanel + * true if the annotation panel is to be shown, false otherwise + */ public OverviewDimensions(ViewportRanges ranges, boolean showAnnotationPanel) { @@ -97,16 +114,6 @@ public abstract class OverviewDimensions g.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2); } - public int getScrollCol() - { - return scrollCol; - } - - public int getScrollRow() - { - return scrollRow; - } - public int getBoxX() { return boxX; @@ -218,8 +225,8 @@ public abstract class OverviewDimensions */ 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(); @@ -228,12 +235,9 @@ public abstract class OverviewDimensions 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