Skip to content

Commit

Permalink
Add CenteredLabel (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
gurrrrrrett3 authored Apr 17, 2024
1 parent 1772e3a commit 42ab3a3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/gui/modular/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ pub enum ModularElement {
#[serde(flatten)]
data: LabelContent,
},
CenteredLabel {
rect: [f32; 4],
font_size: isize,
fg_color: Arc<str>,
#[serde(flatten)]
data: LabelContent,
},
Button {
rect: [f32; 4],
font_size: isize,
Expand Down Expand Up @@ -143,6 +150,17 @@ pub fn modular_canvas(
let label = canvas.label(*x, *y, *w, *h, empty_str.clone());
modular_label_init(label, data);
}
ModularElement::CenteredLabel {
rect: [x, y, w, h],
font_size,
fg_color,
data,
} => {
canvas.font_size = *font_size;
canvas.fg_color = color_parse(fg_color).unwrap_or(*FALLBACK_COLOR);
let label = canvas.label(*x, *y, *w, *h, empty_str.clone());
modular_label_init(label, data);
}
ModularElement::Button {
rect: [x, y, w, h],
font_size,
Expand Down

0 comments on commit 42ab3a3

Please sign in to comment.