From 369abf3be4ba011b0ea1fb01191ebae8bde2a967 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Wed, 9 Dec 2020 21:51:28 +0100 Subject: [PATCH] Have a minimum size for scrollbars With small font sizes, the scrollbars don't need to get smaller than 14 pixels. So, don't allow the scaling to go below 1. --- src/kits/interface/ScrollBar.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/kits/interface/ScrollBar.cpp b/src/kits/interface/ScrollBar.cpp index 34a58b5aa9..7cf7a91c6f 100644 --- a/src/kits/interface/ScrollBar.cpp +++ b/src/kits/interface/ScrollBar.cpp @@ -13,6 +13,8 @@ #include +#include + #include #include #include @@ -993,7 +995,7 @@ BScrollBar::SetBorderHighlighted(bool highlight) void BScrollBar::GetPreferredSize(float* _width, float* _height) { - const float scale = be_plain_font->Size() / 12.0f; + const float scale = std::max(be_plain_font->Size() / 12.0f, 1.0f); if (fOrientation == B_VERTICAL) { if (_width) *_width = B_V_SCROLL_BAR_WIDTH * scale;