Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slight improvements to the demo #5527

Merged
merged 12 commits into from
Dec 28, 2024
16 changes: 11 additions & 5 deletions crates/egui_demo_lib/src/demo/about.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ impl crate::Demo for About {
.default_height(480.0)
.open(open)
.resizable([true, false])
.scroll(false)
.show(ctx, |ui| {
use crate::View as _;
self.ui(ui);
Expand All @@ -36,11 +37,13 @@ impl crate::View for About {
));
ui.label("egui is designed to be easy to use, portable, and fast.");

ui.add_space(12.0); // ui.separator();
ui.add_space(12.0);

ui.heading("Immediate mode");
about_immediate_mode(ui);

ui.add_space(12.0); // ui.separator();
ui.add_space(12.0);

ui.heading("Links");
links(ui);

Expand All @@ -50,7 +53,10 @@ impl crate::View for About {
ui.spacing_mut().item_spacing.x = 0.0;
ui.label("egui development is sponsored by ");
ui.hyperlink_to("Rerun.io", "https://www.rerun.io/");
ui.label(", a startup building an SDK for visualizing streams of multimodal data.");
ui.label(", a startup building an SDK for visualizing streams of multimodal data. ");
ui.label("For an example of a real-world egui app, see ");
ui.hyperlink_to("rerun.io/viewer", "https://www.rerun.io/viewer");
ui.label(" (runs in your browser).");
});

ui.add_space(12.0);
Expand Down Expand Up @@ -94,12 +100,12 @@ fn about_immediate_mode(ui: &mut egui::Ui) {
fn links(ui: &mut egui::Ui) {
use egui::special_emojis::{GITHUB, TWITTER};
ui.hyperlink_to(
format!("{GITHUB} egui on GitHub"),
format!("{GITHUB} github.com/emilk/egui"),
"https://github.com/emilk/egui",
);
ui.hyperlink_to(
format!("{TWITTER} @ernerfeldt"),
"https://twitter.com/ernerfeldt",
);
ui.hyperlink_to("egui documentation", "https://docs.rs/egui/");
ui.hyperlink_to("📓 egui documentation", "https://docs.rs/egui/");
}
7 changes: 3 additions & 4 deletions crates/egui_demo_lib/src/demo/code_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
});

Expand Down
Loading
Loading