Skip to content

Commit

Permalink
Add docstring comment to Style to reference CSS (bevyengine#2936)
Browse files Browse the repository at this point in the history
Mention the fact that the UI layout system is based on the CSS layout
model through a docstring comment on the `Style` type.

# Objective

Explain to new users that the Bevy UI uses the CSS layout model, to lower the barrier to entry given the fact documentation (book and code) is fairly limited on the topic.

## Solution

Fix as discussed with @alice-i-cecile on bevyengine#2918.
  • Loading branch information
djeedai committed Nov 6, 2021
1 parent aac0935 commit a5c675f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/bevy_ui/src/ui_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ impl AddAssign<f32> for Val {
}
}

/// UI node style.
///
/// The UI layout system follows the CSS layout model specification (see
/// [this section](https://www.w3.org/TR/CSS2/visuren.html) in particular).
/// One notable difference however is that the vertical axis is inverted,
/// with the Y axis pointing up in Bevy (origin in bottom left corner).
///
/// You may find [this flexbox guide](https://css-tricks.com/snippets/css/a-guide-to-flexbox/) helpful.
#[derive(Component, Clone, PartialEq, Debug, Reflect)]
#[reflect(Component, PartialEq)]
pub struct Style {
Expand Down

0 comments on commit a5c675f

Please sign in to comment.