From 011df19c7cd01c6355a885fb0c2fff33a236d6ff Mon Sep 17 00:00:00 2001 From: James Procter Date: Tue, 18 Jul 2023 15:45:27 +0100 Subject: [PATCH] JAL-3858 fix off-by-one in matrix visualisation and interactive tooltip --- src/jalview/datamodel/ContactListImpl.java | 4 ++-- src/jalview/gui/AnnotationPanel.java | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) 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) { -- 1.7.10.2