fix for JAL-2419 - don’t trash the current selection
authorJim Procter <jprocter@issues.jalview.org>
Wed, 15 Feb 2017 17:12:02 +0000 (17:12 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Wed, 15 Feb 2017 17:12:02 +0000 (17:12 +0000)
src/jalview/appletgui/SeqPanel.java
src/jalview/gui/SeqPanel.java

index 904e3ce..1352fe9 100644 (file)
@@ -1426,7 +1426,12 @@ public class SeqPanel extends Panel implements MouseMotionListener,
     if (stretchGroup == null || !stretchGroup.contains(sequence, res))
     {
       stretchGroup = av.getAlignment().findGroup(sequence, res);
-      av.setSelectionGroup(stretchGroup);
+      if (stretchGroup != null)
+      {
+        // only update the current selection if the popup menu has a group to
+        // focus on
+        av.setSelectionGroup(stretchGroup);
+      }
     }
 
     // DETECT RIGHT MOUSE BUTTON IN AWT
index 0046206..55f23aa 100644 (file)
@@ -1590,7 +1590,12 @@ public class SeqPanel extends JPanel implements MouseListener,
     if (stretchGroup == null || !stretchGroup.contains(sequence, res))
     {
       stretchGroup = av.getAlignment().findGroup(sequence, res);
-      av.setSelectionGroup(stretchGroup);
+      if (stretchGroup != null)
+      {
+        // only update the current selection if the popup menu has a group to
+        // focus on
+        av.setSelectionGroup(stretchGroup);
+      }
     }
 
     if (evt.isPopupTrigger()) // Mac: mousePressed