Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs for AlignContent and JustifyContent variants are confusing and inconsistent. #10218

Closed
rparrett opened this issue Oct 21, 2023 · 0 comments · Fixed by #10303
Closed

Docs for AlignContent and JustifyContent variants are confusing and inconsistent. #10218

rparrett opened this issue Oct 21, 2023 · 0 comments · Fixed by #10303
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Docs An addition or correction to our documentation D-Trivial Nice and easy! A great choice to get started with Bevy

Comments

@rparrett
Copy link
Contributor

How can Bevy's documentation be improved?

Specifically, AlignContent::SpaceEvenly is quite confusing, but we should look over all variants and look for ways to make them less confusing and more consistent.

The language used in AlignContent is not consistent with the language used in JustifyContent, and the language used among variants in each is not consistent.

The corresponding fields of Style link off to the MDN docs which are worded very precisely, but are confusing in their own way. The enums or their variants don't have this link. We may want to at least link to MDN for the enums themselves (every variant seems excessive) as well.

For convenience:

/// Defines how each line is aligned within the flexbox.
///
/// It only applies if [`FlexWrap::Wrap`] is present and if there are multiple lines of items.
#[derive(Copy, Clone, PartialEq, Eq, Debug, Serialize, Deserialize, Reflect)]
#[reflect(PartialEq, Serialize, Deserialize)]
pub enum AlignContent {
/// The items are packed in their default position as if no alignment was applied
Default,
/// Each line moves towards the start of the cross axis.
Start,
/// Each line moves towards the end of the cross axis.
End,
/// Each line moves towards the start of the cross axis, unless the flex direction is reversed; then the line moves towards the end of the cross axis.
FlexStart,
/// Each line moves towards the end of the cross axis, unless the flex direction is reversed; then the line moves towards the start of the cross axis.
FlexEnd,
/// Each line moves towards the center of the cross axis.
Center,
/// Each line will stretch to fill the remaining space.
Stretch,
/// Each line fills the space it needs, putting the remaining space, if any
/// inbetween the lines.
SpaceBetween,
/// The gap between the first and last items is exactly THE SAME as the gap between items.
/// The gaps are distributed evenly.
SpaceEvenly,
/// Each line fills the space it needs, putting the remaining space, if any
/// around the lines.
SpaceAround,
}

/// Defines how items are aligned according to the main axis
#[derive(Copy, Clone, PartialEq, Eq, Debug, Serialize, Deserialize, Reflect)]
#[reflect(PartialEq, Serialize, Deserialize)]
pub enum JustifyContent {
/// The items are packed in their default position as if no alignment was applied
Default,
/// Items are packed toward the start of the axis.
Start,
/// Items are packed toward the end of the axis.
End,
/// Pushed towards the start, unless the flex direction is reversed; then pushed towards the end.
FlexStart,
/// Pushed towards the end, unless the flex direction is reversed; then pushed towards the start.
FlexEnd,
/// Centered along the main axis.
Center,
/// Remaining space is distributed between the items.
SpaceBetween,
/// Remaining space is distributed around the items.
SpaceAround,
/// Like [`JustifyContent::SpaceAround`] but with even spacing between items.
SpaceEvenly,
}

@rparrett rparrett added C-Docs An addition or correction to our documentation D-Trivial Nice and easy! A great choice to get started with Bevy A-UI Graphical user interfaces, styles, layouts, and widgets labels Oct 21, 2023
github-merge-queue bot pushed a commit that referenced this issue Oct 29, 2023
# Objective

- Address inconsistent term usage in the docs for the alignment
properties for UI nodes. Fixes #10218
- `JustifyContent::Stretch` is missing despite being supported by Taffy,
being as the default value for Grids, so it should be added to Bevy as
well

## Solution

- Consistently provide links to the mdn site for the css equivalent
- Match (mostly) the documentation given on the pub struct and the
underlying enums
- Use the term `items` consistently to refer each child in the container
- Add `JustifyContent::Stretch` and map it to Taffy

## Migration Guide

- The `JustifyContents` enum has been expanded to include
`JustifyContents::Stretch`.
ameknite pushed a commit to ameknite/bevy that referenced this issue Nov 6, 2023
# Objective

- Address inconsistent term usage in the docs for the alignment
properties for UI nodes. Fixes bevyengine#10218
- `JustifyContent::Stretch` is missing despite being supported by Taffy,
being as the default value for Grids, so it should be added to Bevy as
well

## Solution

- Consistently provide links to the mdn site for the css equivalent
- Match (mostly) the documentation given on the pub struct and the
underlying enums
- Use the term `items` consistently to refer each child in the container
- Add `JustifyContent::Stretch` and map it to Taffy

## Migration Guide

- The `JustifyContents` enum has been expanded to include
`JustifyContents::Stretch`.
rdrpenguin04 pushed a commit to rdrpenguin04/bevy that referenced this issue Jan 9, 2024
# Objective

- Address inconsistent term usage in the docs for the alignment
properties for UI nodes. Fixes bevyengine#10218
- `JustifyContent::Stretch` is missing despite being supported by Taffy,
being as the default value for Grids, so it should be added to Bevy as
well

## Solution

- Consistently provide links to the mdn site for the css equivalent
- Match (mostly) the documentation given on the pub struct and the
underlying enums
- Use the term `items` consistently to refer each child in the container
- Add `JustifyContent::Stretch` and map it to Taffy

## Migration Guide

- The `JustifyContents` enum has been expanded to include
`JustifyContents::Stretch`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Docs An addition or correction to our documentation D-Trivial Nice and easy! A great choice to get started with Bevy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant