From: kiramt Date: Wed, 15 Nov 2017 11:44:44 +0000 (+0000) Subject: JAL-2840 fix wrapped scrolling when using cursor at a hidden region X-Git-Tag: Release_2_10_3b1~23^2~2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e2c4c31f9a5cdbc22f0f2cbd1c377b8ede26baf1;p=jalview.git JAL-2840 fix wrapped scrolling when using cursor at a hidden region --- diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 2223ee5..d8d674f 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -402,7 +402,10 @@ public class SeqPanel extends JPanel endEditing(); if (av.getWrapAlignment()) { - av.getRanges().scrollToWrappedVisible(seqCanvas.cursorX); + // scrollToWrappedVisible expects x-value to have hidden cols subtracted + int x = av.getAlignment().getHiddenColumns() + .findColumnPosition(seqCanvas.cursorX); + av.getRanges().scrollToWrappedVisible(x); } else { diff --git a/src/jalview/viewmodel/ViewportRanges.java b/src/jalview/viewmodel/ViewportRanges.java index 24ff57f..1ab0e2f 100644 --- a/src/jalview/viewmodel/ViewportRanges.java +++ b/src/jalview/viewmodel/ViewportRanges.java @@ -477,7 +477,8 @@ public class ViewportRanges extends ViewportProperties * the startRes changed, else false. * * @param res - * residue position to scroll to + * residue position to scroll to NB visible position not absolute + * alignment position * @return */ public boolean scrollToWrappedVisible(int res) @@ -514,9 +515,9 @@ public class ViewportRanges extends ViewportProperties * Scroll so that (x,y) is visible. Fires a property change event. * * @param x - * x position in alignment + * x position in alignment (absolute position) * @param y - * y position in alignment + * y position in alignment (absolute position) */ public void scrollToVisible(int x, int y) {