Tweak demo to work better on small screens (phones)

This commit is contained in:
Emil Ernerfeldt 2020-12-16 21:57:13 +01:00
parent 8af83bf93f
commit 56502405f5
4 changed files with 30 additions and 30 deletions

View file

@ -105,31 +105,37 @@ impl DemoWindows {
self.previous_link = env.link;
}
crate::SidePanel::left("side_panel", 200.0).show(ctx, |ui| {
crate::SidePanel::left("side_panel", 190.0).show(ctx, |ui| {
ui.heading("✒ Egui Demo");
crate::demos::warn_if_debug_build(ui);
ui.separator();
ScrollArea::auto_sized().show(ui, |ui| {
ui.label("Egui is an immediate mode GUI library written in Rust.");
ui.add(crate::Hyperlink::new("https://github.com/emilk/egui").text(" Egui home page"));
ui.add(
crate::Hyperlink::new("https://github.com/emilk/egui").text(" Egui home page"),
);
ui.label("Egui can be run on the web, or natively on 🐧");
ui.separator();
ui.label(
"This is an example of a panel. Windows are constrained to the area that remain.",
);
if ui.button("Organize windows").clicked {
ui.ctx().memory().reset_areas();
}
ui.separator();
ui.heading(" Windows:");
ui.heading("Windows:");
ui.indent("windows", |ui| {
self.open_windows.checkboxes(ui);
self.demos.checkboxes(ui);
});
ui.separator();
if ui.button("Organize windows").clicked {
ui.ctx().memory().reset_areas();
}
sidebar_ui(ui);
});
});
crate::TopPanel::top("menu_bar").show(ctx, |ui| {
show_menu_bar(ui, &mut self.open_windows, env.seconds_since_midnight);
@ -330,18 +336,13 @@ fn show_menu_bar(ui: &mut Ui, windows: &mut OpenWindows, seconds_since_midnight:
ui.ctx().memory().reset_areas();
}
if ui
.button("Clear entire Egui memory")
.button("Clear Egui memory")
.on_hover_text("Forget scroll, collapsing headers etc")
.clicked
{
*ui.ctx().memory() = Default::default();
}
});
menu::menu(ui, "Windows", |ui| windows.checkboxes(ui));
menu::menu(ui, "About", |ui| {
ui.label("This is Egui");
ui.add(Hyperlink::new("https://github.com/emilk/egui").text(" Egui home page"));
});
if let Some(time) = seconds_since_midnight {
let time = format!(

View file

@ -13,7 +13,7 @@ impl Default for FontBook {
standard: false,
emojis: true,
filter: Default::default(),
text_style: TextStyle::Heading,
text_style: TextStyle::Button,
}
}
}
@ -66,10 +66,9 @@ impl demos::View for FontBook {
ui.separator();
ui.horizontal(|ui| {
ui.label("Text style:");
combo_box_with_label(ui, "Text style", format!("{:?}", self.text_style), |ui| {
for style in TextStyle::all() {
ui.radio_value(&mut self.text_style, style, format!("{:?}", style));
ui.selectable_value(&mut self.text_style, style, format!("{:?}", style));
}
});

View file

@ -52,7 +52,7 @@ pub fn warn_if_debug_build(ui: &mut crate::Ui) {
.small()
.text_color(crate::color::RED),
)
.on_hover_text("Egui has detect that debug assertions are enabled.");
.on_hover_text("Egui was compiled with debug assertions enabled.");
}
}

View file

@ -35,7 +35,7 @@ impl Default for Widgets {
radio: Enum::First,
count: 0,
sliders: Default::default(),
angle: TAU / 8.0,
angle: TAU / 3.0,
color: (Rgba::new(0.0, 1.0, 0.5, 1.0) * 0.75).into(),
single_line_text_input: "Hello World!".to_owned(),
multiline_text_input: "Text can both be so wide that it needs a line break, but you can also add manual line break by pressing enter, creating new paragraphs.\nThis is the start of the next paragraph.\n\nClick me to edit me!".to_owned(),