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 (#16083)

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.

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>
  • Loading branch information
2 people authored and mockersf committed Nov 5, 2024
1 parent 013a18b commit dfd3d61
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::{widget::UiImageSize, ContentSize, FocusPolicy, UiRect, Val};
use crate::{widget::UiImageSize, FocusPolicy, UiRect, Val};
use bevy_asset::Handle;
use bevy_color::Color;
use bevy_ecs::{prelude::*, system::SystemParam};
Expand Down Expand Up @@ -288,7 +288,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 dfd3d61

Please sign in to comment.