Give the User Guide real breathing room between paragraphs
Every paragraph, note and entry was a separate label stacked with only egui's default item spacing between them, so sections didn't read as clear breaks. Scope a larger item_spacing to the User Guide's own Ui (not the shared section/note/body helpers) so the Markdown Cheatsheet, which uses the same helpers, is unaffected. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+11
-4
@@ -27,14 +27,20 @@ pub fn user_guide_window(ctx: &egui::Context, open: &mut bool) {
|
||||
egui::Window::new("📖 User Guide")
|
||||
.open(open)
|
||||
.resizable(true)
|
||||
.default_width(640.0)
|
||||
.default_height(620.0)
|
||||
.default_width(720.0)
|
||||
.default_height(680.0)
|
||||
.show(ctx, |ui| {
|
||||
egui::ScrollArea::vertical().show(ui, user_guide_body);
|
||||
});
|
||||
}
|
||||
|
||||
fn user_guide_body(ui: &mut egui::Ui) {
|
||||
// More breathing room than egui's default item spacing — scoped to this
|
||||
// `Ui` (and so inherited by every child it lays out below), not to the
|
||||
// shared `section`/`note`/`body`/`entries` helpers themselves, so the
|
||||
// Markdown Cheatsheet's own window is unaffected.
|
||||
ui.spacing_mut().item_spacing.y = 12.0;
|
||||
|
||||
intro(
|
||||
ui,
|
||||
"What every window, menu item and setting does. For markdown and \
|
||||
@@ -604,7 +610,9 @@ fn syntax(ui: &mut egui::Ui, id: &str, rows: &[(&str, &str)]) {
|
||||
/// rather than side by side — for descriptions too long to sit in
|
||||
/// `syntax`'s two-column grid without either overflowing or forcing the
|
||||
/// whole window wider to avoid wrapping, since a `Grid` sizes each column to
|
||||
/// its widest cell instead of wrapping.
|
||||
/// its widest cell instead of wrapping. Relies on the caller's own
|
||||
/// `item_spacing` for the gap between rows, rather than hand-adding one here
|
||||
/// on top of it.
|
||||
fn entries(ui: &mut egui::Ui, rows: &[(&str, &str)]) {
|
||||
for (label, desc) in rows {
|
||||
ui.label(
|
||||
@@ -613,6 +621,5 @@ fn entries(ui: &mut egui::Ui, rows: &[(&str, &str)]) {
|
||||
.color(egui::Color32::from_rgb(120, 170, 120)),
|
||||
);
|
||||
ui.label(*desc);
|
||||
ui.add_space(6.0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user