From 4b7b79b65a0e6e16c9d07c9667d743796d68ba9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sat, 22 Apr 2023 00:18:53 +0200 Subject: [PATCH 1/3] set the UI box big enough to contain the label --- examples/3d/blend_modes.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/3d/blend_modes.rs b/examples/3d/blend_modes.rs index 4dd76d8faf129..2bd405b281c03 100644 --- a/examples/3d/blend_modes.rs +++ b/examples/3d/blend_modes.rs @@ -236,6 +236,7 @@ fn setup( TextBundle::from_section(label, label_text_style.clone()).with_style(Style { position_type: PositionType::Absolute, bottom: Val::Px(0.), + size: Size::new(Val::Px(label.len() as f32 * 10.0), Val::Auto), ..default() }), ); From 60f9a5ff5fc7947be0ba31a4d13a5737bcf577d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Wed, 26 Apr 2023 23:16:50 +0200 Subject: [PATCH 2/3] readd font --- examples/3d/blend_modes.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/3d/blend_modes.rs b/examples/3d/blend_modes.rs index 2bd405b281c03..6d827a1327821 100644 --- a/examples/3d/blend_modes.rs +++ b/examples/3d/blend_modes.rs @@ -34,6 +34,7 @@ fn setup( mut commands: Commands, mut meshes: ResMut>, mut materials: ResMut>, + asset_server: Res, ) { let base_color = Color::rgba(0.9, 0.2, 0.3, 1.0); let icosphere_mesh = meshes.add( @@ -185,15 +186,15 @@ fn setup( // Controls Text let text_style = TextStyle { + font: asset_server.load("fonts/FiraMono-Medium.ttf"), font_size: 18.0, color: Color::BLACK, - ..default() }; let label_text_style = TextStyle { + font: asset_server.load("fonts/FiraMono-Medium.ttf"), font_size: 25.0, color: Color::ORANGE, - ..default() }; commands.spawn( From 7038aa0b099455d8083a80bbbc9b76ca5910fd59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Mon, 26 Jun 2023 19:30:12 +0200 Subject: [PATCH 3/3] use the new no wrap text feature --- examples/3d/blend_modes.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/3d/blend_modes.rs b/examples/3d/blend_modes.rs index 6d827a1327821..6a171b34131da 100644 --- a/examples/3d/blend_modes.rs +++ b/examples/3d/blend_modes.rs @@ -234,12 +234,13 @@ fn setup( )) .with_children(|parent| { parent.spawn( - TextBundle::from_section(label, label_text_style.clone()).with_style(Style { - position_type: PositionType::Absolute, - bottom: Val::Px(0.), - size: Size::new(Val::Px(label.len() as f32 * 10.0), Val::Auto), - ..default() - }), + TextBundle::from_section(label, label_text_style.clone()) + .with_style(Style { + position_type: PositionType::Absolute, + bottom: Val::Px(0.), + ..default() + }) + .with_no_wrap(), ); }); };