From: gmungoc Date: Tue, 27 Jun 2017 12:59:46 +0000 (+0100) Subject: JAL-147 scroll wrapped panel by one width's worth at a time X-Git-Tag: Release_2_10_3b1~187 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=bf3206cc56a3bff812f96967a81cc9cff54a57b1;p=jalview.git JAL-147 scroll wrapped panel by one width's worth at a time --- diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 72b1cc9..3994c29 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -757,13 +757,19 @@ public class AlignmentPanel extends GAlignmentPanel implements // if we're scrolling to the position we're already at, stop // this prevents infinite recursion of events when the scroll/viewport // ranges values are the same - if ((offy * rowSize == oldX) && (oldwidth == rowSize)) + int newX = offy * rowSize; + if ((newX == oldX) && (oldwidth == rowSize)) { return; } else if (offy > -1) { - vpRanges.setViewportStartAndWidth(offy * rowSize, rowSize); + /* + * throttle to one width's worth at a time (so click in + * scrollbar doesn't jump over data) + */ + newX = newX > oldX ? oldX + rowSize : oldX - rowSize; + vpRanges.setViewportStartAndWidth(newX, rowSize); } } else