patch for JAL-695 - need to test if this is observed in applet
[jalview.git] / src / jalview / appletgui / AlignmentPanel.java
index 1296829..0519f47 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
  * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
@@ -224,6 +224,10 @@ public class AlignmentPanel extends Panel implements AdjustmentListener
     return new Dimension(idWidth, idPanel.idCanvas.getSize().height);
   }
 
+  /**
+   * Highlight the given results on the alignment.
+   * 
+   */
   public void highlightSearchResults(SearchResults results)
   {
     seqPanel.seqCanvas.highlightSearchResults(results);
@@ -261,6 +265,19 @@ public class AlignmentPanel extends Panel implements AdjustmentListener
       {
         return;
       }
+      if (av.hasHiddenColumns)
+      {
+        start = av.getColumnSelection().findColumnPosition(start);
+        end = av.getColumnSelection().findColumnPosition(end);
+        if (start==end)
+        {
+          if (!av.colSel.isVisible(r[0]))
+          {
+            // don't scroll - position isn't visible
+            return;
+          }
+        }
+      }
       if (!av.wrapAlignment)
       {
         if ((av.getStartRes() > end)
@@ -418,8 +435,7 @@ public class AlignmentPanel extends Panel implements AdjustmentListener
     }
 
     av.setStartRes(x);
-    av
-            .setEndRes((x + (seqPanel.seqCanvas.getSize().width / av.charWidth)) - 1);
+    av.setEndRes((x + (seqPanel.seqCanvas.getSize().width / av.charWidth)) - 1);
 
     hextent = seqPanel.seqCanvas.getSize().width / av.charWidth;
     vextent = seqPanel.seqCanvas.getSize().height / av.charHeight;