1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Slight improvements to the demo (#5527)

This commit is contained in:
Emil Ernerfeldt
2024-12-28 22:11:41 +01:00
committed by GitHub
parent 820d42802a
commit fa95351675
5 changed files with 207 additions and 198 deletions

View File

@@ -84,9 +84,8 @@ impl CodeExample {
ui.horizontal(|ui| {
let font_id = egui::TextStyle::Monospace.resolve(ui.style());
let indentation = 8.0 * ui.fonts(|f| f.glyph_width(&font_id, ' '));
let item_spacing = ui.spacing_mut().item_spacing;
ui.add_space(indentation - item_spacing.x);
let indentation = 2.0 * 4.0 * ui.fonts(|f| f.glyph_width(&font_id, ' '));
ui.add_space(indentation);
egui::Grid::new("code_samples")
.striped(true)
@@ -120,7 +119,7 @@ impl crate::Demo for CodeExample {
impl crate::View for CodeExample {
fn ui(&mut self, ui: &mut egui::Ui) {
ui.scope(|ui| {
ui.spacing_mut().item_spacing = egui::vec2(8.0, 8.0);
ui.spacing_mut().item_spacing = egui::vec2(8.0, 6.0);
self.code(ui);
});