bevy/crates/bevy_ui
ickshonpe e0a94abf1c
Replace the local text queues in the text systems with flags stored in a component (#8549)
# Objective

`text_system` and `measure_text_system` both keep local queues to keep
track of text node entities that need recomputations/remeasurement,
which scales very badly with large numbers of text entities (O(n^2)) and
makes the code quite difficult to understand.

Also `text_system` filters for `Changed<Text>`, this isn't something
that it should do. When a text node entity fails to be processed by
`measure_text_system` because a font can't be found, the text node will
still be added to `text_system`'s local queue for recomputation. `Text`
should only ever be queued by `text_system` when a text node's geometry
is modified or a new measure is added.

## Solution

Remove the local text queues and use a component `TextFlags` to schedule
remeasurements and recomputations.

## Changelog
* Created a component `TextFlags` with fields `remeasure` and
`recompute`, which can be used to schedule a text `remeasure` or
`recomputation` respectively and added it to `TextBundle`.
* Removed the local text queues from `measure_text_system` and
`text_system` and instead use the `TextFlags` component to schedule
remeasurements and recomputations.

## Migration Guide

The component `TextFlags` has been added to `TextBundle`.
2023-05-08 13:57:52 +00:00
..
src Replace the local text queues in the text systems with flags stored in a component (#8549) 2023-05-08 13:57:52 +00:00
Cargo.toml Add CSS Grid support to bevy_ui (#8026) 2023-04-17 16:21:38 +00:00