bevy/crates/bevy_sprite/src
ickshonpe 9eefd7c022 Remove VerticalAlign from TextAlignment (#6807)
# Objective

Remove the `VerticalAlign` enum.

Text's alignment field should only affect the text's internal text alignment, not its position. The only way to control a `TextBundle`'s position and bounds should be through the manipulation of the constraints in the `Style` components of the nodes in the Bevy UI's layout tree.

 `Text2dBundle` should have a separate `Anchor` component that sets its position relative to its transform.

Related issues: #676, #1490, #5502, #5513, #5834, #6717, #6724, #6741, #6748

## Changelog
* Changed `TextAlignment` into an enum with `Left`, `Center`, and `Right` variants.
* Removed the `HorizontalAlign` and `VerticalAlign` types.
* Added an `Anchor` component to `Text2dBundle`
* Added `Component` derive to `Anchor`
* Use `f32::INFINITY` instead of `f32::MAX` to represent unbounded text in Text2dBounds

## Migration Guide
The `alignment` field of `Text` now only affects the text's internal alignment.

### Change `TextAlignment` to TextAlignment` which is now an enum. Replace:
  * `TextAlignment::TOP_LEFT`, `TextAlignment::CENTER_LEFT`, `TextAlignment::BOTTOM_LEFT` with `TextAlignment::Left`
  * `TextAlignment::TOP_CENTER`, `TextAlignment::CENTER_LEFT`, `TextAlignment::BOTTOM_CENTER` with `TextAlignment::Center`
  * `TextAlignment::TOP_RIGHT`, `TextAlignment::CENTER_RIGHT`, `TextAlignment::BOTTOM_RIGHT` with `TextAlignment::Right`

### Changes for `Text2dBundle`
`Text2dBundle` has a new field 'text_anchor' that takes an `Anchor` component that controls its position relative to its transform.
2023-01-18 02:19:17 +00:00
..
mesh2d Make PipelineCache internally mutable. (#7205) 2023-01-16 15:41:14 +00:00
render Make PipelineCache internally mutable. (#7205) 2023-01-16 15:41:14 +00:00
bundle.rs Visibilty Inheritance, universal ComputedVisibility and RenderLayers support (#5310) 2022-07-15 23:24:42 +00:00
collide_aabb.rs Add more documentation and tests to collide_aabb::collide() (#5910) 2022-09-12 01:25:34 +00:00
dynamic_texture_atlas_builder.rs Move sprite::Rect into bevy_math (#5686) 2022-09-02 12:35:23 +00:00
lib.rs Revert "Show prelude re-exports in docs (#6448)" (#6449) 2022-11-02 20:40:45 +00:00
sprite.rs Remove VerticalAlign from TextAlignment (#6807) 2023-01-18 02:19:17 +00:00
texture_atlas.rs add ReflectAsset and ReflectHandle (#5923) 2022-10-28 20:42:33 +00:00
texture_atlas_builder.rs Move sprite::Rect into bevy_math (#5686) 2022-09-02 12:35:23 +00:00