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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
2 deletions
-
crates/egui/src/ui.rs
|
|
@ -1447,7 +1447,7 @@ impl Ui { |
|
|
|
text: impl Into<WidgetText>, |
|
|
|
) -> Response { |
|
|
|
let mut response = self.radio(*current_value == alternative, text); |
|
|
|
if response.clicked() { |
|
|
|
if response.clicked() && *current_value != alternative { |
|
|
|
*current_value = alternative; |
|
|
|
response.mark_changed(); |
|
|
|
} |
|
|
@ -1475,7 +1475,7 @@ impl Ui { |
|
|
|
text: impl Into<WidgetText>, |
|
|
|
) -> Response { |
|
|
|
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; |
|
|
|
response.mark_changed(); |
|
|
|
} |
|
|
|