From a1a0d4a12a1168aeda8483ddd3acc63a7a55501d Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 26 Jun 2024 21:18:28 +0200 Subject: [PATCH] Tweak two demos --- crates/egui_demo_lib/src/demo/context_menu.rs | 2 ++ crates/egui_demo_lib/src/demo/plot_demo.rs | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/egui_demo_lib/src/demo/context_menu.rs b/crates/egui_demo_lib/src/demo/context_menu.rs index 3bba79bb..3c11da0c 100644 --- a/crates/egui_demo_lib/src/demo/context_menu.rs +++ b/crates/egui_demo_lib/src/demo/context_menu.rs @@ -156,6 +156,8 @@ impl ContextMenus { } fn nested_menus(ui: &mut egui::Ui) { + ui.set_max_width(200.0); // To make sure we wrap long text + if ui.button("Open…").clicked() { ui.close_menu(); } diff --git a/crates/egui_demo_lib/src/demo/plot_demo.rs b/crates/egui_demo_lib/src/demo/plot_demo.rs index 0b6ff45b..b58c3c40 100644 --- a/crates/egui_demo_lib/src/demo/plot_demo.rs +++ b/crates/egui_demo_lib/src/demo/plot_demo.rs @@ -74,8 +74,8 @@ impl crate::View for PlotDemo { ui.label("Zoom with ctrl + scroll."); } ui.label("Reset view with double-click."); - ui.add(crate::egui_github_link_file!()); }); + ui.add(crate::egui_github_link_file!()); }); ui.separator(); ui.horizontal(|ui| { @@ -277,7 +277,7 @@ impl LineDemo { }; let mut plot = Plot::new("lines_demo") .legend(Legend::default()) - .y_axis_width(4) + .y_axis_width(2) .show_axes(self.show_axes) .show_grid(self.show_grid); if self.square { @@ -673,7 +673,7 @@ impl LinkedAxesDemo { .data_aspect(2.0) .width(150.0) .height(250.0) - .y_axis_width(3) + .y_axis_width(2) .y_axis_label("y") .y_axis_position(egui_plot::HPlacement::Right) .link_axis(link_group_id, self.link_x, self.link_y) @@ -962,7 +962,7 @@ impl ChartsDemo { Plot::new("Normal Distribution Demo") .legend(Legend::default()) .clamp_grid(true) - .y_axis_width(3) + .y_axis_width(2) .allow_zoom(self.allow_zoom) .allow_drag(self.allow_drag) .allow_scroll(self.allow_scroll)