Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace the local text queues in the text systems with flags stored in a component #8549

Merged
merged 22 commits into from
May 8, 2023
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a8a820c
Use a single query instead of a `ParamSet` for `measure_text_system`
ickshonpe May 5, 2023
dfca89c
Replaced the `ParamSet` parameter with a single query in `text_system`.
ickshonpe May 5, 2023
4e1ade4
cargo fmt --all
ickshonpe May 5, 2023
9a424c7
The change detection predicate was checking for `!queued_text.contain…
ickshonpe May 5, 2023
b0620d0
removed left over debug variable
ickshonpe May 5, 2023
686e109
Renamed the `Local` parameter `queued_text` to `text_queue` in `measu…
ickshonpe May 5, 2023
baece54
fixed imports
ickshonpe May 5, 2023
d69d8ca
Renamed `new_queue` to `new_text_queue`.
ickshonpe May 5, 2023
6e93578
changes:
ickshonpe May 5, 2023
85eb848
* Added check to filter unchanged Text in `measure_text_system`.
ickshonpe May 5, 2023
7309bac
Remove the text queue from `text_system` and use the `TextFlags` comp…
ickshonpe May 5, 2023
de73323
* cargo fmt --all,
ickshonpe May 5, 2023
90427f2
Don't recompute text that needs a remeasure.
ickshonpe May 5, 2023
aca22ab
cargo fmy
ickshonpe May 5, 2023
253ec5d
fixed text flags for full remeasure
ickshonpe May 5, 2023
05eaf9d
Moved duplicate code from `measure_text_system` and `text_system` int…
ickshonpe May 5, 2023
396a59c
formatting
ickshonpe May 5, 2023
b0aa6d9
Added `TextFlags` doc comments explaining it is for internal use.
ickshonpe May 5, 2023
dc3e846
cargo fmt
ickshonpe May 5, 2023
9c2f299
Fixes for `too_many_arguments` and `needless_borrow` lints.
ickshonpe May 5, 2023
a4a3f65
Renamed the `remeasure` field of `TextFlags` to `generate_measure_func`
ickshonpe May 7, 2023
caf6c79
Renamings for `TextFlags` fields:
ickshonpe May 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed text flags for full remeasure
  • Loading branch information
ickshonpe committed May 5, 2023
commit 253ec5d9e211f041481b538cf87baa4e9c087c5f
9 changes: 9 additions & 0 deletions crates/bevy_ui/src/widget/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ impl Measure for TextMeasure {
}
}

#[inline]
fn create_text_measure() {
}

/// Creates a `Measure` for text nodes that allows the UI to determine the appropriate amount of space
/// to provide for the text given the fonts, the text itself and the constraints of the layout.
pub fn measure_text_system(
Expand Down Expand Up @@ -135,8 +139,13 @@ pub fn measure_text_system(
) {
Ok(measure) => {
content_size.set(TextMeasure { info: measure });

// Text measured, so set `TextFlags` to schedule a recompute
text_flags.remeasure = false;
text_flags.recompute = true;
}
Err(TextError::NoSuchFont) => {
// Try again next frame
text_flags.remeasure = true;
}
Err(e @ TextError::FailedToAddGlyph(_)) => {
Expand Down