You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears to calculate the width of the rectangle from the text without the line breaks ("thistextwraps").
Then when it is trying to position the text in the top right, it takes this rectangle (without the line breaks), then afterwards it wraps the text.
Minimal example:
use bevy::prelude::*;fnmain(){App::build().add_default_plugins().add_resource(ClearColor(Color::BLACK))// the window's background colour.add_startup_system(setup.system()).run();}fnsetup(mutcommands:Commands,asset_server:Res<AssetServer>){
commands
.spawn(UiCameraComponents::default()).spawn(TextComponents{text:Text{font: asset_server.load("fonts/FiraSans-Bold.ttf"),value:"This\ntext\nwraps".to_string(),// this is the text I want to position in the top rightstyle:TextStyle{color:Color::rgba(1.0,1.0,1.0,0.5),// White textfont_size:40.0,},},style:Style{position_type:PositionType::Absolute,position:Rect{top:Val::Px(5.0),right:Val::Px(5.0),
..Default::default()},
..Default::default()},
..Default::default()}).spawn(TextComponents{text:Text{font: asset_server.load("fonts/FiraSans-Bold.ttf"),value:"Thistextwraps".to_string(),// this is a "shadow" that demonstrates what's happeningstyle:TextStyle{color:Color::rgba(0.7,0.7,1.0,0.5),// Blue textfont_size:40.0,},},style:Style{position_type:PositionType::Absolute,position:Rect{top:Val::Px(5.0),right:Val::Px(5.0),
..Default::default()},
..Default::default()},
..Default::default()});}
The text was updated successfully, but these errors were encountered:
Using bevy master, latest commit c743a96, on Windows 10.
Possibly related to #81, #401 and #182 (#183).
I'm trying to position text (
"this\ntext\nwraps"
) that has line breaks in it in the top right corner of the window like so:I use
It appears to calculate the width of the rectangle from the text without the line breaks (
"thistextwraps"
).Then when it is trying to position the text in the top right, it takes this rectangle (without the line breaks), then afterwards it wraps the text.
Minimal example:
The text was updated successfully, but these errors were encountered: