mirror of
https://github.com/storytold/egui.git
synced 2026-11-23 02:52:15 +01:00
mark the response of a toggle_value as changed on click (#1573)
This commit is contained in:
1 parent
d3af3a6de1
commit
1dd014cbed
1 file changed
+2
-1
+2
-1
@@ -1381,9 +1381,10 @@ impl Ui {
|
||||
///
|
||||
/// See also [`Self::checkbox`].
|
||||
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() {
|
||||
*selected = !*selected;
|
||||
response.mark_changed();
|
||||
}
|
||||
response
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user