From: Jim Procter Date: Thu, 3 Nov 2022 16:27:10 +0000 (+0000) Subject: JAL-3855 JAL-4095 simple picking of ranges adjacent to a clicked region of the pAE... X-Git-Tag: Release_2_11_4_0~512 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=5221c772a071266446c5c959f34ec89c8e874201;p=jalview.git JAL-3855 JAL-4095 simple picking of ranges adjacent to a clicked region of the pAE that score less than the max pAE observed under the mouse --- diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 786696c..e146754 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -57,6 +57,7 @@ import jalview.datamodel.Annotation; import jalview.datamodel.ColumnSelection; import jalview.datamodel.ContactListI; import jalview.datamodel.ContactRange; +import jalview.datamodel.GraphLine; import jalview.datamodel.HiddenColumns; import jalview.datamodel.SequenceI; import jalview.gui.JalviewColourChooser.ColourChooserListener; @@ -598,6 +599,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, } else { + GraphLine thr = aa[graphStretch].getThreshold(); int currentX = getColumnForXPos(evt.getX()); ContactListI forCurrentX = av.getContactList(aa[graphStretch], currentX); @@ -610,11 +612,48 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, int fr, to; fr = Math.min(cXci.cStart, cXci.cEnd); to = Math.max(cXci.cStart, cXci.cEnd); - for (int c = fr; c <= to; c++) + // select corresponding range in segment under mouse { - av.getColumnSelection().addElement(c); + for (int c = fr; c <= to; c++) + { + av.getColumnSelection().addElement(c); + } + av.getColumnSelection().addElement(currentX); + } + // and also select everything lower than the max range adjacent + // (kind of works) + { + int c = fr - 1; + ContactRange cr = forCurrentX.getRangeFor(fr, to); + double cval; + while (c > 0) + { + cval = forCurrentX.getContactAt(c); + if (// cr.getMin() <= cval && + cval <= cr.getMax()) + { + av.getColumnSelection().addElement(c--); + } + else + { + break; + } + } + c = to; + while (c < forCurrentX.getContactHeight()) + { + cval = forCurrentX.getContactAt(c); + if (// cr.getMin() <= cval && + cval <= cr.getMax()) + { + av.getColumnSelection().addElement(c++); + } + else + { + break; + } + } } - av.getColumnSelection().addElement(currentX); } } }