From: James Procter Date: Tue, 18 Jul 2023 14:45:27 +0000 (+0100) Subject: JAL-3858 fix off-by-one in matrix visualisation and interactive tooltip X-Git-Tag: Release_2_11_4_0~124^2~16 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=011df19c7cd01c6355a885fb0c2fff33a236d6ff;p=jalview.git JAL-3858 fix off-by-one in matrix visualisation and interactive tooltip --- diff --git a/src/jalview/datamodel/ContactListImpl.java b/src/jalview/datamodel/ContactListImpl.java index 69dcf71..bb31c5d 100644 --- a/src/jalview/datamodel/ContactListImpl.java +++ b/src/jalview/datamodel/ContactListImpl.java @@ -55,9 +55,9 @@ public class ContactListImpl implements ContactListI { from_column = 0; } - if (to_column > getContactHeight()) + if (to_column >= getContactHeight()) { - to_column = getContactHeight(); + to_column = getContactHeight()-1; } ContactRange cr = new ContactRange(); cr.setFrom_column(from_column); diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index cf37e9e..8321741 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -737,7 +737,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, if (evt.isControlDown() && PAEContactMatrix.PAEMATRIX.equals(clicked.getCalcId())) { - int c = fr - 1; + int c = fr; ContactRange cr = forCurrentX.getRangeFor(fr, to); double cval; // TODO: could use GraphLine instead of arbitrary picking @@ -747,7 +747,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, // controls feathering - what other elements in row/column // should we select double thresh = cr.getMean() + (cr.getMax() - cr.getMean()) * .15; - while (c > 0) + while (c >= 0) { cval = forCurrentX.getContactAt(c); if (// cr.getMin() <= cval && @@ -1301,6 +1301,10 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, // TODO abstract tooltip generator so different implementations can be built if (ann.graph == AlignmentAnnotation.CONTACT_MAP) { + if (rowAndOffset>=ann.graphHeight) + { + return null; + } ContactListI clist = av.getContactList(ann, column); if (clist != null) {