From: James Procter Date: Mon, 27 Feb 2023 18:43:23 +0000 (+0000) Subject: JAL-4134 leaves marked when columns are selected - doesn’t refresh automatically... X-Git-Tag: Release_2_11_3_0~15^2^2~24 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=581a86ef3fc695b8a906bc6d1746cc5f39fcba35;p=jalview.git JAL-4134 leaves marked when columns are selected - doesn’t refresh automatically from alignment yet (only when tree panel repainted) --- diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java index b8bcc74..7bdb673 100755 --- a/src/jalview/gui/TreeCanvas.java +++ b/src/jalview/gui/TreeCanvas.java @@ -294,10 +294,22 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, nameHash.put(node.element(), rect); // Colour selected leaves differently - SequenceGroup selected = av.getSelectionGroup(); + boolean isSelected = false; + if (tp.getColumnWise()) + { + isSelected = isColumnForNodeSelected(node); + } + else + { + SequenceGroup selected = av.getSelectionGroup(); - if ((selected != null) - && selected.getSequences(null).contains(node.element())) + if ((selected != null) + && selected.getSequences(null).contains(node.element())) + { + isSelected = true; + } + } + if (isSelected) { g.setColor(Color.gray); @@ -1009,6 +1021,30 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, } } + private boolean isColumnForNodeSelected(BinaryNode bn) + { + SequenceI rseq = tp.assocAnnotation.sequenceRef; + int colm = -1; + try + { + colm = Integer.parseInt( + bn.getName().substring(bn.getName().indexOf("c") + 1)); + } catch (Exception e) + { + return false; + } + ColumnSelection cs = av.getColumnSelection(); + HiddenColumns hc = av.getAlignment().getHiddenColumns(); + int offp = (rseq != null) ? rseq.findIndex(rseq.getStart() - 1 + colm) + : colm; + + if (!av.hasHiddenColumns() || hc.isVisible(offp)) + { + return cs.contains(offp); + } + return false; + } + private void markColumnsFor(AlignmentPanel[] aps, Vector l, Color col) {