JAL-147 don't scroll up beyond startRes = 0 bug/JAL-147scrollWrappedView
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 18 Jul 2017 13:44:27 +0000 (14:44 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 18 Jul 2017 13:44:27 +0000 (14:44 +0100)
src/jalview/appletgui/AlignmentPanel.java
src/jalview/gui/AlignmentPanel.java

index f8f31b2..4147177 100644 (file)
@@ -817,14 +817,14 @@ public class AlignmentPanel extends Panel implements AdjustmentListener,
       {
         return;
       }
-      else if (newY > -1)
+      if (newY > -1)
       {
         /*
          * limit page up/down to one width's worth of positions
          */
         int rowSize = vpRanges.getViewportWidth();
         int newX = newY > oldY ? oldX + rowSize : oldX - rowSize;
-        vpRanges.setViewportStartAndWidth(newX, rowSize);
+        vpRanges.setViewportStartAndWidth(Math.max(0, newX), rowSize);
       }
     }
     else
index a732527..e62707f 100644 (file)
@@ -809,14 +809,14 @@ public class AlignmentPanel extends GAlignmentPanel implements
       {
         return;
       }
-      else if (newY > -1)
+      if (newY > -1)
       {
         /*
          * limit page up/down to one width's worth of positions
          */
         int rowSize = vpRanges.getViewportWidth();
         int newX = newY > oldY ? oldX + rowSize : oldX - rowSize;
-        vpRanges.setViewportStartAndWidth(newX, rowSize);
+        vpRanges.setViewportStartAndWidth(Math.max(0, newX), rowSize);
       }
     }
     else