From: kiramt Date: Tue, 9 May 2017 12:39:29 +0000 (+0100) Subject: JAL-2491 Resolved highlighting and initialisation problems X-Git-Tag: Release_2_10_2~3^2~64^2~19 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=9a9de4a2b0432d0c5e65b033f51ac7e95e8bbbda;p=jalview.git JAL-2491 Resolved highlighting and initialisation problems --- diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 4cfa7d5..8619ad0 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -152,13 +152,12 @@ public class AlignmentPanel extends GAlignmentPanel implements // reset the viewport ranges when the alignment panel is resized // in particular, this initialises the end residue value when Jalview // is initialised - - if (av.getWrapAlignment()) { int widthInRes = getSeqPanel().seqCanvas .getWrappedCanvasWidth(getSeqPanel().seqCanvas.getWidth()); - vpRanges.setStartEndRes(vpRanges.getStartRes(), widthInRes); + vpRanges.setStartEndRes(vpRanges.getStartRes(), + vpRanges.getStartRes() + widthInRes); } else { @@ -166,11 +165,11 @@ public class AlignmentPanel extends GAlignmentPanel implements .getCharWidth()) - 1; int heightInSeq = (getSeqPanel().seqCanvas.getHeight() / av.getCharHeight()) - 1; - vpRanges.setStartEndRes(vpRanges.getStartRes(), widthInRes); - vpRanges.setStartEndSeq(vpRanges.getStartSeq(), heightInSeq); + vpRanges.setStartEndRes(vpRanges.getStartRes(), + vpRanges.getStartRes() + widthInRes); + vpRanges.setStartEndSeq(vpRanges.getStartSeq(), + vpRanges.getStartSeq() + heightInSeq); } - - } }); @@ -488,7 +487,6 @@ public class AlignmentPanel extends GAlignmentPanel implements else { vpRanges.scrollToWrappedVisible(start); - // scrollToWrappedVisible(start); } } @@ -635,7 +633,8 @@ public class AlignmentPanel extends GAlignmentPanel implements { int widthInRes = getSeqPanel().seqCanvas .getWrappedCanvasWidth(getSeqPanel().seqCanvas.getWidth()); - vpRanges.setStartEndRes(vpRanges.getStartRes(), widthInRes); + vpRanges.setStartEndRes(vpRanges.getStartRes(), + vpRanges.getStartRes() + widthInRes - 1); } else { @@ -760,7 +759,7 @@ public class AlignmentPanel extends GAlignmentPanel implements } else if (offy > -1) { - vpRanges.setStartEndRes(offy * rowSize, (offy + 1) * rowSize); + vpRanges.setStartEndRes(offy * rowSize, (offy + 1) * rowSize - 1); } else { diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index df953a2..d7f2679 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -511,7 +511,7 @@ public class SeqCanvas extends JComponent implements ViewportListenerI av.setWrappedWidth(cWidth); - av.getRanges().setEndRes(av.getRanges().getStartRes() + cWidth); + av.getRanges().setEndRes(av.getRanges().getStartRes() + cWidth - 1); int endx; int ypos = hgap; diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 82d98c0..c14854b 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -689,10 +689,16 @@ public class SeqPanel extends JPanel implements MouseListener, if (av.isFollowHighlight()) { + // don't allow highlight of protein/cDNA to also scroll a complementary + // panel,as this sets up a feedback loop (scrolling panel 1 causes moused + // over residue to change abruptly, causing highlighted residue in panel 2 + // to change, causing a scroll in panel 1 etc) + ap.setDontScrollComplement(true); if (ap.scrollToPosition(results, false)) { seqCanvas.revalidate(); } + ap.setDontScrollComplement(false); } setStatusMessage(results); seqCanvas.highlightSearchResults(results);