Skip to content

Commit

Permalink
fix(ui): scroll to focused button in map select (#1042)
Browse files Browse the repository at this point in the history
Fixes #976.
  • Loading branch information
nelson137 authored Nov 10, 2024
1 parent d83a8d3 commit a0c80df
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/ui/map_select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ pub fn map_select_menu(
.show(ui)
.focus_by_default(ui);

if all_maps_button.has_focus() {
all_maps_button.scroll_to_me(None);
}

if all_maps_button.clicked() {
// TODO: Currently does not include packs, only stable maps.
let mut map_pool =
Expand All @@ -98,6 +102,10 @@ pub fn map_select_menu(
)
.show(ui);

if button.has_focus() {
button.scroll_to_me(None);
}

if button.clicked() {
return MapSelectAction::SelectMap(
MapPool::from_single_map(*handle),
Expand All @@ -116,6 +124,10 @@ pub fn map_select_menu(
)
.show(ui);

if button.has_focus() {
button.scroll_to_me(None);
}

if button.clicked() {
return MapSelectAction::SelectMap(
MapPool::from_single_map(*map),
Expand Down

0 comments on commit a0c80df

Please sign in to comment.