JAL-2349 JAL-3855 off by one and daft return
[jalview.git] / src / jalview / renderer / ContactMapRenderer.java
index 7a435c3..58e6ab1 100644 (file)
@@ -67,15 +67,11 @@ public class ContactMapRenderer implements AnnotationRowRendererI
         x++;
         continue;
       }
-      if (_aa.sequenceRef != null)
-      {
-        // get the sequence position for the column
-        column = _aa.sequenceRef.findPosition(column) - 1;
-      }
       ContactListI contacts = viewport.getContactList(_aa, column);
       if (contacts == null)
       {
-        return;
+        x++;
+        continue;
       }
       // Bean holding mapping from contact list to pixels
       final ContactGeometry cgeom = new ContactGeometry(contacts,
@@ -94,7 +90,7 @@ public class ContactMapRenderer implements AnnotationRowRendererI
         // also need a 'getMaxPosForRange(start,end)' to accurately render
         Color col;
         boolean rowsel = false;
-        if (!colsel && columnSelection != null)
+        if (columnSelection != null)
         {
           if (_aa.sequenceRef == null)
           {
@@ -118,6 +114,14 @@ public class ContactMapRenderer implements AnnotationRowRendererI
 
           col = getSelectedColorForRange(min, max, contacts, ci.cStart,
                   ci.cEnd);
+          if (colsel && rowsel)
+          {
+            col = new Color(col.getBlue(), col.getGreen(), col.getRed());
+          }
+          else
+          {
+            col = new Color(col.getBlue(), col.getBlue(), col.getBlue());
+          }
           g.setColor(col);
         }
         else
@@ -140,8 +144,11 @@ public class ContactMapRenderer implements AnnotationRowRendererI
   }
 
   // Shading parameters
-  Color minColor = Color.white, maxColor = Color.green.darker().darker(),
-          selMaxColor = Color.magenta.darker();
+  // currently hardwired for alphafold
+  Color maxColor = new Color(246, 252, 243),
+          minColor = new Color(0, 60, 26),
+          selMinColor = new Color(26, 0, 60),
+          selMaxColor = new Color(243, 246, 252);
 
   Color shadeFor(float min, float max, float value)
   {
@@ -163,7 +170,7 @@ public class ContactMapRenderer implements AnnotationRowRendererI
     ContactRange cr = cl.getRangeFor(i, j);
     // average for moment - probably more interested in maxIntProj though
     return jalview.util.ColorUtils.getGraduatedColour((float) cr.getMean(),
-            0, minColor, max, selMaxColor);
+            0, selMinColor, max, selMaxColor);
   }
 
 }