demo tweaks

This commit is contained in:
Emil Ernerfeldt 2021-01-02 12:00:14 +01:00
parent 4e3251c300
commit 1690db0f0c
3 changed files with 20 additions and 13 deletions

View file

@ -129,6 +129,10 @@ impl AllocInfo {
)
}
}
pub fn label(&self, ui: &mut crate::Ui, what: &str) -> crate::Response {
ui.add(crate::Label::new(self.format(what)).multiline(false))
}
}
#[derive(Clone, Copy, Default)]
@ -226,19 +230,21 @@ impl PaintStats {
} = self;
ui.label("Intermediate:");
ui.label(primitives.format("primitives"))
primitives
.label(ui, "primitives")
.on_hover_text("Boxes, circles, etc");
ui.label(cmd_text.format("text"));
ui.label(cmd_path.format("paths"));
ui.label(cmd_mesh.format("meshes"));
ui.label(cmd_vec.format("nested"));
cmd_text.label(ui, "text");
cmd_path.label(ui, "paths");
cmd_mesh.label(ui, "meshes");
cmd_vec.label(ui, "nested");
ui.advance_cursor(10.0);
ui.label("Tessellated:");
ui.label(jobs.format("jobs"))
jobs.label(ui, "jobs")
.on_hover_text("Number of separate clip rectangles");
ui.label(vertices.format("vertices"));
ui.label(indices.format("indices"))
vertices.label(ui, "vertices");
indices
.label(ui, "indices")
.on_hover_text("Three 32-bit indices per triangles");
ui.advance_cursor(10.0);

View file

@ -108,6 +108,7 @@ impl DemoWindows {
Window::new("🔧 Settings")
.open(&mut open_windows.settings)
.scroll(true)
.show(ctx, |ui| {
ctx.settings_ui(ui);
});

View file

@ -92,7 +92,7 @@ impl epi::App for WrapApp {
self.backend_panel.update(ctx, frame);
if self.backend_panel.open {
egui::SidePanel::left("backend_panel", 0.0).show(ctx, |ui| {
egui::SidePanel::left("backend_panel", 150.0).show(ctx, |ui| {
self.backend_panel.ui(ui, frame);
});
}
@ -190,9 +190,9 @@ impl BackendPanel {
}
fn ui(&mut self, ui: &mut egui::Ui, frame: &mut epi::Frame<'_>) {
let is_web = frame.is_web();
ui.heading("💻 Backend");
if is_web {
if frame.is_web() {
ui.label("Egui is an immediate mode GUI written in Rust, compiled to WebAssembly, rendered with WebGL.");
ui.label(
"Everything you see is rendered as textured triangles. There is no DOM. There are no HTML elements. \
@ -211,7 +211,7 @@ impl BackendPanel {
self.frame_history.ui(ui);
if !is_web {
if !frame.is_web() {
// web browsers have their own way of zooming, which egui_web respects
ui.separator();
if let Some(new_pixels_per_point) = self.pixels_per_point_ui(ui, frame.info()) {
@ -219,7 +219,7 @@ impl BackendPanel {
}
}
if !is_web {
if !frame.is_web() {
ui.separator();
if ui
.button("📱 Phone Size")