From c692eebf255c807ad6e02509ac4abdbc8e2f9076 Mon Sep 17 00:00:00 2001 From: Jannis Weis <31143295+weisJ@users.noreply.github.com> Date: Tue, 28 Dec 2021 15:37:41 +0100 Subject: [PATCH] ScrollBar: Increase size of minimized scrollbar The minimized scrollbar should still indicate that it exists. --- .../darklaf/ui/scrollpane/DarkRoundedScrollBarUI.java | 11 +++++++++-- .../com/github/weisj/darklaf/platform/mac.properties | 1 + .../weisj/darklaf/platform/windows11.properties | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/DarkRoundedScrollBarUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/DarkRoundedScrollBarUI.java index 6e7317b3..bf8354e0 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/DarkRoundedScrollBarUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/DarkRoundedScrollBarUI.java @@ -33,6 +33,13 @@ import com.github.weisj.darklaf.util.graphics.GraphicsUtil; public abstract class DarkRoundedScrollBarUI extends DarkScrollBarUI { protected boolean hideScrollBar = false; + private int minimumSize; + + @Override + protected void installDefaults() { + super.installDefaults(); + minimumSize = UIManager.getInt("ScrollBar.minimumWidth"); + } protected abstract int getTrackFadeOutDelay(); @@ -53,11 +60,11 @@ public abstract class DarkRoundedScrollBarUI extends DarkScrollBarUI { if (hideScrollBar) { float animationState = scrollBarListener.getTrackState(); if (horizontal) { - int newHeight = Math.round(height * animationState); + int newHeight = Math.round(minimumSize + (height - minimumSize) * animationState); y += height - newHeight; height = newHeight; } else { - int newWidth = Math.round(width * animationState); + int newWidth = Math.round(minimumSize + (width - minimumSize) * animationState); if (scrollbar.getComponentOrientation().isLeftToRight()) { x += width - newWidth; } diff --git a/core/src/main/resources/com/github/weisj/darklaf/platform/mac.properties b/core/src/main/resources/com/github/weisj/darklaf/platform/mac.properties index ec9d39e0..0744f837 100644 --- a/core/src/main/resources/com/github/weisj/darklaf/platform/mac.properties +++ b/core/src/main/resources/com/github/weisj/darklaf/platform/mac.properties @@ -28,6 +28,7 @@ macos.coloredTitleBar = true ScrollBarUI = com.github.weisj.darklaf.ui.scrollpane.DarkMacScrollBarUI ScrollBar.smallWidth = 10 ScrollBar.width = 12 +ScrollBar.minimumWidth = 3 ScrollBar.macos.hideScrollBar = false ScrollBar.macos.hideDelay = 1200 diff --git a/core/src/main/resources/com/github/weisj/darklaf/platform/windows11.properties b/core/src/main/resources/com/github/weisj/darklaf/platform/windows11.properties index 58d459b1..60ad2ae0 100644 --- a/core/src/main/resources/com/github/weisj/darklaf/platform/windows11.properties +++ b/core/src/main/resources/com/github/weisj/darklaf/platform/windows11.properties @@ -27,5 +27,6 @@ ScrollBarUI = com.github.weisj.darklaf.ui.scrollpane.DarkWindows11ScrollBarUI ScrollBar.smallWidth = 10 ScrollBar.width = 12 +ScrollBar.minimumWidth = 3 ScrollBar.windows11.hideScrollBar = false ScrollBar.windows11.hideDelay = 1200