Squeezed text nodes early text wrap
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version
Main [ee697f8](https://github.com/bevyengine/bevy/commit/ee697f820c0b164cf2825b9c8e932fc8cee24a2c)
## What you did
```rust
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands, asset_server: Res) {
let font = asset_server.load("FiraMono-Medium.ttf");
let text_style = TextStyle {
font,
font_size: 20.,
color: Color::WHITE,
};
let message = "one two three four";
commands.spawn(Camera2dBundle::default());
commands
.spawn(NodeBundle {
style: Style {
flex_direction: FlexDirection::Column,
size: Size::width(Val::Percent(100.)),
..Default::default()
},
..Default::default()
})
.with_children(|commands| {
let test_cases = [
(Val::Percent(100.), Color::RED),
(Val::Px(10000.), Color::YELLOW),
(Val::Percent(50.), Color::GREEN),
];
for (width, bg_color) in test_cases {
commands
.spawn(NodeBundle::default())
.with_children(|commands| {
commands.spawn(
TextBundle::from_section(
message,
text_style.clone(),
)
.with_background_color(Color::BLACK),
);
commands.spawn(NodeBundle {
style: Style {
size: Size::width(width),
..Default::default()
},
background_color: bg_color.into(),
..Default::default()
});
});
}
});
}
```
## What went wrong
## Additional Information
Doesn't seem to be directly related to #8516, but it'll be much easier to isolate the cause with #8516 fixed.
Contributor guide
Assessment
This issue has not been assessed yet.