Skip to content

Commit a0c80df

Browse files
authored
fix(ui): scroll to focused button in map select (#1042)
Fixes #976.
1 parent d83a8d3 commit a0c80df

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/ui/map_select.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ pub fn map_select_menu(
8181
.show(ui)
8282
.focus_by_default(ui);
8383

84+
if all_maps_button.has_focus() {
85+
all_maps_button.scroll_to_me(None);
86+
}
87+
8488
if all_maps_button.clicked() {
8589
// TODO: Currently does not include packs, only stable maps.
8690
let mut map_pool =
@@ -98,6 +102,10 @@ pub fn map_select_menu(
98102
)
99103
.show(ui);
100104

105+
if button.has_focus() {
106+
button.scroll_to_me(None);
107+
}
108+
101109
if button.clicked() {
102110
return MapSelectAction::SelectMap(
103111
MapPool::from_single_map(*handle),
@@ -116,6 +124,10 @@ pub fn map_select_menu(
116124
)
117125
.show(ui);
118126

127+
if button.has_focus() {
128+
button.scroll_to_me(None);
129+
}
130+
119131
if button.clicked() {
120132
return MapSelectAction::SelectMap(
121133
MapPool::from_single_map(*map),

0 commit comments

Comments
 (0)