JAL-4033 fix drag selections and distinguish row/columnwise highlights from intersect...
authorJim Procter <j.procter@dundee.ac.uk>
Thu, 20 Oct 2022 13:00:49 +0000 (14:00 +0100)
committerJim Procter <j.procter@dundee.ac.uk>
Thu, 20 Oct 2022 13:00:49 +0000 (14:00 +0100)
src/jalview/gui/AnnotationPanel.java
src/jalview/renderer/ContactMapRenderer.java

index 4f5b7d0..f0c2404 100755 (executable)
@@ -889,15 +889,17 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
       ContactGeometry lastXcgeom = new ContactGeometry(forFromX,
               cma.graphHeight);
       ContactGeometry.contactInterval lastXci = lastXcgeom
-              .mapFor(rowIndex[1], rowIndex[1] + deltaY);
+              .mapFor(rowIndex[1], rowIndex[1] - deltaY);
+
       ContactGeometry cXcgeom = new ContactGeometry(forToX,
               cma.graphHeight);
       ContactGeometry.contactInterval cXci = cXcgeom.mapFor(rowIndex[1],
-              rowIndex[1] + deltaY);
+              rowIndex[1] - deltaY);
+
       // mark rectangular region formed by drag
-      System.err.println("Matrix Selection from last(" + lastXci.cStart
-              + "," + lastXci.cEnd + ") to cur(" + cXci.cStart + ","
-              + cXci.cEnd + ")");
+      System.err.println("Matrix Selection from last(" + fromXc + ",["
+              + lastXci.cStart + "," + lastXci.cEnd + "]) to cur(" + toXc
+              + ",[" + cXci.cStart + "," + cXci.cEnd + "])");
       int fr, to;
       fr = Math.min(lastXci.cStart, lastXci.cEnd);
       to = Math.max(lastXci.cStart, lastXci.cEnd);
index 58fb984..29ee22e 100644 (file)
@@ -94,7 +94,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 +118,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