From b82dd5d0c24d7e3e83cd6c06cf50c4fa25d77ad1 Mon Sep 17 00:00:00 2001 From: Sergii Pylypenko Date: Wed, 17 Jul 2019 23:35:26 +0300 Subject: [PATCH] Do not open dropdown menu scrolled to the bottom --- src/widgets/dropdown.cpp | 3 ++- todo.txt | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index 3646d18a27..4cd5c4f0d3 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -149,6 +149,7 @@ struct DropdownWindow : Window { /* Capacity is the average number of items visible */ this->vscroll->SetCapacity(size.height * (uint16)list->Length() / list_height); this->vscroll->SetCount((uint16)list->Length()); + this->vscroll->SetPosition(Clamp(selected, 0, list->Length())); this->parent_wnd_class = parent->window_class; this->parent_wnd_num = parent->window_number; @@ -427,7 +428,7 @@ void ShowDropDownListAt(Window *w, const DropDownList *list, int selected, int b /* 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); + //if (above && scroll) dropdown->vscroll->UpdatePosition(INT_MAX); } /** diff --git a/todo.txt b/todo.txt index a1d6e8127f..949fc6198e 100644 --- a/todo.txt +++ b/todo.txt @@ -11,7 +11,5 @@ - Select native screen width x 480 resolution on first run. -- Scrollable lists open scrolled to bottom. - - Two-finger scroll when building road is broken.