Merge branch 'bug/JAL-2421overviewboxflicker' into develop
[jalview.git] / src / jalview / gui / AlignmentPanel.java
index e61b042..d793e6a 100644 (file)
@@ -91,9 +91,9 @@ public class AlignmentPanel extends GAlignmentPanel implements
   // this value is set false when selection area being dragged
   boolean fastPaint = true;
 
-  int hextent = 0;
+  private int hextent = 0;
 
-  int vextent = 0;
+  private int vextent = 0;
 
   /*
    * Flag set while scrolling to follow complementary cDNA/protein scroll. When
@@ -688,7 +688,6 @@ public class AlignmentPanel extends GAlignmentPanel implements
    */
   public void setScrollValues(int x, int y)
   {
-    // System.err.println("Scroll " + this.av.viewName + " to " + x + "," + y);
     if (av == null || av.getAlignment() == null)
     {
       return;
@@ -698,12 +697,10 @@ public class AlignmentPanel extends GAlignmentPanel implements
 
     if (av.hasHiddenColumns())
     {
+      // reset the width to exclude hidden columns
       width = av.getColumnSelection().findColumnPosition(width);
     }
 
-    av.setEndRes((x + (getSeqPanel().seqCanvas.getWidth() / av
-            .getCharWidth())) - 1);
-
     hextent = getSeqPanel().seqCanvas.getWidth() / av.getCharWidth();
     vextent = getSeqPanel().seqCanvas.getHeight() / av.getCharHeight();
 
@@ -737,6 +734,10 @@ public class AlignmentPanel extends GAlignmentPanel implements
       x = 0;
     }
 
+    // update endRes after x has (possibly) been adjusted
+    av.setEndRes((x + (getSeqPanel().seqCanvas.getWidth() / av
+            .getCharWidth())) - 1);
+
     /*
      * each scroll adjustment triggers adjustmentValueChanged, which resets the
      * 'do not scroll complement' flag; ensure it is the same for both