Improve docs

This commit is contained in:
Emil Ernerfeldt 2020-10-24 19:46:38 +02:00
parent 2e80aba068
commit 060ce6b49f
2 changed files with 21 additions and 6 deletions

View file

@ -3,6 +3,17 @@
//! To get started with Egui, you can use one of the available integrations //! To get started with Egui, you can use one of the available integrations
//! such as [`egui_web`](https://crates.io/crates/egui_web) or [`egui_glium`](https://crates.io/crates/egui_glium). //! such as [`egui_web`](https://crates.io/crates/egui_web) or [`egui_glium`](https://crates.io/crates/egui_glium).
//! //!
//! Whatever you use, you need an `egui::Context` (by convention referred to by `ctx`).
//! With it you can then get access to an `Ui` where you can put widgets.
//! Use one of `SidePanel`, `TopPanel`, `CentralPanel`, `Window` or `Area`. For instace:
//!
//! ``` ignore
//! egui::CentralPanel::default().show(ctx, |ui| {
//! ui.label("Hello");
//! })
//! ```
//!
//!
//! To write your own integration for Egui you need to do this: //! To write your own integration for Egui you need to do this:
//! //!
//! ``` ignore //! ``` ignore

View file

@ -192,9 +192,11 @@ impl Ui {
/// ## Sizes etc /// ## Sizes etc
impl Ui { impl Ui {
/// The current size of this Ui. /// Where and how large the `Ui` is already.
/// Bounding box of all contained child widgets. /// All widgets that have been added ot this `Ui` fits within this rectangle.
///
/// No matter what, the final Ui will be at least this large. /// No matter what, the final Ui will be at least this large.
///
/// This will grow as new widgets are added, but never shrink. /// This will grow as new widgets are added, but never shrink.
pub fn min_rect(&self) -> Rect { pub fn min_rect(&self) -> Rect {
self.min_rect self.min_rect
@ -205,11 +207,13 @@ impl Ui {
self.min_rect.size() self.min_rect.size()
} }
/// This is the soft max size of the Ui.
/// New widgets will *try* to fit within this rectangle. /// New widgets will *try* to fit within this rectangle.
/// For instance, text will wrap to fit within it. ///
/// If a widget doesn't fit within the `max_rect` then it will expand. /// Text labels will wrap to fit within `max_rect`.
/// `max_rect()` is always at least as large as `min_rect()`. /// Separator lines will span the `max_rect`.
///
/// If a new widget doesn't fit within the `max_rect` then the
/// `Ui` will make room for it by expanding both `min_rect` and `max_rect`.
pub fn max_rect(&self) -> Rect { pub fn max_rect(&self) -> Rect {
self.max_rect self.max_rect
} }