From b304d46f7eb1796b7d2a2646ff4485257d8d0cde Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Fri, 11 Oct 2024 19:18:00 +0200 Subject: [PATCH] TextComponents: fixed too fast scrolling in multi-line text components when using touchpads (e.g. on macOS) (issue #892) --- CHANGELOG.md | 2 ++ .../src/main/java/com/formdev/flatlaf/ui/FlatScrollPaneUI.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b3c9cb7..45facd83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ FlatLaf Change Log using custom component that overrides `Component.contains(int x, int y)` and invokes `SwingUtilities.convertPoint()` (or similar) from the overridden method. (issue #878) +- TextComponents: Fixed too fast scrolling in multi-line text components when + using touchpads (e.g. on macOS). (issue #892) - ToolBar: Fixed endless loop if button in Toolbar has focus and is made invisible. (issue #884) diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatScrollPaneUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatScrollPaneUI.java index d851b23b..142f222e 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatScrollPaneUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatScrollPaneUI.java @@ -210,7 +210,7 @@ public class FlatScrollPaneUI // Use (0, 0) view position to obtain a constant unit increment of first item. // Unit increment may be different for each item. - Rectangle visibleRect = new Rectangle( viewport.getViewSize() ); + Rectangle visibleRect = new Rectangle( viewport.getExtentSize() ); unitIncrement = scrollable.getScrollableUnitIncrement( visibleRect, orientation, 1 ); if( unitIncrement > 0 ) {