JAL-2874 filtering alignment now also works when just zoomed in
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Tue, 12 Dec 2017 18:40:05 +0000 (18:40 +0000)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Tue, 12 Dec 2017 18:40:05 +0000 (18:40 +0000)
src/jalview/ext/archaeopteryx/JalviewBinding.java

index 11aab2b..0593217 100644 (file)
@@ -25,6 +25,7 @@ import jalview.util.MessageManager;
 import jalview.viewmodel.AlignmentViewport;
 
 import java.awt.Color;
+import java.awt.Rectangle;
 import java.awt.event.ActionEvent;
 import java.awt.event.InputEvent;
 import java.awt.event.MouseEvent;
@@ -177,6 +178,9 @@ public final class JalviewBinding
   @Override
   public void actionPerformed(ActionEvent e)
   {
+    // reset hidden sequences first
+    parentAvport.showAllHiddenSeqs();
+
     if (treeView.isCurrentTreeIsSubtree())
     {
     LoadedTreeSequenceAssociation bindAptxNodes = new LoadedTreeSequenceAssociation(
@@ -198,6 +202,25 @@ public final class JalviewBinding
       }
     }
 
+    else
+    {
+
+      Rectangle visibleView = treeView.getVisibleRect();
+
+      for (PhylogenyNode node : PhylogenyMethods.getAllDescendants(treeView.getPhylogeny().getRoot())) {
+        if (!(node.getXcoord() > visibleView.getMinX()
+                && node.getXcoord() < visibleView.getMaxX()
+                && node.getYcoord() > visibleView.getMinY()
+                && node.getYcoord() < visibleView.getMaxY()))
+        {
+          parentAvport
+                  .hideSequence(new SequenceI[]
+                  { nodesBoundToSequences.get(node) });
+        }
+      }
+
+    }
+
 
 
   }