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:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user