Tidy up group size after alignmentChanged
authoramwaterhouse <Andrew Waterhouse>
Tue, 7 Nov 2006 11:52:14 +0000 (11:52 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 7 Nov 2006 11:52:14 +0000 (11:52 +0000)
src/jalview/gui/AlignViewport.java

index 0161517..b275611 100755 (executable)
@@ -1536,6 +1536,22 @@ public class AlignViewport
           updateConservation(ap);
         }
 
+        //Reset endRes of groups if beyond alignment width
+        int alWidth = alignment.getWidth();
+        Vector groups = alignment.getGroups();
+        if(groups!=null)
+        {
+          for(int i=0; i<groups.size(); i++)
+          {
+            SequenceGroup sg = (SequenceGroup)groups.elementAt(i);
+            if(sg.getEndRes()>alWidth)
+              sg.setEndRes(alWidth-1);
+          }
+        }
+
+        if(selectionGroup!=null && selectionGroup.getEndRes()>alWidth)
+          selectionGroup.setEndRes(alWidth-1);
+
         resetAllColourSchemes();
 
         alignment.adjustSequenceAnnotations();