From 924f7ec6c3ce2cb1db180bae81baf2f94a0df095 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Sun, 11 Aug 2024 10:56:39 +0200 Subject: [PATCH] Fix scenery window scrollbar disappearing --- src/openrct2-ui/interface/Widget.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/openrct2-ui/interface/Widget.cpp b/src/openrct2-ui/interface/Widget.cpp index 9940dbf97e..6b8f7a8b2c 100644 --- a/src/openrct2-ui/interface/Widget.cpp +++ b/src/openrct2-ui/interface/Widget.cpp @@ -682,9 +682,8 @@ 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); + bool hScrollNeeded = scroll.h_right > widget.width() && (scroll.flags & HSCROLLBAR_VISIBLE); + bool vScrollNeeded = scroll.v_bottom > widget.height() && (scroll.flags & VSCROLLBAR_VISIBLE); // Horizontal scrollbar if (hScrollNeeded) @@ -948,7 +947,8 @@ namespace OpenRCT2::Ui } const auto& scroll = w.scrolls[*scroll_id]; - if ((scroll.flags & HSCROLLBAR_VISIBLE) && screenCoords.y >= (w.windowPos.y + widget->bottom - (kScrollBarWidth + 1))) + if ((scroll.flags & HSCROLLBAR_VISIBLE) && scroll.h_right > widget->width() + && screenCoords.y >= (w.windowPos.y + widget->bottom - (kScrollBarWidth + 1))) { // horizontal scrollbar int32_t rightOffset = 0; @@ -985,7 +985,8 @@ namespace OpenRCT2::Ui } } else if ( - (scroll.flags & VSCROLLBAR_VISIBLE) && (screenCoords.x >= w.windowPos.x + widget->right - (kScrollBarWidth + 1))) + (scroll.flags & VSCROLLBAR_VISIBLE) && scroll.v_bottom > widget->height() + && (screenCoords.x >= w.windowPos.x + widget->right - (kScrollBarWidth + 1))) { // vertical scrollbar int32_t bottomOffset = 0;