mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-04 10:02:44 +00:00
fix scrolling through the player list in the mp lobby:
...trying to preserve the selected player the viewport of the list would always be reset to show the selected player
This commit is contained in:
parent
1d9114e198
commit
c647a5b48c
@ -730,8 +730,7 @@ void ui::set_user_menu_items(const std::vector<std::string>& list)
|
||||
std::vector<std::string>::const_iterator i =
|
||||
std::find(user_list_.begin(), user_list_.end(), selected_user_);
|
||||
if(i != user_list_.end()) {
|
||||
users_menu_.reset_selection();
|
||||
users_menu_.move_selection(i - user_list_.begin());
|
||||
users_menu_.move_selection_keeping_viewport(i - user_list_.begin());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -517,6 +517,14 @@ void menu::move_selection(size_t id)
|
||||
}
|
||||
}
|
||||
|
||||
// public function
|
||||
void menu::move_selection_keeping_viewport(size_t id)
|
||||
{
|
||||
if(id < item_pos_.size()) {
|
||||
set_selection_pos(item_pos_[id], true, NO_MOVE_VIEWPORT);
|
||||
}
|
||||
}
|
||||
|
||||
void menu::reset_selection()
|
||||
{
|
||||
set_selection_pos(0);
|
||||
|
@ -160,6 +160,7 @@ public:
|
||||
int selection() const;
|
||||
|
||||
void move_selection(size_t id);
|
||||
void move_selection_keeping_viewport(size_t id);
|
||||
void reset_selection();
|
||||
|
||||
// allows user to change_item while running (dangerous)
|
||||
|
Loading…
x
Reference in New Issue
Block a user