From: gmungoc Date: Tue, 18 Jul 2017 13:44:27 +0000 (+0100) Subject: JAL-147 don't scroll up beyond startRes = 0 X-Git-Tag: Release_2_10_3b1~132^2~39 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ddbcb3e33e1a8d4c644472cfa3d28b193da97064;p=jalview.git JAL-147 don't scroll up beyond startRes = 0 --- diff --git a/src/jalview/appletgui/AlignmentPanel.java b/src/jalview/appletgui/AlignmentPanel.java index f8f31b2..4147177 100644 --- a/src/jalview/appletgui/AlignmentPanel.java +++ b/src/jalview/appletgui/AlignmentPanel.java @@ -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 diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index a732527..e62707f 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -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