improve watch overlay layou
This commit is contained in:
@@ -119,7 +119,7 @@
|
||||
<label translation="WATCH.EDIT_MODE_EXPLANATION" align="center" />
|
||||
</div>
|
||||
<div flex_direction="column" align_items="center" justify_content="center">
|
||||
<div id="toolbox" gap="8" width="100%" flex_direction="column" flex_wrap="wrap">
|
||||
<div id="toolbox" gap="8" width="100%" max_width="400" flex_direction="row" flex_wrap="wrap">
|
||||
<Button height="40" macro="button_style" tooltip="WATCH.TOGGLE_FOR_CURRENT_SET" _press="::OverlayToggle kbd">
|
||||
<sprite src_builtin="watch/keyboard.svg" width="32" height="32" />
|
||||
<label translation="EDIT_MODE.KEYBOARD" size="18" />
|
||||
|
||||
@@ -341,13 +341,14 @@ pub fn create_watch(app: &mut AppState) -> anyhow::Result<OverlayWindowConfig> {
|
||||
panel.state.overlay_metas = metas;
|
||||
for (idx, btn) in panel.state.overlay_buttons.iter().enumerate() {
|
||||
let display = if let Some(meta) = panel.state.overlay_metas.get(idx) {
|
||||
let name = sanitize_overlay_name(&meta.name);
|
||||
if let Some(mut label) =
|
||||
panel.layout.state.widgets.get_as::<WidgetLabel>(btn.label)
|
||||
{
|
||||
label.set_text(&mut com, Translation::from_raw_text(&meta.name));
|
||||
label.set_text(&mut com, Translation::from_raw_text_rc(name));
|
||||
} else {
|
||||
btn.button
|
||||
.set_text(&mut com, Translation::from_raw_text(&meta.name));
|
||||
.set_text(&mut com, Translation::from_raw_text_rc(name));
|
||||
}
|
||||
|
||||
if let Some(mut sprite) = panel
|
||||
@@ -433,3 +434,7 @@ pub fn watch_fade<D>(app: &mut AppState, watch: &mut OverlayWindowData<D>) {
|
||||
state.alpha += 0.1;
|
||||
state.alpha = state.alpha.clamp(0., 1.);
|
||||
}
|
||||
|
||||
fn sanitize_overlay_name(str: &str) -> Rc<str> {
|
||||
str.replace("-wvr", "").into()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user