Skip to content

Commit

Permalink
fix(ui): scroll to focused button in map select
Browse files Browse the repository at this point in the history
  • Loading branch information
nelson137 committed Nov 8, 2024
1 parent 276af5a commit 5e8854c
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 5e8854c

Please sign in to comment.