bevy/crates/bevy_ui/src/widget
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
..
button.rs bevy_ui: Add FromReflect derives (#8495) 2023-04-26 12:17:23 +00:00
image.rs MeasureFunc improvements (#8402) 2023-05-01 15:40:53 +00:00
label.rs bevy_ui: Add FromReflect derives (#8495) 2023-04-26 12:17:23 +00:00
mod.rs Integrate AccessKit (#6874) 2023-03-01 22:45:04 +00:00
text.rs Replace the local text queues in the text systems with flags stored in a component (#8549) 2023-05-08 13:57:52 +00:00