From: kiramt Date: Wed, 10 May 2017 13:53:54 +0000 (+0100) Subject: JAL-2491 Make it work with cursor movement X-Git-Tag: Release_2_10_2~3^2~64^2~16 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=bee47de0371990bf2563e77a57cc750634aabd08;p=jalview.git JAL-2491 Make it work with cursor movement --- diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index d7f2679..abd473d 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -294,13 +294,12 @@ public class SeqCanvas extends JComponent implements ViewportListenerI if (horizontal > 0) // scrollbar pulled right, image to the left { - er++; transX = (er - sr - horizontal) * charWidth; sr = er - horizontal; } else if (horizontal < 0) { - er = sr - horizontal - 1; + er = sr - horizontal; } else if (vertical > 0) // scroll down { diff --git a/src/jalview/viewmodel/ViewportRanges.java b/src/jalview/viewmodel/ViewportRanges.java index 15f5023..ebacab1 100644 --- a/src/jalview/viewmodel/ViewportRanges.java +++ b/src/jalview/viewmodel/ViewportRanges.java @@ -390,15 +390,24 @@ public class ViewportRanges extends ViewportProperties setStartRes((res / width) * width); } - // pass av here until hidden columns JAL-2388 merged, then use alignment - // instead + /** + * Scroll so that (x,y) is visible + * + * @param x + * x position in alignment + * @param y + * y position in alignment + * @param av + * viewport to be visible in. Here until hidden columns JAL-2388 + * merged, then use alignment to get hidden cols + */ public void scrollToVisible(int x, int y, AlignViewportI av) { while (y < startSeq) { scrollUp(true); } - while (y + 1 > endSeq) + while (y > endSeq) { scrollUp(false); }