diff --git a/src/app/panels/middle/xvb.rs b/src/app/panels/middle/xvb.rs index 89b4025..fc10c21 100644 --- a/src/app/panels/middle/xvb.rs +++ b/src/app/panels/middle/xvb.rs @@ -177,7 +177,6 @@ impl crate::disk::state::Xvb { ui.add_space(space_h); - let mut is_slider_enabled = true; let mut hashrate_xmrig = { if lock!(gui_api_xmrig).hashrate_raw_15m > 0.0 { lock!(gui_api_xmrig).hashrate_raw_15m @@ -186,7 +185,6 @@ impl crate::disk::state::Xvb { } else if lock!(gui_api_xmrig).hashrate_raw > 0.0 { lock!(gui_api_xmrig).hashrate_raw } else { - is_slider_enabled = false; 1000.0 } }; @@ -204,27 +202,25 @@ impl crate::disk::state::Xvb { XVB_MANUAL_SLIDER_MANUAL_P2POOL_HELP }; - ui.add_enabled_ui(is_slider_enabled, |ui| { - ui.horizontal(|ui| { - ui.spacing_mut().slider_width = width * 0.5; - ui.add_sized( - [width, text_edit], - egui::Slider::new(&mut self.manual_slider_amount, 0.0..=(hashrate_xmrig as f64)).max_decimals(3) - ).on_hover_text(slider_help_text); + ui.horizontal(|ui| { + ui.spacing_mut().slider_width = width * 0.5; + ui.add_sized( + [width, text_edit], + egui::Slider::new(&mut self.manual_slider_amount, 0.0..=(hashrate_xmrig as f64)).max_decimals(3) + ).on_hover_text(slider_help_text); - if ui.add(egui::SelectableLabel::new(self.manual_donation_metric == ManualDonationMetric::Hash, "H/s")).clicked() { - self.manual_donation_metric = ManualDonationMetric::Hash; - self.manual_slider_amount = self.manual_amount_raw; - } - if ui.add(egui::SelectableLabel::new(self.manual_donation_metric == ManualDonationMetric::Kilo, "kH/s")).clicked() { - self.manual_donation_metric = ManualDonationMetric::Kilo; - self.manual_slider_amount = self.manual_amount_raw / 1000.0; - }; - if ui.add(egui::SelectableLabel::new(self.manual_donation_metric == ManualDonationMetric::Mega, "MH/s")).clicked() { - self.manual_donation_metric = ManualDonationMetric::Mega; - self.manual_slider_amount = self.manual_amount_raw / 1_000_000.0; - }; - }); + if ui.add(egui::SelectableLabel::new(self.manual_donation_metric == ManualDonationMetric::Hash, "H/s")).clicked() { + self.manual_donation_metric = ManualDonationMetric::Hash; + self.manual_slider_amount = self.manual_amount_raw; + } + if ui.add(egui::SelectableLabel::new(self.manual_donation_metric == ManualDonationMetric::Kilo, "KH/s")).clicked() { + self.manual_donation_metric = ManualDonationMetric::Kilo; + self.manual_slider_amount = self.manual_amount_raw / 1000.0; + }; + if ui.add(egui::SelectableLabel::new(self.manual_donation_metric == ManualDonationMetric::Mega, "MH/s")).clicked() { + self.manual_donation_metric = ManualDonationMetric::Mega; + self.manual_slider_amount = self.manual_amount_raw / 1_000_000.0; + }; }); }