Browse Source

Do not emit changed responses on unchanged values in selectable_value/radio_value (#2343)

pull/2345/head
Nagy Tibor 2 years ago
committed by GitHub
parent
commit
502e1aa229
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      crates/egui/src/ui.rs

4
crates/egui/src/ui.rs

@ -1447,7 +1447,7 @@ impl Ui {
text: impl Into<WidgetText>, text: impl Into<WidgetText>,
) -> Response { ) -> Response {
let mut response = self.radio(*current_value == alternative, text); let mut response = self.radio(*current_value == alternative, text);
if response.clicked() { if response.clicked() && *current_value != alternative {
*current_value = alternative; *current_value = alternative;
response.mark_changed(); response.mark_changed();
} }
@ -1475,7 +1475,7 @@ impl Ui {
text: impl Into<WidgetText>, text: impl Into<WidgetText>,
) -> Response { ) -> Response {
let mut response = self.selectable_label(*current_value == selected_value, text); let mut response = self.selectable_label(*current_value == selected_value, text);
if response.clicked() { if response.clicked() && *current_value != selected_value {
*current_value = selected_value; *current_value = selected_value;
response.mark_changed(); response.mark_changed();
} }

Loading…
Cancel
Save