From fa5cb22da8be031f601e5374d9e5e45daa851053 Mon Sep 17 00:00:00 2001 From: jprochazk <1665677+jprochazk@users.noreply.github.com> Date: Tue, 12 Sep 2023 09:32:00 +0200 Subject: [PATCH] add explanations to image viewer ui --- crates/egui_demo_app/src/apps/image_viewer.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/crates/egui_demo_app/src/apps/image_viewer.rs b/crates/egui_demo_app/src/apps/image_viewer.rs index 66bb9004e2d..8bae74f0fc9 100644 --- a/crates/egui_demo_app/src/apps/image_viewer.rs +++ b/crates/egui_demo_app/src/apps/image_viewer.rs @@ -113,12 +113,11 @@ impl eframe::App for ImageViewer { ui.label("Tint"); ui.color_edit_button_srgba(&mut self.image_options.tint); - // aspect ratio - ui.add_space(2.0); - ui.checkbox(&mut self.maintain_aspect_ratio, "Maintain aspect ratio"); - // fit - ui.add_space(2.0); + ui.add_space(10.0); + ui.label( + "The chosen fit will determine how the image tries to fill the available space", + ); egui::ComboBox::from_label("Fit") .selected_text(self.chosen_fit.as_str()) .show_ui(ui, |ui| { @@ -166,7 +165,8 @@ impl eframe::App for ImageViewer { } // max size - ui.add_space(2.0); + ui.add_space(5.0); + ui.label("The calculated size will not exceed the maximum size"); let had_max_size = self.max_size.is_some(); let mut has_max_size = had_max_size; ui.checkbox(&mut has_max_size, "Max size"); @@ -182,6 +182,11 @@ impl eframe::App for ImageViewer { ui.add(Slider::new(&mut max_size.x, 0.0..=2048.0).text("width")); ui.add(Slider::new(&mut max_size.y, 0.0..=2048.0).text("height")); } + + // aspect ratio + ui.add_space(5.0); + ui.label("Aspect ratio is maintained by scaling both sides as necessary"); + ui.checkbox(&mut self.maintain_aspect_ratio, "Maintain aspect ratio"); }); egui::CentralPanel::default().show(ctx, |ui| {