Skip to content

Commit 8fa94a0

Browse files
authored
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">
1 parent 15be0d1 commit 8fa94a0

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

examples/3d/blend_modes.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ fn setup(
3434
mut commands: Commands,
3535
mut meshes: ResMut<Assets<Mesh>>,
3636
mut materials: ResMut<Assets<StandardMaterial>>,
37+
asset_server: Res<AssetServer>,
3738
) {
3839
let base_color = Color::rgba(0.9, 0.2, 0.3, 1.0);
3940
let icosphere_mesh = meshes.add(
@@ -185,15 +186,15 @@ fn setup(
185186

186187
// Controls Text
187188
let text_style = TextStyle {
189+
font: asset_server.load("fonts/FiraMono-Medium.ttf"),
188190
font_size: 18.0,
189191
color: Color::BLACK,
190-
..default()
191192
};
192193

193194
let label_text_style = TextStyle {
195+
font: asset_server.load("fonts/FiraMono-Medium.ttf"),
194196
font_size: 25.0,
195197
color: Color::ORANGE,
196-
..default()
197198
};
198199

199200
commands.spawn(
@@ -233,11 +234,13 @@ fn setup(
233234
))
234235
.with_children(|parent| {
235236
parent.spawn(
236-
TextBundle::from_section(label, label_text_style.clone()).with_style(Style {
237-
position_type: PositionType::Absolute,
238-
bottom: Val::Px(0.),
239-
..default()
240-
}),
237+
TextBundle::from_section(label, label_text_style.clone())
238+
.with_style(Style {
239+
position_type: PositionType::Absolute,
240+
bottom: Val::Px(0.),
241+
..default()
242+
})
243+
.with_no_wrap(),
241244
);
242245
});
243246
};

0 commit comments

Comments
 (0)