JAL-2491 Tidies to Overview panel calls in light of new code
[jalview.git] / src / jalview / viewmodel / OverviewDimensions.java
index e4c24e1..1abc93b 100644 (file)
@@ -60,12 +60,6 @@ public class OverviewDimensions
   // height of box
   private int boxHeight = -1;
 
-  // scroll position in viewport corresponding to boxX
-  private int scrollCol = -1;
-
-  // scroll position in viewport corresponding to boxY
-  private int scrollRow = -1;
-
   /**
    * Create an OverviewDimensions object
    * 
@@ -171,14 +165,14 @@ public class OverviewDimensions
       // went past the end of the alignment, adjust backwards
 
       // if last position was before the end of the alignment, need to update
-      if ((scrollCol + vpwidth - 1) < visAlignWidth)
+      if ((ranges.getStartRes() + vpwidth - 1) < visAlignWidth)
       {
         visXAsRes = hiddenCols.findColumnPosition(hiddenCols
                 .subtractVisibleColumns(vpwidth - 1, alwidth - 1));
       }
       else
       {
-        visXAsRes = scrollCol;
+        visXAsRes = ranges.getStartRes();
       }
     }
 
@@ -205,22 +199,19 @@ public class OverviewDimensions
     if (visYAsRes + vpheight - 1 > visAlignHeight)
     {
       // went past the end of the alignment, adjust backwards
-      if ((scrollRow + vpheight - 1) < visAlignHeight)
+      if ((ranges.getEndRes() + vpheight - 1) < visAlignHeight)
       {
         visYAsRes = hiddenSeqs.findIndexWithoutHiddenSeqs(hiddenSeqs
                 .subtractVisibleRows(vpheight - 1, alheight - 1));
       }
       else
       {
-        visYAsRes = scrollRow;
+        visYAsRes = ranges.getEndRes();
       }
     }
 
-    // update scroll values
-    // scrollCol = visXAsRes;
-    // scrollRow = visYAsRes;
+    // update viewport
     ranges.setStartRes(visXAsRes);
-
     ranges.setStartSeq(visYAsRes);
   }
 
@@ -272,20 +263,12 @@ public class OverviewDimensions
    */
   public void drawBox(Graphics g)
   {
+    System.out.println("Drawbox: " + boxX + " " + boxY + " " + boxWidth
+            + " " + boxHeight);
     g.drawRect(boxX, boxY, boxWidth, boxHeight);
     g.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2);
   }
 
-  /*public int getScrollCol()
-  {
-    return scrollCol;
-  }
-
-  public int getScrollRow()
-  {
-    return scrollRow;
-  }*/
-
   // TODO should be removed, when unit test has mock Graphics object available
   // to check boxX/boxY
   public int getBoxX()