Add doc comments explaining the different behaviours of alignment and Anchor with text_2d (#8022)

# Objective
Add an explanation of the differences between `alignment` and `Anchor`
to the `Text2dBundle` docs.

---------

Co-authored-by: Rob Parrett <robparrett@gmail.com>
Co-authored-by: François Mockers <mockersf@gmail.com>
This commit is contained in:
ickshonpe 2024-05-12 22:42:04 +01:00 committed by GitHub
parent ded5d523bd
commit be217ab037
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -61,8 +61,15 @@ impl Text2dBounds {
#[derive(Bundle, Clone, Debug, Default)]
pub struct Text2dBundle {
/// Contains the text.
///
/// With `Text2dBundle` the alignment field of `Text` only affects the internal alignment of a block of text and not its
/// relative position which is controlled by the `Anchor` component.
/// This means that for a block of text consisting of only one line that doesn't wrap, the `alignment` field will have no effect.
pub text: Text,
/// How the text is positioned relative to its transform.
///
/// `text_anchor` does not affect the internal alignment of the block of text, only
/// its position.
pub text_anchor: Anchor,
/// The maximum width and height of the text.
pub text_2d_bounds: Text2dBounds,