Skip to content

Commit

Permalink
Move ContentSize requirements from Node to the widget defining co…
Browse files Browse the repository at this point in the history
…mponents (bevyengine#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 <[email protected]>
  • Loading branch information
ickshonpe and alice-i-cecile authored Oct 27, 2024
1 parent c4c1c8f commit 78a4bea
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions crates/bevy_ui/src/ui_node.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -286,7 +286,6 @@ impl From<&Vec2> for ScrollPosition {
BackgroundColor,
BorderColor,
BorderRadius,
ContentSize,
FocusPolicy,
ScrollPosition,
Transform,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ui/src/widget/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 78a4bea

Please sign in to comment.