mark the response of a toggle_value as changed on click (#1573)
This commit is contained in:
parent
d3af3a6de1
commit
1dd014cbed
1 changed files with 2 additions and 1 deletions
|
@ -1381,9 +1381,10 @@ impl Ui {
|
||||||
///
|
///
|
||||||
/// See also [`Self::checkbox`].
|
/// See also [`Self::checkbox`].
|
||||||
pub fn toggle_value(&mut self, selected: &mut bool, text: impl Into<WidgetText>) -> Response {
|
pub fn toggle_value(&mut self, selected: &mut bool, text: impl Into<WidgetText>) -> Response {
|
||||||
let response = self.selectable_label(*selected, text);
|
let mut response = self.selectable_label(*selected, text);
|
||||||
if response.clicked() {
|
if response.clicked() {
|
||||||
*selected = !*selected;
|
*selected = !*selected;
|
||||||
|
response.mark_changed();
|
||||||
}
|
}
|
||||||
response
|
response
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue