Browse Source

ScrollBar: Increase size of minimized scrollbar

The minimized scrollbar should still indicate that it exists.
spotless
Jannis Weis 3 years ago
parent
commit
c692eebf25
No known key found for this signature in database
GPG Key ID: 7C9D8D4B558049AB
  1. 11
      core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/DarkRoundedScrollBarUI.java
  2. 1
      core/src/main/resources/com/github/weisj/darklaf/platform/mac.properties
  3. 1
      core/src/main/resources/com/github/weisj/darklaf/platform/windows11.properties

11
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 { public abstract class DarkRoundedScrollBarUI extends DarkScrollBarUI {
protected boolean hideScrollBar = false; protected boolean hideScrollBar = false;
private int minimumSize;
@Override
protected void installDefaults() {
super.installDefaults();
minimumSize = UIManager.getInt("ScrollBar.minimumWidth");
}
protected abstract int getTrackFadeOutDelay(); protected abstract int getTrackFadeOutDelay();
@ -53,11 +60,11 @@ public abstract class DarkRoundedScrollBarUI extends DarkScrollBarUI {
if (hideScrollBar) { if (hideScrollBar) {
float animationState = scrollBarListener.getTrackState(); float animationState = scrollBarListener.getTrackState();
if (horizontal) { if (horizontal) {
int newHeight = Math.round(height * animationState); int newHeight = Math.round(minimumSize + (height - minimumSize) * animationState);
y += height - newHeight; y += height - newHeight;
height = newHeight; height = newHeight;
} else { } else {
int newWidth = Math.round(width * animationState); int newWidth = Math.round(minimumSize + (width - minimumSize) * animationState);
if (scrollbar.getComponentOrientation().isLeftToRight()) { if (scrollbar.getComponentOrientation().isLeftToRight()) {
x += width - newWidth; x += width - newWidth;
} }

1
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 ScrollBarUI = com.github.weisj.darklaf.ui.scrollpane.DarkMacScrollBarUI
ScrollBar.smallWidth = 10 ScrollBar.smallWidth = 10
ScrollBar.width = 12 ScrollBar.width = 12
ScrollBar.minimumWidth = 3
ScrollBar.macos.hideScrollBar = false ScrollBar.macos.hideScrollBar = false
ScrollBar.macos.hideDelay = 1200 ScrollBar.macos.hideDelay = 1200

1
core/src/main/resources/com/github/weisj/darklaf/platform/windows11.properties

@ -27,5 +27,6 @@
ScrollBarUI = com.github.weisj.darklaf.ui.scrollpane.DarkWindows11ScrollBarUI ScrollBarUI = com.github.weisj.darklaf.ui.scrollpane.DarkWindows11ScrollBarUI
ScrollBar.smallWidth = 10 ScrollBar.smallWidth = 10
ScrollBar.width = 12 ScrollBar.width = 12
ScrollBar.minimumWidth = 3
ScrollBar.windows11.hideScrollBar = false ScrollBar.windows11.hideScrollBar = false
ScrollBar.windows11.hideDelay = 1200 ScrollBar.windows11.hideDelay = 1200

Loading…
Cancel
Save