watch: highlight edit mode button while in edit mode

This commit is contained in:
galister
2025-12-21 18:25:07 +09:00
parent b11884637d
commit 48c02397a8
3 changed files with 12 additions and 3 deletions

View File

@@ -114,7 +114,7 @@ All overlays are listed on bottom row.
<Button height="40" macro="button_style" _press="::DashToggle" tooltip="WATCH.DASHBOARD" tooltip_side="top"> <Button height="40" macro="button_style" _press="::DashToggle" tooltip="WATCH.DASHBOARD" tooltip_side="top">
<sprite color="~set_color" width="32" height="32" src="watch/wayvr_dashboard_mono.svg" /> <sprite color="~set_color" width="32" height="32" src="watch/wayvr_dashboard_mono.svg" />
</Button> </Button>
<Button height="40" macro="button_style" _press="::EditToggle" tooltip="WATCH.EDIT_MODE" tooltip_side="top"> <Button id="btn_edit_mode" height="40" macro="button_style" _press="::EditToggle" tooltip="WATCH.EDIT_MODE" tooltip_side="top">
<sprite color="~set_color" width="32" height="32" src="watch/edit.svg" /> <sprite color="~set_color" width="32" height="32" src="watch/edit.svg" />
</Button> </Button>
<Button height="40" macro="button_style" tooltip="WATCH.TOGGLE_FOR_CURRENT_SET" _press="::OverlayToggle kbd"> <Button height="40" macro="button_style" tooltip="WATCH.TOGGLE_FOR_CURRENT_SET" _press="::OverlayToggle kbd">

View File

@@ -153,7 +153,7 @@
<sprite color="~set_color" width="40" height="40" src="edit/add.svg" /> <sprite color="~set_color" width="40" height="40" src="edit/add.svg" />
</Button> </Button>
</div> </div>
<Button macro="button_style" _press="::EditToggle" tooltip="WATCH.EDIT_MODE" tooltip_side="top"> <Button id="btn_edit_mode" macro="button_style" _press="::EditToggle" tooltip="WATCH.EDIT_MODE" tooltip_side="top">
<sprite color="~set_color" width="40" height="40" src="watch/edit.svg" /> <sprite color="~set_color" width="40" height="40" src="watch/edit.svg" />
</Button> </Button>
</div> </div>

View File

@@ -306,7 +306,12 @@ pub fn create_watch(app: &mut AppState) -> anyhow::Result<OverlayWindowConfig> {
}, },
)?; )?;
panel.on_notify = Some(Box::new(|panel, app, event_data| { let btn_edit_mode = panel
.parser_state
.fetch_component_as::<ComponentButton>("btn_edit_mode")
.ok();
panel.on_notify = Some(Box::new(move |panel, app, event_data| {
let mut alterables = EventAlterables::default(); let mut alterables = EventAlterables::default();
let mut com = CallbackDataCommon { let mut com = CallbackDataCommon {
alterables: &mut alterables, alterables: &mut alterables,
@@ -368,6 +373,10 @@ pub fn create_watch(app: &mut AppState) -> anyhow::Result<OverlayWindowConfig> {
panel.state.edit_add_widget, panel.state.edit_add_widget,
StyleSetRequest::Display(display), StyleSetRequest::Display(display),
); );
if let Some(btn) = btn_edit_mode.as_ref() {
btn.set_sticky_state(&mut com, edit_mode);
}
} }
OverlayEventData::OverlaysChanged(metas) => { OverlayEventData::OverlaysChanged(metas) => {
panel.state.overlay_metas = metas; panel.state.overlay_metas = metas;