JAL-2547 don't show features in tooltip over a gap
[jalview.git] / src / jalview / gui / SeqPanel.java
index 7dfac5e..2884c50 100644 (file)
@@ -788,7 +788,7 @@ public class SeqPanel extends JPanel implements MouseListener,
       }
     }
 
-    if (av.isShowSequenceFeatures())
+    if (av.isShowSequenceFeatures() && pos != -1)
     {
       List<SequenceFeature> features = ap.getFeatureRenderer()
               .findFeaturesAtRes(sequence.getDatasetSequence(), pos);
@@ -861,7 +861,8 @@ public class SeqPanel extends JPanel implements MouseListener,
   /**
    * Sets the status message in alignment panel, showing the sequence number
    * (index) and id, residue and residue position for the given sequence and
-   * column position. Returns the calculated residue position in the sequence.
+   * column position. Returns the calculated residue position in the sequence,
+   * or -1 for a gapped column position.
    * 
    * @param sequence
    *          aligned sequence object
@@ -907,9 +908,9 @@ public class SeqPanel extends JPanel implements MouseListener,
     }
 
     int pos = -1;
-    pos = sequence.findPosition(column);
     if (residue != null)
     {
+      pos = sequence.findPosition(column);
       text.append(" (").append(Integer.toString(pos)).append(")");
     }
     ap.alignFrame.statusBar.setText(text.toString());