make level list scrollable

main
aprzn 2 years ago
parent c452ca6f17
commit 240abccc58

@ -46,14 +46,17 @@ impl eframe::App for PipeDash {
ctx.set_pixels_per_point(2f32); ctx.set_pixels_per_point(2f32);
egui::SidePanel::left("level_picker").default_width(100f32).show(ctx, |ui| { egui::SidePanel::left("level_picker").default_width(100f32).show(ctx, |ui| {
ui.with_layout(egui::Layout::top_down_justified(egui::Align::Min), |ui| { egui::ScrollArea::vertical().show(ui, |ui| {
for (idx, level) in self.level_list.iter().enumerate() { ui.with_layout(egui::Layout::top_down_justified(egui::Align::Min), |ui| {
if ui.selectable_label(self.selected_level == Some(idx), level.display_name()).clicked() { for (idx, level) in self.level_list.iter().enumerate() {
self.msg_queue.push_back(LevelSelected(idx)); if ui.selectable_label(self.selected_level == Some(idx), level.display_name()).clicked() {
self.msg_queue.push_back(LevelSelected(idx));
}
} }
} })
}) });
}); });
egui::CentralPanel::default().show(ctx, |ui| { egui::CentralPanel::default().show(ctx, |ui| {
ui.vertical_centered_justified(|ui| { ui.vertical_centered_justified(|ui| {
ui.horizontal_top(|ui| { ui.horizontal_top(|ui| {

Loading…
Cancel
Save