mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
succesfull rendering of multi-level rects and texts
This commit is contained in:
parent
51d86f101f
commit
59a0c47038
3 changed files with 96 additions and 41 deletions
|
@ -1,4 +1,3 @@
|
|||
|
||||
use crate::graphics::primitives::rect::Rect;
|
||||
use crate::graphics::primitives::text::{owned_section_from_text, Text};
|
||||
|
||||
|
@ -20,6 +19,15 @@ impl RectsAndTexts {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn init(rects_behind: Vec<Rect>, texts_behind: Vec<Text>, rects_front: Vec<Rect>, texts_front: Vec<Text>) -> Self {
|
||||
Self {
|
||||
text_sections_behind: texts_behind.iter().map(|txt| owned_section_from_text(txt)).collect(),
|
||||
text_sections_front: texts_front.iter().map(|txt| owned_section_from_text(txt)).collect(),
|
||||
rects_behind,
|
||||
rects_front,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_text_behind(&mut self, new_text_section: glyph_brush::OwnedSection) {
|
||||
self.text_sections_behind.push(new_text_section);
|
||||
}
|
||||
|
@ -48,4 +56,4 @@ impl RectsAndTexts {
|
|||
self.rects_behind.extend(rects_and_texts.rects_behind);
|
||||
self.rects_front.extend(rects_and_texts.rects_front);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue