more efficient highlighting and selection display
authorjprocter <Jim Procter>
Fri, 21 Jan 2011 17:09:43 +0000 (17:09 +0000)
committerjprocter <Jim Procter>
Fri, 21 Jan 2011 17:09:43 +0000 (17:09 +0000)
src/jalview/gui/SeqPanel.java

index fdcfaca..d176b86 100755 (executable)
@@ -168,6 +168,11 @@ public class SeqPanel extends JPanel implements MouseListener,
     }
     else
     {
+      if (x>seqCanvas.getWidth()+seqCanvas.getWidth())
+      {
+        // make sure we calculate relative to visible alignment, rather than right-hand gutter
+        x = seqCanvas.getX()+seqCanvas.getWidth();
+      }
       res = (x / av.getCharWidth()) + av.getStartRes();
     }
 
@@ -610,8 +615,10 @@ public class SeqPanel extends JPanel implements MouseListener,
   {
     if (av.followHighlight)
     {
-      ap.scrollToPosition(results, false);
+      if (ap.scrollToPosition(results, false))
+      {
       seqCanvas.revalidate();
+      }
     }
     seqCanvas.highlightSearchResults(results);
   }
@@ -1888,7 +1895,7 @@ public class SeqPanel extends JPanel implements MouseListener,
     if (av.selectionGroup == null || !av.isSelectionGroupChanged())
     {
       SequenceGroup sgroup = null;
-      if (seqsel != null)
+      if (seqsel != null && seqsel.getSize()>0)
       {
         if (av.alignment == null)
         {