JAL-4134 fix up column selection when hidden regions are present. Needs tests!
authorJames Procter <j.procter@dundee.ac.uk>
Fri, 17 Mar 2023 17:33:05 +0000 (17:33 +0000)
committerJames Procter <j.procter@dundee.ac.uk>
Fri, 17 Mar 2023 17:33:05 +0000 (17:33 +0000)
src/jalview/gui/TreeCanvas.java

index 97ca391..98026da 100755 (executable)
@@ -1036,12 +1036,17 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
     }
     ColumnSelection cs = av.getColumnSelection();
     HiddenColumns hc = av.getAlignment().getHiddenColumns();
-    int offp = (rseq != null) ? rseq.findIndex(rseq.getStart() - 1 + colm)
+    int offp = (rseq != null) ? rseq.findIndex(rseq.getStart() + colm)
             : colm;
 
-    if (!av.hasHiddenColumns() || hc.isVisible(offp))
+    if (!av.hasHiddenColumns())
     {
-      return cs.contains(offp);
+      return cs.contains(offp-1);
+    }
+    if (hc.isVisible(offp-1))
+    {
+      return cs.contains(offp-1);
+//      return cs.contains(hc.absoluteToVisibleColumn(offp));
     }
     return false;
   }