From 4257ca16d634173dff43ea2be7ba5c1b37159fbc Mon Sep 17 00:00:00 2001 From: Karl von Randow Date: Thu, 12 Mar 2026 20:57:48 +1300 Subject: [PATCH] fix: quadratic scroll speed in smooth scrolling causes enormous jumps The smooth scrolling path in getUnitsToScroll() used e.getUnitsToScroll() (which is scrollAmount * wheelRotation) multiplied by e.getPreciseWheelRotation() (which is ~wheelRotation). This squares the wheel rotation, causing scroll distance to grow quadratically with scroll speed rather than linearly. Fix: use e.getScrollAmount() (the per-notch amount, typically 3) instead of e.getUnitsToScroll() so the rotation is only applied once via getPreciseWheelRotation(). --- src/org/violetlib/aqua/AquaScrollPaneUI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/violetlib/aqua/AquaScrollPaneUI.java b/src/org/violetlib/aqua/AquaScrollPaneUI.java index 1cb0148..527e5bc 100644 --- a/src/org/violetlib/aqua/AquaScrollPaneUI.java +++ b/src/org/violetlib/aqua/AquaScrollPaneUI.java @@ -909,6 +909,6 @@ protected int getSmoothScrollingIncrement(@NotNull Component c, int orientation) } public static double getUnitsToScroll(@NotNull MouseWheelEvent e, boolean isSmooth) { - return isSmooth ? e.getUnitsToScroll() * e.getPreciseWheelRotation() : e.getUnitsToScroll(); + return isSmooth ? e.getScrollAmount() * e.getPreciseWheelRotation() : e.getUnitsToScroll(); } }