Fix inverted power switch
This commit is contained in:
parent
782e522ce8
commit
c7ce618b25
@ -90,17 +90,19 @@ impl Widget for Frontpanel<'_> {
|
||||
pos += fp_rect.left_top().to_vec2();
|
||||
if i == 0 {
|
||||
ui.allocate_ui_at_rect(Rect::from_center_size(pos, vec2(32.0, 32.0)), |ui| {
|
||||
let mut power_inv = !state.power;
|
||||
if ui
|
||||
.add(switch::ToggleSwitch::new(&mut state.power, &sw_textures))
|
||||
.add(switch::ToggleSwitch::new(&mut power_inv, &sw_textures))
|
||||
.drag_started()
|
||||
{
|
||||
if state.power {
|
||||
if !power_inv {
|
||||
self.audio_tx.send(AudioMessage::FanOn).unwrap();
|
||||
} else {
|
||||
self.audio_tx.send(AudioMessage::FanOff).unwrap();
|
||||
}
|
||||
self.audio_tx.send(AudioMessage::PlaySwitchClick).unwrap();
|
||||
};
|
||||
state.power = !power_inv;
|
||||
});
|
||||
}
|
||||
if (1..17).contains(&i) {
|
||||
|
Loading…
Reference in New Issue
Block a user