Properly mark front panel state as changed in widget response

This commit is contained in:
pjht 2024-02-01 18:37:32 -06:00
parent 7ced15be5c
commit 46119048c2
Signed by: pjht
GPG Key ID: 7B5F6AFBEC7EE78E

View File

@ -98,7 +98,7 @@ impl Widget for &mut Frontpanel<'_> {
);
let led_textures =
led::Textures::new(self.textures.led_on.clone(), self.textures.led_off.clone());
let resp = ui.allocate_response(vec2(800.0, 333.0), Sense::click());
let mut resp = ui.allocate_response(vec2(800.0, 333.0), Sense::click());
resp.request_focus();
let fp_rect = resp.rect;
ui.allocate_ui_at_rect(fp_rect, |ui| {
@ -136,6 +136,7 @@ impl Widget for &mut Frontpanel<'_> {
{
self.state.power = !power_inv;
self.interaction = Some(FrontpanelInteraction::Power(self.state.power));
resp.mark_changed();
};
});
}
@ -162,6 +163,7 @@ impl Widget for &mut Frontpanel<'_> {
{
self.state.ad_sws =
(self.state.ad_sws & !(bit_mask)) | (u16::from(sw_state) << (16 - i));
resp.mark_changed();
};
});
}
@ -206,6 +208,7 @@ impl Widget for &mut Frontpanel<'_> {
_ => unreachable!(),
};
self.interaction = Some(FrontpanelInteraction::ActionSw(sw, *state));
resp.mark_changed();
};
});
}