mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 05:40:03 -04:00
mark the response of a toggle_value as changed on click (#1573)
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user