Skip to content

Commit

Permalink
Collapsing if
Browse files Browse the repository at this point in the history
  • Loading branch information
notdanilo committed Oct 26, 2023
1 parent c422ba7 commit 582a304
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions tools/editor/src/gui/ui/utils/optional_field/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ impl OptionalField {
}

pub fn show<T: Default>(&mut self, ui: &mut egui::Ui, mut optional: &mut Option<T>, mut show: impl FnMut(&mut egui::Ui, &mut T)) {
if self.editable {
if ui.add(Button::new(&self.text)).clicked() {
*optional = if optional.is_some() {
None
} else {
Some(Default::default())
}
if self.editable && ui.add(Button::new(&self.text)).clicked() {
*optional = if optional.is_some() {
None
} else {
Some(Default::default())
}
}
if let Some(optional) = &mut optional {
Expand Down

0 comments on commit 582a304

Please sign in to comment.