From 98465614d8876f07bc43d8d5536feae8648b8ed9 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Wed, 31 Jan 2024 12:47:13 +0000 Subject: [PATCH] JAL-4375 Fix big sideways scroll from trackpad at beginning and end of visible alignment. --- src/jalview/viewmodel/ViewportRanges.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/jalview/viewmodel/ViewportRanges.java b/src/jalview/viewmodel/ViewportRanges.java index f842736..03d4172 100644 --- a/src/jalview/viewmodel/ViewportRanges.java +++ b/src/jalview/viewmodel/ViewportRanges.java @@ -530,21 +530,24 @@ public class ViewportRanges extends ViewportProperties { if (!right) { - if (startRes < jump) + if (startRes < 1) { return false; } - - setStartRes(startRes - jump); + int jumpto = Math.max(startRes - jump, 0); + setStartRes(jumpto); } else { - if (endRes >= getVisibleAlignmentWidth() - jump) + int vawidth = getVisibleAlignmentWidth(); + if (endRes >= vawidth - 1) { return false; } - setStartRes(startRes + jump); + int jumpto = Math.min(startRes + jump, + vawidth - (endRes - startRes + 1)); + setStartRes(jumpto); } return true; -- 1.7.10.2