JAL-3210 Barebones gradle/buildship/eclipse. See README
[jalview.git] / src / jalview / viewmodel / OverviewDimensions.java
index 8dc7dd8..0235081 100644 (file)
@@ -26,9 +26,7 @@ import jalview.datamodel.AlignmentI;
 import jalview.datamodel.HiddenColumns;
 import jalview.datamodel.HiddenSequences;
 
-import java.awt.Dimension;
 import java.awt.Graphics;
-import java.awt.Rectangle;
 
 public abstract class OverviewDimensions
 {
@@ -64,8 +62,6 @@ public abstract class OverviewDimensions
 
   protected float heightRatio;
 
-  private Rectangle vpbox = new Rectangle();
-
   /**
    * Create an OverviewDimensions object
    * 
@@ -75,23 +71,17 @@ public abstract class OverviewDimensions
    *          true if the annotation panel is to be shown, false otherwise
    */
   public OverviewDimensions(ViewportRanges ranges,
-          boolean showAnnotationPanel, Dimension dim)
+          boolean showAnnotationPanel)
   {
-    if (!showAnnotationPanel)
-    {
-      graphHeight = 0;
-    }
-
     // scale the initial size of overviewpanel to shape of alignment
     float initialScale = (float) ranges.getAbsoluteAlignmentWidth()
             / (float) ranges.getAbsoluteAlignmentHeight();
 
-    if (dim != null)
+    if (!showAnnotationPanel)
     {
-      width = dim.width;
-      sequencesHeight = dim.height;
-      return;
+      graphHeight = 0;
     }
+
     if (ranges.getAbsoluteAlignmentWidth() > ranges
             .getAbsoluteAlignmentHeight())
     {
@@ -124,9 +114,6 @@ public abstract class OverviewDimensions
    */
   public void drawBox(Graphics g)
   {
-    // System.out.println("OD drawBox " + boxX + " " + boxY + " " + boxWidth
-    // + " " + boxHeight);
-    updateBox();
     g.drawRect(boxX, boxY, boxWidth, boxHeight);
     g.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2);
   }
@@ -191,9 +178,6 @@ public abstract class OverviewDimensions
 
   public void setHeight(int h)
   {
-    // BH 2019 problem was that component.resize() can come
-    // after setBoxPosition().
-    // Solution was to move setting of box dimensions to paint
     sequencesHeight = h - graphHeight;
     heightRatio = (float) alheight / sequencesHeight;
   }
@@ -292,22 +276,17 @@ public abstract class OverviewDimensions
           int vpheight)
   {
     resetAlignmentDims();
-    vpbox = new Rectangle(startRes, startSeq, vpwidth, vpheight);
-    updateBox();
-  }
 
-  public void updateBox()
-  {
     // boxX, boxY is the x,y location equivalent to startRes, startSeq
-    int xPos = Math.min(vpbox.x, alwidth - vpbox.width + 1);
+    int xPos = Math.min(startRes, alwidth - vpwidth + 1);
     boxX = Math.round(xPos / widthRatio);
-    boxY = Math.round(vpbox.y / heightRatio);
+    boxY = Math.round(startSeq / heightRatio);
 
     // boxWidth is the width in residues translated to pixels
-    boxWidth = Math.max(1, Math.round(vpbox.width / widthRatio));
+    boxWidth = Math.round(vpwidth / widthRatio);
 
     // boxHeight is the height in sequences translated to pixels
-    boxHeight = Math.max(1, Math.round(vpbox.height / heightRatio));
+    boxHeight = Math.round(vpheight / heightRatio);
   }
 
   /**