blend_modes example: fix label position (#8454)
# Objective - Labels are not correctly placed <img width="1392" alt="Screenshot 2023-04-22 at 00 12 54" src="https://user-images.githubusercontent.com/8672791/233742996-0189b3c2-ea6b-4f3f-b2e8-68fdbf74f52f.png"> ## Solution - Set a width in the UI so that text doesn't try to wrap <img width="1392" alt="Screenshot 2023-04-22 at 00 13 04" src="https://user-images.githubusercontent.com/8672791/233743064-8d6045e5-3936-4c22-be07-ac618399c093.png">
This commit is contained in:
parent
15be0d1a61
commit
8fa94a0a0d
@ -34,6 +34,7 @@ fn setup(
|
|||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
mut meshes: ResMut<Assets<Mesh>>,
|
mut meshes: ResMut<Assets<Mesh>>,
|
||||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||||
|
asset_server: Res<AssetServer>,
|
||||||
) {
|
) {
|
||||||
let base_color = Color::rgba(0.9, 0.2, 0.3, 1.0);
|
let base_color = Color::rgba(0.9, 0.2, 0.3, 1.0);
|
||||||
let icosphere_mesh = meshes.add(
|
let icosphere_mesh = meshes.add(
|
||||||
@ -185,15 +186,15 @@ fn setup(
|
|||||||
|
|
||||||
// Controls Text
|
// Controls Text
|
||||||
let text_style = TextStyle {
|
let text_style = TextStyle {
|
||||||
|
font: asset_server.load("fonts/FiraMono-Medium.ttf"),
|
||||||
font_size: 18.0,
|
font_size: 18.0,
|
||||||
color: Color::BLACK,
|
color: Color::BLACK,
|
||||||
..default()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let label_text_style = TextStyle {
|
let label_text_style = TextStyle {
|
||||||
|
font: asset_server.load("fonts/FiraMono-Medium.ttf"),
|
||||||
font_size: 25.0,
|
font_size: 25.0,
|
||||||
color: Color::ORANGE,
|
color: Color::ORANGE,
|
||||||
..default()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
commands.spawn(
|
commands.spawn(
|
||||||
@ -233,11 +234,13 @@ fn setup(
|
|||||||
))
|
))
|
||||||
.with_children(|parent| {
|
.with_children(|parent| {
|
||||||
parent.spawn(
|
parent.spawn(
|
||||||
TextBundle::from_section(label, label_text_style.clone()).with_style(Style {
|
TextBundle::from_section(label, label_text_style.clone())
|
||||||
position_type: PositionType::Absolute,
|
.with_style(Style {
|
||||||
bottom: Val::Px(0.),
|
position_type: PositionType::Absolute,
|
||||||
..default()
|
bottom: Val::Px(0.),
|
||||||
}),
|
..default()
|
||||||
|
})
|
||||||
|
.with_no_wrap(),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user