From 5462ea00cc77059f513a151f687b0a1a0e615619 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Sat, 25 May 2024 23:18:30 +0200 Subject: [PATCH] Fix #22102: Inverted scrollwheel behaviour on terraform tools --- src/openrct2-ui/interface/Window.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/openrct2-ui/interface/Window.cpp b/src/openrct2-ui/interface/Window.cpp index 0e14e9c306..55f81121e3 100644 --- a/src/openrct2-ui/interface/Window.cpp +++ b/src/openrct2-ui/interface/Window.cpp @@ -464,6 +464,8 @@ static bool WindowOtherWheelInput(WindowBase& w, WidgetIndex widgetIndex, int32_ } const auto entryWidgetType = w.widgets[*spinnerGroupIndex].type; + auto targetWidgetIndex = *spinnerGroupIndex; + if (entryWidgetType == WindowWidgetType::ImgBtn) { auto expectedContent1 = ImageId(SPR_LAND_TOOL_DECREASE, FilterPaletteID::PaletteNull); @@ -475,6 +477,9 @@ static bool WindowOtherWheelInput(WindowBase& w, WidgetIndex widgetIndex, int32_ { return false; } + + // Expected widget order: decrease, increase + targetWidgetIndex += wheel < 0 ? 2 : 1; } else if (entryWidgetType == WindowWidgetType::Spinner) { @@ -484,9 +489,11 @@ static bool WindowOtherWheelInput(WindowBase& w, WidgetIndex widgetIndex, int32_ { return false; } + + // Expected widget order: increase, decrease + targetWidgetIndex += wheel < 0 ? 1 : 2; } - const auto targetWidgetIndex = wheel < 0 ? *spinnerGroupIndex + 1 : *spinnerGroupIndex + 2; if (WidgetIsDisabled(w, targetWidgetIndex)) { return false;