wgui: customizable defaults

This commit is contained in:
Aleksander
2025-09-16 18:32:56 +02:00
parent 54767d75da
commit 129785daa7
20 changed files with 82 additions and 215 deletions

View File

@@ -170,7 +170,6 @@ fn new_toast(toast: Toast, app: &mut AppState) -> Option<(OverlayState, Box<dyn
let mut panel = GuiPanel::new_blank(app, ()).ok()?;
let globals = panel.layout.state.globals.clone();
let mut i18n = globals.i18n();
let (rect, _) = panel
.layout
@@ -196,7 +195,7 @@ fn new_toast(toast: Toast, app: &mut AppState) -> Option<(OverlayState, Box<dyn
let _ = panel.layout.add_child(
rect,
WidgetLabel::create(
&mut i18n,
&mut globals.get(),
WidgetLabelParams {
content: Translation::from_raw_text(&title),
style: TextStyle {
@@ -218,7 +217,7 @@ fn new_toast(toast: Toast, app: &mut AppState) -> Option<(OverlayState, Box<dyn
let _ = panel.layout.add_child(
rect,
WidgetLabel::create(
&mut i18n,
&mut globals.get(),
WidgetLabelParams {
content: Translation::from_raw_text(&toast.body),
style: TextStyle {

View File

@@ -90,7 +90,12 @@ impl AppState {
screens: smallvec![],
anchor: Affine3A::IDENTITY,
toast_sound: toast_sound_wav,
wgui_globals: WguiGlobals::new(Box::new(gui::asset::GuiAsset {}))?,
wgui_globals: WguiGlobals::new(
Box::new(gui::asset::GuiAsset {}),
wgui::globals::Defaults {
text_color: wgui::drawing::Color::new(1.0, 1.0, 1.0, 1.0),
},
)?,
#[cfg(feature = "osc")]
osc_sender,