Skip to content

Commit c896ad6

Browse files
Split the labels in many_buttons (#17802)
# Objective Add some multi-span text to the `many_buttons` benchmark by splitting up each button label text into two different coloured text spans. --------- Co-authored-by: Alice Cecile <[email protected]>
1 parent fb0e5c4 commit c896ad6

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

examples/stress_tests/many_buttons.rs

+18-8
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,24 @@ fn spawn_button(
289289

290290
if spawn_text {
291291
builder.with_children(|parent| {
292-
parent.spawn((
293-
Text(format!("{column}, {row}")),
294-
TextFont {
295-
font_size: FONT_SIZE,
296-
..default()
297-
},
298-
TextColor(Color::srgb(0.2, 0.2, 0.2)),
299-
));
292+
// These labels are split to stress test multi-span text
293+
parent
294+
.spawn((
295+
Text(format!("{column}, ")),
296+
TextFont {
297+
font_size: FONT_SIZE,
298+
..default()
299+
},
300+
TextColor(Color::srgb(0.5, 0.2, 0.2)),
301+
))
302+
.with_child((
303+
TextSpan(format!("{row}")),
304+
TextFont {
305+
font_size: FONT_SIZE,
306+
..default()
307+
},
308+
TextColor(Color::srgb(0.2, 0.2, 0.5)),
309+
));
300310
});
301311
}
302312
}

0 commit comments

Comments
 (0)