Skip to content

Commit 78a4bea

Browse files
Move ContentSize requirements from Node to the widget defining components (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]>
1 parent c4c1c8f commit 78a4bea

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

crates/bevy_ui/src/ui_node.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::{ContentSize, FocusPolicy, UiRect, Val};
1+
use crate::{FocusPolicy, UiRect, Val};
22
use bevy_color::Color;
33
use bevy_ecs::{prelude::*, system::SystemParam};
44
use bevy_math::{vec4, Rect, Vec2, Vec4Swizzles};
@@ -286,7 +286,6 @@ impl From<&Vec2> for ScrollPosition {
286286
BackgroundColor,
287287
BorderColor,
288288
BorderRadius,
289-
ContentSize,
290289
FocusPolicy,
291290
ScrollPosition,
292291
Transform,

crates/bevy_ui/src/widget/text.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ pub struct TextBundle {}
102102
/// ```
103103
#[derive(Component, Debug, Default, Clone, Deref, DerefMut, Reflect)]
104104
#[reflect(Component, Default, Debug)]
105-
#[require(Node, TextLayout, TextFont, TextColor, TextNodeFlags)]
105+
#[require(Node, TextLayout, TextFont, TextColor, TextNodeFlags, ContentSize)]
106106
pub struct Text(pub String);
107107

108108
impl Text {

0 commit comments

Comments
 (0)