JAL-2963 correctly dim PCA points with negative z-coordinates
[jalview.git] / src / jalview / appletgui / RotatableCanvas.java
index 179a91d..3000363 100755 (executable)
@@ -344,29 +344,13 @@ public class RotatableCanvas extends Panel implements MouseListener,
 
   public void drawScene(Graphics g)
   {
-    // boolean darker = false;
-
-    int halfwidth = getSize().width / 2;
-    int halfheight = getSize().height / 2;
-
     for (int i = 0; i < npoint; i++)
     {
       SequencePoint sp = points.elementAt(i);
-      int x = (int) ((sp.coord.x - centre.x) * scale) + halfwidth;
-      int y = (int) ((sp.coord.y - centre.y) * scale)
-              + halfheight;
-      float z = sp.coord.y - centre.z;
-
       SequenceI sequence = sp.getSequence();
-      if (av.getSequenceColour(sequence) == Color.black)
-      {
-        g.setColor(Color.white);
-      }
-      else
-      {
-        g.setColor(av.getSequenceColour(sequence));
-      }
-
+      Color sequenceColour = av.getSequenceColour(sequence);
+      g.setColor(
+              sequenceColour == Color.black ? Color.white : sequenceColour);
       if (av.getSelectionGroup() != null)
       {
         if (av.getSelectionGroup().getSequences(null)
@@ -375,12 +359,18 @@ public class RotatableCanvas extends Panel implements MouseListener,
           g.setColor(Color.gray);
         }
       }
-      if (z < 0)
+
+      if (sp.coord.z < centre.z)
       {
         g.setColor(g.getColor().darker());
       }
 
+      int halfwidth = getSize().width / 2;
+      int halfheight = getSize().height / 2;
+      int x = (int) ((sp.coord.x - centre.x) * scale) + halfwidth;
+      int y = (int) ((sp.coord.y - centre.y) * scale) + halfheight;
       g.fillRect(x - 3, y - 3, 6, 6);
+
       if (showLabels)
       {
         g.setColor(Color.red);