From 240abccc580205a983a54428bc18650b1cc9a488 Mon Sep 17 00:00:00 2001 From: aprzn Date: Sat, 4 Feb 2023 21:35:07 -0500 Subject: [PATCH] make level list scrollable --- src/main.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2b733bf..fff6bd5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,14 +46,17 @@ impl eframe::App for PipeDash { ctx.set_pixels_per_point(2f32); egui::SidePanel::left("level_picker").default_width(100f32).show(ctx, |ui| { - ui.with_layout(egui::Layout::top_down_justified(egui::Align::Min), |ui| { - for (idx, level) in self.level_list.iter().enumerate() { - if ui.selectable_label(self.selected_level == Some(idx), level.display_name()).clicked() { - self.msg_queue.push_back(LevelSelected(idx)); + egui::ScrollArea::vertical().show(ui, |ui| { + ui.with_layout(egui::Layout::top_down_justified(egui::Align::Min), |ui| { + for (idx, level) in self.level_list.iter().enumerate() { + 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| { ui.vertical_centered_justified(|ui| { ui.horizontal_top(|ui| {