From e2c4c31f9a5cdbc22f0f2cbd1c377b8ede26baf1 Mon Sep 17 00:00:00 2001 From: kiramt Date: Wed, 15 Nov 2017 11:44:44 +0000 Subject: [PATCH] JAL-2840 fix wrapped scrolling when using cursor at a hidden region --- src/jalview/gui/SeqPanel.java | 5 ++++- src/jalview/viewmodel/ViewportRanges.java | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) 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) { -- 1.7.10.2