JAL-3596 don't draw text over features if Show Text is unselected
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Sun, 12 Apr 2020 12:24:24 +0000 (13:24 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Sun, 12 Apr 2020 12:24:24 +0000 (13:24 +0100)
src/jalview/renderer/seqfeatures/FeatureRenderer.java

index a1980c7..7a92a88 100644 (file)
  */
 package jalview.renderer.seqfeatures;
 
+import java.awt.AlphaComposite;
+import java.awt.Color;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.util.List;
+
 import jalview.api.AlignViewportI;
 import jalview.api.FeatureColourI;
 import jalview.datamodel.ContiguousI;
@@ -32,13 +39,6 @@ import jalview.util.Comparison;
 import jalview.util.ReverseListIterator;
 import jalview.viewmodel.seqfeatures.FeatureRendererModel;
 
-import java.awt.AlphaComposite;
-import java.awt.Color;
-import java.awt.FontMetrics;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.util.List;
-
 public class FeatureRenderer extends FeatureRendererModel
 {
   private static final AlphaComposite NO_TRANSPARENCY = AlphaComposite
@@ -112,10 +112,13 @@ public class FeatureRenderer extends FeatureRendererModel
         continue;
       }
 
-      g.setColor(Color.white);
-      int charOffset = (charWidth - fm.charWidth(s)) / 2;
-      g.drawString(String.valueOf(s),
-              charOffset + (charWidth * (i - start)), pady);
+      if (av.getShowText())
+      {
+        g.setColor(Color.white);
+        int charOffset = (charWidth - fm.charWidth(s)) / 2;
+        g.drawString(String.valueOf(s),
+                charOffset + (charWidth * (i - start)), pady);
+      }
     }
     return true;
   }