From: gmungoc Date: Fri, 11 Dec 2020 12:44:42 +0000 (+0000) Subject: JAL-3612 use _last_ drawn colour per feature type in Overview X-Git-Tag: Release_2_11_2_6~22^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fbug%2FJAL-3612_overviewFeatureOrdering;p=jalview.git JAL-3612 use _last_ drawn colour per feature type in Overview --- diff --git a/src/jalview/renderer/seqfeatures/FeatureRenderer.java b/src/jalview/renderer/seqfeatures/FeatureRenderer.java index aa3328b..fe80e63 100644 --- a/src/jalview/renderer/seqfeatures/FeatureRenderer.java +++ b/src/jalview/renderer/seqfeatures/FeatureRenderer.java @@ -539,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 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); diff --git a/test/jalview/renderer/seqfeatures/FeatureColourFinderTest.java b/test/jalview/renderer/seqfeatures/FeatureColourFinderTest.java index 6b1fbd2..308adda 100644 --- a/test/jalview/renderer/seqfeatures/FeatureColourFinderTest.java +++ b/test/jalview/renderer/seqfeatures/FeatureColourFinderTest.java @@ -6,6 +6,13 @@ import static org.testng.Assert.assertNotEquals; import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; +import java.awt.Color; +import java.util.List; + +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; + import jalview.api.FeatureColourI; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; @@ -17,13 +24,6 @@ import jalview.schemes.FeatureColour; import jalview.viewmodel.seqfeatures.FeatureRendererModel; import jalview.viewmodel.seqfeatures.FeatureRendererModel.FeatureSettingsBean; -import java.awt.Color; -import java.util.List; - -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; - /** * Unit tests for feature colour determination, including but not limited to *