From ddbcb3e33e1a8d4c644472cfa3d28b193da97064 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Tue, 18 Jul 2017 14:44:27 +0100 Subject: [PATCH] JAL-147 don't scroll up beyond startRes = 0 --- src/jalview/appletgui/AlignmentPanel.java | 4 ++-- src/jalview/gui/AlignmentPanel.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 -- 1.7.10.2