From 29668b512888d3a8fe53da9258e7e6fcb2442610 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sun, 2 May 2021 22:02:26 +0200 Subject: [PATCH] Minor documentation improvements --- egui/src/containers/popup.rs | 1 + egui/src/layers.rs | 2 +- egui/src/memory.rs | 2 +- egui/src/widgets/image.rs | 2 ++ egui/src/widgets/slider.rs | 2 ++ 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/egui/src/containers/popup.rs b/egui/src/containers/popup.rs index a201ec09..ba424395 100644 --- a/egui/src/containers/popup.rs +++ b/egui/src/containers/popup.rs @@ -162,6 +162,7 @@ fn show_tooltip_area( /// ui.memory().toggle_popup(popup_id); /// } /// egui::popup::popup_below_widget(ui, popup_id, &response, |ui| { +/// ui.set_min_width(200.0); // if you want to control the size /// ui.label("Some more info, or things you can select:"); /// ui.label("…"); /// }); diff --git a/egui/src/layers.rs b/egui/src/layers.rs index e2e6417b..10cd68cc 100644 --- a/egui/src/layers.rs +++ b/egui/src/layers.rs @@ -142,7 +142,7 @@ impl GraphicLayers { let order_map = &mut self.0[order as usize]; // If a layer is empty at the start of the frame - // the nobody has added to it, and it is old and defunct. + // then nobody has added to it, and it is old and defunct. // Free it to save memory: order_map.retain(|_, list| !list.lock().is_empty()); diff --git a/egui/src/memory.rs b/egui/src/memory.rs index 99e66f1e..b8032d59 100644 --- a/egui/src/memory.rs +++ b/egui/src/memory.rs @@ -303,7 +303,7 @@ impl Memory { !self.had_focus_last_frame(id) && self.has_focus(id) } - /// Does this widget have keybaord focus? + /// Does this widget have keyboard focus? #[inline(always)] pub fn has_focus(&self, id: Id) -> bool { self.interaction.focus.id == Some(id) diff --git a/egui/src/widgets/image.rs b/egui/src/widgets/image.rs index 421ec2d1..5d500006 100644 --- a/egui/src/widgets/image.rs +++ b/egui/src/widgets/image.rs @@ -10,6 +10,8 @@ use crate::*; /// // Shorter version: /// ui.image(my_texture_id, [640.0, 480.0]); /// ``` +/// +/// Se also [`crate::ImageButton`]. #[must_use = "You should put this widget in an ui with `ui.add(widget);`"] #[derive(Clone, Copy, Debug)] pub struct Image { diff --git a/egui/src/widgets/slider.rs b/egui/src/widgets/slider.rs index f37af5ad..73a44756 100644 --- a/egui/src/widgets/slider.rs +++ b/egui/src/widgets/slider.rs @@ -49,6 +49,8 @@ struct SliderSpec { /// # let mut my_f32: f32 = 0.0; /// ui.add(egui::Slider::new(&mut my_f32, 0.0..=100.0).text("My value")); /// ``` +/// +/// The default `Slider` size is set by [`crate::style::Spacing::slider_width`]. #[must_use = "You should put this widget in an ui with `ui.add(widget);`"] pub struct Slider<'a> { get_set_value: GetSetValue<'a>,