Do not emit changed responses on unchanged values in selectable_value/radio_value (#2343)
This commit is contained in:
parent
f9066ff285
commit
502e1aa229
1 changed files with 2 additions and 2 deletions
|
@ -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…
Reference in a new issue