Skip to content

Commit 76ac41f

Browse files
committed
WidgetGallery: hide spinner widget to save CPU in reactive mode
1 parent 9df0c68 commit 76ac41f

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

egui_demo_lib/src/apps/demo/widget_gallery.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,11 @@ impl WidgetGallery {
208208
ui.add(doc_link_label("CollapsingHeader", "collapsing"));
209209
ui.collapsing("Click to see what is hidden!", |ui| {
210210
ui.horizontal_wrapped(|ui| {
211-
ui.label(
212-
"Not much, as it turns out - but here is a gold star for you for checking:",
213-
);
214-
ui.colored_label(egui::Color32::GOLD, "☆");
211+
ui.spacing_mut().item_spacing.x = 0.0;
212+
ui.label("It's a ");
213+
ui.add(doc_link_label("Spinner", "spinner"));
214+
ui.add_space(4.0);
215+
ui.add(egui::Spinner::new());
215216
});
216217
});
217218
ui.end_row();
@@ -229,10 +230,6 @@ impl WidgetGallery {
229230
This toggle switch is just 15 lines of code.",
230231
);
231232
ui.end_row();
232-
233-
ui.add(doc_link_label("Spinner", "spinner"));
234-
ui.add(egui::Spinner::new());
235-
ui.end_row();
236233
}
237234
}
238235

0 commit comments

Comments
 (0)