mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-20 21:43:06 +01:00
Hide scrollbars when there is nothing to scroll
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
- Feature: [#22414] Finance graphs can be resized.
|
||||
- Change: [#21659] Increase the Hybrid Roller Coaster’s maximum lift speed to 17 km/h (11 mph).
|
||||
- Change: [#22466] The Clear Scenery tool now uses a bulldozer cursor instead of a generic crosshair.
|
||||
- Change: [#22491] Scrollbars are now hidden if the scrollable widget is not actually overflowing.
|
||||
- Fix: [#21908] Errors showing up when placing/moving track design previews.
|
||||
- Fix: [#22307] Hover tooltips in financial charts are not invalidated properly.
|
||||
- Fix: [#22395, #22396] Misaligned tick marks in financial and guest count graphs (original bug).
|
||||
|
||||
@@ -682,23 +682,31 @@ namespace OpenRCT2::Ui
|
||||
bottomRight.x--;
|
||||
bottomRight.y--;
|
||||
|
||||
auto scrollSize = w.OnScrollGetSize(widgetIndex);
|
||||
bool hScrollNeeded = scrollSize.width > widget.width() && (scroll.flags & HSCROLLBAR_VISIBLE);
|
||||
bool vScrollNeeded = scrollSize.height > widget.height() && (scroll.flags & VSCROLLBAR_VISIBLE);
|
||||
|
||||
// Horizontal scrollbar
|
||||
if (scroll.flags & HSCROLLBAR_VISIBLE)
|
||||
if (hScrollNeeded)
|
||||
{
|
||||
WidgetHScrollbarDraw(
|
||||
dpi, scroll, topLeft.x, bottomRight.y - kScrollBarWidth,
|
||||
((scroll.flags & VSCROLLBAR_VISIBLE) ? bottomRight.x - (kScrollBarWidth + 1) : bottomRight.x), bottomRight.y,
|
||||
colour);
|
||||
}
|
||||
|
||||
// Vertical scrollbar
|
||||
if (scroll.flags & VSCROLLBAR_VISIBLE)
|
||||
if (vScrollNeeded)
|
||||
{
|
||||
WidgetVScrollbarDraw(
|
||||
dpi, scroll, bottomRight.x - kScrollBarWidth, topLeft.y, bottomRight.x,
|
||||
((scroll.flags & HSCROLLBAR_VISIBLE) ? bottomRight.y - (kScrollBarWidth + 1) : bottomRight.y), colour);
|
||||
}
|
||||
|
||||
// Contents
|
||||
if (scroll.flags & HSCROLLBAR_VISIBLE)
|
||||
if (hScrollNeeded)
|
||||
bottomRight.y -= (kScrollBarWidth + 1);
|
||||
if (scroll.flags & VSCROLLBAR_VISIBLE)
|
||||
if (vScrollNeeded)
|
||||
bottomRight.x -= (kScrollBarWidth + 1);
|
||||
|
||||
bottomRight.y++;
|
||||
|
||||
Reference in New Issue
Block a user