1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 04:40:03 -04:00

Add LayoutJob::clear (#8376)

## Summary

- Add `LayoutJob::clear` to reuse layout settings while rebuilding text.
- Cover preservation of every layout setting.

## Test

- `cargo clippy -p epaint --all-features --all-targets`
- `cargo test -p epaint --all-features`

* [x] I have followed the instructions in the PR template
This commit is contained in:
Emil Ernerfeldt
2026-08-02 12:26:27 -07:00
committed by GitHub
parent 7f30623cff
commit cb2b306f11

View File

@@ -114,6 +114,13 @@ impl Default for LayoutJob {
} }
impl LayoutJob { impl LayoutJob {
/// Clear the text and sections while preserving the layout settings.
#[inline]
pub fn clear(&mut self) {
self.text.clear();
self.sections.clear();
}
/// Break on `\n` and at the given wrap width. /// Break on `\n` and at the given wrap width.
#[inline] #[inline]
pub fn simple(text: String, font_id: FontId, color: Color32, wrap_width: f32) -> Self { pub fn simple(text: String, font_id: FontId, color: Color32, wrap_width: f32) -> Self {