From 5e46bd404ccba740bd2a41e2cbf7a7a4f9a3ba55 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sat, 8 May 2021 09:25:52 +0200 Subject: [PATCH] Some documentation improvements --- egui/src/ui.rs | 5 +++++ egui/src/widgets/label.rs | 4 ++-- egui/src/widgets/plot/items.rs | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/egui/src/ui.rs b/egui/src/ui.rs index cc483425..957fc707 100644 --- a/egui/src/ui.rs +++ b/egui/src/ui.rs @@ -60,6 +60,10 @@ impl Ui { // ------------------------------------------------------------------------ // Creation: + /// Create a new `Ui`. + /// + /// Normally you would not use this directly, but instead use + /// [`SidePanel`], [`TopPanel`], [`CentralPanel`], [`Window`] or [`Area`]. pub fn new(ctx: CtxRef, layer_id: LayerId, id: Id, max_rect: Rect, clip_rect: Rect) -> Self { let style = ctx.style(); Ui { @@ -72,6 +76,7 @@ impl Ui { } } + /// Create a new `Ui` at a specific region. pub fn child_ui(&mut self, max_rect: Rect, layout: Layout) -> Self { debug_assert!(!max_rect.any_nan()); let next_auto_id_source = Id::new(self.next_auto_id_source).with("child").value(); diff --git a/egui/src/widgets/label.rs b/egui/src/widgets/label.rs index b9e920f5..f142948e 100644 --- a/egui/src/widgets/label.rs +++ b/egui/src/widgets/label.rs @@ -145,9 +145,9 @@ impl Label { self } - /// Make the label response to clicks and/or drags. + /// Make the label respond to clicks and/or drags. /// - /// By default, a label is inert and does not response to click or drags. + /// By default, a label is inert and does not respond to click or drags. /// By calling this you can turn the label into a button of sorts. /// This will also give the label the hover-effect of a button, but without the frame. /// diff --git a/egui/src/widgets/plot/items.rs b/egui/src/widgets/plot/items.rs index e954355f..d0b4c72c 100644 --- a/egui/src/widgets/plot/items.rs +++ b/egui/src/widgets/plot/items.rs @@ -215,6 +215,9 @@ impl Curve { } /// Name of this curve. + /// + /// If a curve is given a name it will show up in the plot legend + /// (if legends are turned on). #[allow(clippy::needless_pass_by_value)] pub fn name(mut self, name: impl ToString) -> Self { self.name = name.to_string();