Skip to content

Commit 8a32172

Browse files
committed
Removed the with_linebreak_behaviour methods
Changed the text2d example code to suit
1 parent 5fc0146 commit 8a32172

File tree

3 files changed

+17
-30
lines changed

3 files changed

+17
-30
lines changed

crates/bevy_text/src/text.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,6 @@ impl Text {
106106
self.alignment = alignment;
107107
self
108108
}
109-
110-
pub const fn with_linebreak_behaviour(
111-
mut self,
112-
linebreak_behaviour: TextLineBreakBehaviour,
113-
) -> Self {
114-
self.linebreak_behaviour = linebreak_behaviour;
115-
self
116-
}
117109
}
118110

119111
#[derive(Debug, Default, Clone, FromReflect, Reflect)]

crates/bevy_ui/src/node_bundles.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use bevy_render::{
99
prelude::{Color, ComputedVisibility},
1010
view::Visibility,
1111
};
12-
use bevy_text::{Text, TextAlignment, TextLineBreakBehaviour, TextSection, TextStyle};
12+
use bevy_text::{Text, TextAlignment, TextSection, TextStyle};
1313
use bevy_transform::prelude::{GlobalTransform, Transform};
1414

1515
/// The basic UI node
@@ -153,15 +153,6 @@ impl TextBundle {
153153
self
154154
}
155155

156-
/// Returns this [`TextBundle`] with a new [`TextLineBreakBehaviour`] on [`Text`].
157-
pub const fn with_linebreak_behaviour(
158-
mut self,
159-
linebreak_behaviour: TextLineBreakBehaviour,
160-
) -> Self {
161-
self.text.linebreak_behaviour = linebreak_behaviour;
162-
self
163-
}
164-
165156
/// Returns this [`TextBundle`] with a new [`Style`].
166157
pub const fn with_style(mut self, style: Style) -> Self {
167158
self.style = style;

examples/2d/text2d.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,14 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
8484
})
8585
.with_children(|builder| {
8686
builder.spawn(Text2dBundle {
87-
text: Text::from_section(
88-
"this text wraps in the box\n(Unicode linebreaks)",
89-
slightly_smaller_text_style.clone(),
90-
)
91-
.with_alignment(TextAlignment::Left)
92-
.with_linebreak_behaviour(TextLineBreakBehaviour::Unicode),
87+
text: Text {
88+
sections: vec![TextSection::new(
89+
"this text wraps in the box\n(Unicode linebreaks)",
90+
slightly_smaller_text_style.clone(),
91+
)],
92+
alignment: TextAlignment::Left,
93+
linebreak_behaviour: TextLineBreakBehaviour::Unicode,
94+
},
9395
text_2d_bounds: Text2dBounds {
9496
// Wrap text in the rectangle
9597
size: box_size,
@@ -114,12 +116,14 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
114116
})
115117
.with_children(|builder| {
116118
builder.spawn(Text2dBundle {
117-
text: Text::from_section(
118-
"this text wraps in the box\n(AnyCharacter linebreaks)",
119-
slightly_smaller_text_style,
120-
)
121-
.with_alignment(TextAlignment::Left)
122-
.with_linebreak_behaviour(TextLineBreakBehaviour::AnyCharacter),
119+
text: Text {
120+
sections: vec![TextSection::new(
121+
"this text wraps in the box\n(AnyCharacter linebreaks)",
122+
slightly_smaller_text_style.clone(),
123+
)],
124+
alignment: TextAlignment::Left,
125+
linebreak_behaviour: TextLineBreakBehaviour::AnyCharacter,
126+
},
123127
text_2d_bounds: Text2dBounds {
124128
// Wrap text in the rectangle
125129
size: other_box_size,

0 commit comments

Comments
 (0)