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: always auto-layout spaceviews until the user interveens #2583

Merged
merged 2 commits into from
Jul 3, 2023
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
19 changes: 13 additions & 6 deletions crates/re_viewport/src/viewport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,14 +443,21 @@ impl Viewport {

self.space_views.insert(space_view_id, space_view);

if let Some(root_id) = self.tree.root {
if self.has_been_user_edited {
// Try to insert it in the tree, in the top level:
let tile_id = self.tree.tiles.insert_pane(space_view_id);
if let Some(egui_tiles::Tile::Container(container)) = self.tree.tiles.get_mut(root_id) {
container.add_child(tile_id);
} else {
self.tree = Default::default(); // we'll just re-initialize later instead
if let Some(root_id) = self.tree.root {
let tile_id = self.tree.tiles.insert_pane(space_view_id);
if let Some(egui_tiles::Tile::Container(container)) =
self.tree.tiles.get_mut(root_id)
{
container.add_child(tile_id);
} else {
self.tree = Default::default(); // we'll just re-initialize later instead
}
}
} else {
// Re-run the auto-layout next frame:
self.tree = Default::default();
}

space_view_id
Expand Down