JAL-3081 JAL-3199 no auto-sort of annotations after manual reordering
[jalview.git] / src / jalview / analysis / AnnotationSorter.java
index 2f556f1..5a7e72f 100644 (file)
@@ -51,7 +51,12 @@ public class AnnotationSorter
   {
     // Text descriptions surface in the Preferences Sort by... options
     SEQUENCE_AND_LABEL("Sequence"), LABEL_AND_SEQUENCE("Label"),
-    NONE("No sort");
+    NONE("No sort"),
+
+    /**
+     * custom is set if user drags to reorder annotations
+     */
+    CUSTOM("Customised");
 
     private String description;
 
@@ -86,7 +91,7 @@ public class AnnotationSorter
   private boolean showAutocalcAbove;
 
   // working map of sequence index in alignment
-  private final Map<SequenceI, Integer> sequenceIndices = new HashMap<SequenceI, Integer>();
+  private final Map<SequenceI, Integer> sequenceIndices = new HashMap<>();
 
   /**
    * Constructor given an alignment and the location (top or bottom) of
@@ -273,7 +278,8 @@ public class AnnotationSorter
   public void sort(AlignmentAnnotation[] alignmentAnnotations,
           SequenceAnnotationOrder order)
   {
-    if (alignmentAnnotations == null)
+    if (alignmentAnnotations == null
+            || order == SequenceAnnotationOrder.CUSTOM)
     {
       return;
     }