From d738273bebedaea35a9e4a5acbe5e681f9fbae67 Mon Sep 17 00:00:00 2001 From: kiramt Date: Wed, 28 Jun 2017 12:49:17 +0100 Subject: [PATCH] JAL-2600 Tidies --- src/jalview/appletgui/SeqCanvas.java | 9 +++++---- src/jalview/gui/SeqCanvas.java | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/jalview/appletgui/SeqCanvas.java b/src/jalview/appletgui/SeqCanvas.java index 469dec9..e996622 100755 --- a/src/jalview/appletgui/SeqCanvas.java +++ b/src/jalview/appletgui/SeqCanvas.java @@ -884,13 +884,14 @@ public class SeqCanvas extends Panel implements ViewportListenerI // larger than the visible window ViewportRanges vpRanges = av.getRanges(); scrollX = (int) evt.getNewValue() - (int) evt.getOldValue(); - if (scrollX > vpRanges.getEndRes() - vpRanges.getStartRes()) + int range = vpRanges.getEndRes() - vpRanges.getStartRes(); + if (scrollX > range) { - scrollX = vpRanges.getEndRes() - vpRanges.getStartRes(); + scrollX = range; } - else if (scrollX < vpRanges.getStartRes() - vpRanges.getEndRes()) + else if (scrollX < -range) { - scrollX = vpRanges.getStartRes() - vpRanges.getEndRes(); + scrollX = -range; } } diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index d8b3f2a..f392810 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -999,13 +999,14 @@ public class SeqCanvas extends JComponent implements ViewportListenerI // larger than the visible window ViewportRanges vpRanges = av.getRanges(); scrollX = (int) evt.getNewValue() - (int) evt.getOldValue(); - if (scrollX > vpRanges.getEndRes() - vpRanges.getStartRes()) + int range = vpRanges.getEndRes() - vpRanges.getStartRes(); + if (scrollX > range) { - scrollX = vpRanges.getEndRes() - vpRanges.getStartRes(); + scrollX = range; } - else if (scrollX < vpRanges.getStartRes() - vpRanges.getEndRes()) + else if (scrollX < -range) { - scrollX = vpRanges.getStartRes() - vpRanges.getEndRes(); + scrollX = -range; } } -- 1.7.10.2