Skip to content

Commit

Permalink
Fix OpenTTD#6060: When opening a scrollable dropdown above a widget, …
Browse files Browse the repository at this point in the history
…scroll it to its very bottom.

This "prevents" the fast movement towards the bottom when holding down the mouse button.
  • Loading branch information
J0anJosep committed Jan 14, 2019
1 parent d93e9d6 commit 415bec6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/widgets/dropdown.cpp
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit 415bec6

Please sign in to comment.