JAL-147 scroll wrapped panel by one width's worth at a time
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 27 Jun 2017 12:59:46 +0000 (13:59 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 27 Jun 2017 12:59:46 +0000 (13:59 +0100)
src/jalview/gui/AlignmentPanel.java

index 72b1cc9..3994c29 100644 (file)
@@ -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