MCPcopy Create free account
hub / github.com/emilk/egui_plot / thumbnails_panel

Method thumbnails_panel

demo/src/app.rs:83–112  ·  view source on GitHub ↗
(&mut self, ui: &mut egui::Ui, default_width: f32)

Source from the content-addressed store, hash-verified

81 }
82
83 fn thumbnails_panel(&mut self, ui: &mut egui::Ui, default_width: f32) {
84 egui::Panel::left("examples_panel")
85 .default_size(default_width)
86 // Set min_size so the heading is well rendered.
87 .min_size(100.0)
88 // 3 columns + some space extra for buttons.
89 // TODO(#193): get rid of "extra space" calc.
90 .max_size(Self::COL_WIDTH * 3. + 30.)
91 .resizable(true)
92 .show(ui, |ui| {
93 ScrollArea::vertical().show(ui, |ui| {
94 let available_width = ui.available_width();
95 let num_columns = 1.max((available_width / Self::COL_WIDTH).floor() as usize);
96 let scale = 1.0_f32.min(available_width / (Self::COL_WIDTH * num_columns as f32));
97
98 ui.heading("Examples");
99 ui.separator();
100
101 let num_examples = self.examples.len();
102 egui::Grid::new("examples_grid").show(ui, |ui| {
103 for index in 0..num_examples {
104 self.make_cell(index, ui, scale);
105 if (index + 1) % num_columns == 0 {
106 ui.end_row();
107 }
108 }
109 });
110 });
111 });
112 }
113
114 fn info_panel(&mut self, ui: &mut egui::Ui, index: usize) {
115 egui::Panel::right("info_panel")

Callers 1

uiMethod · 0.80

Calls 5

showMethod · 0.80
min_sizeMethod · 0.80
maxMethod · 0.80
minMethod · 0.80
make_cellMethod · 0.80

Tested by

no test coverage detected