Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix welcome screen header jumping during load #6389

Merged
merged 1 commit into from
May 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 23 additions & 29 deletions crates/re_viewer/src/ui/welcome_screen/example_section.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,35 +251,6 @@ impl ExampleSection {
.examples
.get_or_insert_with(|| load_manifest(ui.ctx(), self.manifest_url.clone()));

let Some(examples) = examples.ready_mut() else {
// Still waiting for example to load

header_ui(ui); // Always show the header

ui.separator();

ui.spinner(); // Placeholder for the examples
return;
};

let examples = match examples {
Ok(examples) => examples,
Err(err) => {
// Examples failed to load.

header_ui(ui); // Always show the header

re_log::warn_once!("Failed to load examples: {err}");

return;
}
};

if examples.is_empty() {
ui.label("No examples found.");
return;
}

// vertical spacing isn't homogeneous so it's handled manually
let grid_spacing = egui::vec2(COLUMN_HSPACE, 0.0);
let column_count = (((ui.available_width() + grid_spacing.x)
Expand All @@ -303,6 +274,29 @@ impl ExampleSection {
ui.vertical(|ui| {
header_ui(ui);

let Some(examples) = examples.ready_mut() else {
// Still waiting for example to load
ui.separator();

ui.spinner(); // Placeholder for the examples
return;
};

let examples = match examples {
Ok(examples) => examples,
Err(err) => {
// Examples failed to load.
re_log::warn_once!("Failed to load examples: {err}");

return;
}
};

if examples.is_empty() {
ui.label("No examples found.");
return;
}

ui.add(egui::Label::new(
egui::RichText::new("View example recordings")
.strong()
Expand Down
Loading