From a9c4381c942f6587d04592cf11212d2c5ac5f4a6 Mon Sep 17 00:00:00 2001 From: mostafaei2002 Date: Tue, 11 Jun 2024 15:05:19 +0330 Subject: [PATCH] fix: don't change metric if already selected --- src/app/panels/middle/xvb.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/panels/middle/xvb.rs b/src/app/panels/middle/xvb.rs index 7998865..b29d88f 100644 --- a/src/app/panels/middle/xvb.rs +++ b/src/app/panels/middle/xvb.rs @@ -195,11 +195,15 @@ impl crate::disk::state::Xvb { egui::Slider::new(&mut self.amount, 0.0..=(hashrate_xmrig as f64)) ).on_hover_text(slider_help_text); - if ui.add(egui::SelectableLabel::new(self.manual_donation_metric == ManualDonationMetric::Hash, "H/s")).clicked() { + if ui.add(egui::SelectableLabel::new(self.manual_donation_metric == ManualDonationMetric::Hash, "H/s")).clicked() && + self.manual_donation_metric != ManualDonationMetric::Hash + { self.amount *= 1000.0; self.manual_donation_metric = ManualDonationMetric::Hash; } - if ui.add(egui::SelectableLabel::new(self.manual_donation_metric == ManualDonationMetric::Kilo, "kH/s")).clicked() { + if ui.add(egui::SelectableLabel::new(self.manual_donation_metric == ManualDonationMetric::Kilo, "kH/s")).clicked() && + self.manual_donation_metric != ManualDonationMetric::Kilo + { self.amount /= 1000.0; self.manual_donation_metric = ManualDonationMetric::Kilo; };