Skip to content

Commit

Permalink
Do not emit changed responses on unchanged values in selectable_value…
Browse files Browse the repository at this point in the history
…/radio_value (emilk#2343)
  • Loading branch information
xTibor authored and JohannesProgrammiert committed Jan 21, 2023
1 parent d2d0488 commit 474ebf0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/egui/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit 474ebf0

Please sign in to comment.