Skip to content

Commit cc494c8

Browse files
committed
Structure the code better, with improved comments
1 parent 6503ce0 commit cc494c8

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

crates/viewer/re_space_view_spatial/src/view_2d.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,16 @@ fn recommended_space_views_with_image_splits(
389389
&re_types::archetypes::AssetVideo::indicator().name(),
390390
);
391391

392-
if found_image_dimensions.len() > 1 || image_count > 1 || depth_count > 1 || video_count > 1 {
392+
let all_have_same_size = found_image_dimensions.len() <= 1;
393+
394+
// NOTE: we allow stacking segmentation images, since that can be quite useful sometimes.
395+
let overlap = all_have_same_size && image_count + video_count <= 1 && depth_count <= 1;
396+
397+
if overlap {
398+
// If there are multiple images of the same size but of different types, then we can overlap them on top of each other.
399+
// This can be useful for comparing a segmentation image on top of an RGB image, for instance.
400+
recommended.push(RecommendedSpaceView::new_subtree(recommended_root.clone()));
401+
} else {
393402
// Split the space and recurse
394403

395404
// If the root also had a visualizable entity, give it its own space.
@@ -418,8 +427,5 @@ fn recommended_space_views_with_image_splits(
418427
);
419428
}
420429
}
421-
} else {
422-
// Otherwise we can use the space as it is.
423-
recommended.push(RecommendedSpaceView::new_subtree(recommended_root.clone()));
424430
}
425431
}

0 commit comments

Comments
 (0)