JAL-3612 use _last_ drawn colour per feature type in Overview
[jalview.git] / src / jalview / renderer / seqfeatures / FeatureRenderer.java
index 1fccfa2..fe80e63 100644 (file)
@@ -112,6 +112,10 @@ public class FeatureRenderer extends FeatureRendererModel
         continue;
       }
 
+      /*
+       * JAL-3045 text is always drawn over features, even if
+       * 'Show Text' is unchecked in the format menu
+       */
       g.setColor(Color.white);
       int charOffset = (charWidth - fm.charWidth(s)) / 2;
       g.drawString(String.valueOf(s),
@@ -535,10 +539,15 @@ public class FeatureRenderer extends FeatureRendererModel
         continue;
       }
 
+      /*
+       * find features of this type, and the colour of the _last_ one
+       * (the one that would be drawn on top) that has a colour
+       */
       List<SequenceFeature> overlaps = seq.findFeatures(column, column,
               type);
-      for (SequenceFeature sequenceFeature : overlaps)
+      for (int i = overlaps.size() - 1 ; i >= 0 ; i--)
       {
+        SequenceFeature sequenceFeature = overlaps.get(i);
         if (!featureGroupNotShown(sequenceFeature))
         {
           Color col = getColour(sequenceFeature);