fix text wrapping on no data scene

This commit is contained in:
József Sallai 2023-01-22 19:42:40 +02:00
parent 334e64f499
commit cb95db1e89
1 changed files with 5 additions and 1 deletions

View File

@ -100,10 +100,14 @@ impl Scene for NoDataScene {
let mut line = String::new();
for word in self.err.split(' ') {
if line.len() + word.len() > 80 {
let combined_word = line.clone() + " " + word;
let line_length = state.font.compute_width(&mut combined_word.chars(), None);
if line_length > state.canvas_size.0 as f32 {
lines.push(line);
line = String::new();
}
line.push_str(word);
line.push(' ');
}