From: Ben Soares Date: Wed, 31 Jan 2024 16:08:54 +0000 (+0000) Subject: JAL-4375 Different way of getting mouse wheel movement for cross-platform (testing... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=60cc481239cf33d711931d489a215185474e69a1;p=jalview.git JAL-4375 Different way of getting mouse wheel movement for cross-platform (testing on macos and linux) sensitivity --- diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 2634b7a..ff69d61 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -2235,12 +2235,17 @@ public class SeqPanel extends JPanel public void mouseWheelMoved(MouseWheelEvent e) { e.consume(); - double wheelRotation = e.getPreciseWheelRotation(); + double preciseWheelRotation = e.getPreciseWheelRotation(); + int wheelRotation = e.getWheelRotation(); + if (wheelRotation == 0 && Math.abs(preciseWheelRotation) > 0.1) + { + wheelRotation = 1; + } /* * scroll more for large (fast) mouse movements */ - int size = 1 + (int) Math.abs(wheelRotation); + int size = Math.abs(wheelRotation); if (wheelRotation > 0) { @@ -2253,7 +2258,7 @@ public class SeqPanel extends JPanel */ if (!ap.isScrolledFullyRight()) { - av.getRanges().scrollRight(true, size - 1); + av.getRanges().scrollRight(true, size); } } else @@ -2277,7 +2282,7 @@ public class SeqPanel extends JPanel /* * scroll left */ - av.getRanges().scrollRight(false, size - 1); + av.getRanges().scrollRight(false, size); } else {