Move ContentSize requirements from Node to the widget defining components (#16083)

# Objective

Missed this in the required components PR review. `ContentSize` isn't
used by regular UI nodes, only those with intrinsically sized content
that needs a measure func.

## Solution

Remove `ContentSize` from `Node`'s required components and add it to the
required components of `Text` and `UiImage`.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
This commit is contained in:
ickshonpe 2024-10-27 22:39:32 +00:00 committed by GitHub
parent c4c1c8ffa1
commit 78a4bea3d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 3 deletions

View file

@ -1,4 +1,4 @@
use crate::{ContentSize, FocusPolicy, UiRect, Val};
use crate::{FocusPolicy, UiRect, Val};
use bevy_color::Color;
use bevy_ecs::{prelude::*, system::SystemParam};
use bevy_math::{vec4, Rect, Vec2, Vec4Swizzles};
@ -286,7 +286,6 @@ impl From<&Vec2> for ScrollPosition {
BackgroundColor,
BorderColor,
BorderRadius,
ContentSize,
FocusPolicy,
ScrollPosition,
Transform,

View file

@ -102,7 +102,7 @@ pub struct TextBundle {}
/// ```
#[derive(Component, Debug, Default, Clone, Deref, DerefMut, Reflect)]
#[reflect(Component, Default, Debug)]
#[require(Node, TextLayout, TextFont, TextColor, TextNodeFlags)]
#[require(Node, TextLayout, TextFont, TextColor, TextNodeFlags, ContentSize)]
pub struct Text(pub String);
impl Text {