From: kiramt Date: Wed, 28 Jun 2017 11:49:17 +0000 (+0100) Subject: JAL-2600 Tidies X-Git-Tag: Release_2_10_3b1~183^2^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fbug%2FJAL-2600resizeflicker;p=jalview.git JAL-2600 Tidies --- 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; } }