summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJ0an Josep <juanjo.ng.83@gmail.com>2019-01-13 02:45:47 +0100
committerPeterN <peter@fuzzle.org>2019-01-20 21:43:00 +0000
commit628af2fabcc634d6e10c50147eaf8a18e873a8b2 (patch)
treea94038455db5e55f86167109d31a285819147a7d /src
parent226dbcb422fb7338b228cbf29c22d14964256e6e (diff)
downloadopenttd-628af2fabcc634d6e10c50147eaf8a18e873a8b2.tar.xz
Fix #6060: When opening a scrollable dropdown above a widget, scroll it to its very bottom.
This "prevents" the fast movement towards the bottom when holding down the mouse button.
Diffstat (limited to 'src')
-rw-r--r--src/widgets/dropdown.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp
index 5dae69b9c..61656c020 100644
--- a/src/widgets/dropdown.cpp
+++ b/src/widgets/dropdown.cpp
@@ -407,7 +407,12 @@ void ShowDropDownListAt(Window *w, const DropDownList *list, int selected, int b
Point dw_pos = { w->left + (_current_text_dir == TD_RTL ? wi_rect.right + 1 - (int)width : wi_rect.left), top};
Dimension dw_size = {width, height};
- new DropdownWindow(w, list, selected, button, instant_close, dw_pos, dw_size, wi_colour, scroll);
+ DropdownWindow *dropdown = new DropdownWindow(w, list, selected, button, instant_close, dw_pos, dw_size, wi_colour, scroll);
+
+ /* The dropdown starts scrolling downwards when opening it towards
+ * the top and holding down the mouse button. It can be fooled by
+ * opening the dropdown scrolled to the very bottom. */
+ if (above && scroll) dropdown->vscroll->UpdatePosition(INT_MAX);
}
/**