Skip to content

Commit fd4f9b1

Browse files
authored
Move side-panels margins inside of their ScrollAreas (#4340)
### What This PR changes the way inner margins and `ScrollAreas` are nested to avoid some visual issues. - Fixes #3165 - Fixes full span display bug: #4324 (comment) ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/4340) (if applicable) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG - [PR Build Summary](https://build.rerun.io/pr/4340) - [Docs preview](https://rerun.io/preview/71996e8cabf9dc864f4d7240779b3271472876c3/docs) <!--DOCS-PREVIEW--> - [Examples preview](https://rerun.io/preview/71996e8cabf9dc864f4d7240779b3271472876c3/examples) <!--EXAMPLES-PREVIEW--> - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
1 parent e6e2a90 commit fd4f9b1

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

crates/re_viewer/src/ui/blueprint_panel.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ pub fn blueprint_panel_ui(
1818
reset_button_ui(blueprint, ctx, ui, spaces_info);
1919
},
2020
);
21-
22-
blueprint.tree_ui(ctx, ui);
2321
});
22+
23+
// This call is excluded from `panel_content` because it has a ScrollArea, which should not be
24+
// inset. Instead, it calls panel_content itself inside the ScrollArea.
25+
blueprint.tree_ui(ctx, ui);
2426
}
2527

2628
fn reset_button_ui(

crates/re_viewer/src/ui/selection_panel.rs

+14-10
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,9 @@ impl SelectionPanel {
5757
// enclosing frame doesn't have inner margins.
5858
ui.set_clip_rect(ui.max_rect());
5959

60-
egui::Frame {
61-
inner_margin: re_ui::ReUi::panel_margin(),
62-
..Default::default()
63-
}
64-
.show(ui, |ui| {
65-
let hover = "The Selection View contains information and options about the currently selected object(s)";
60+
ctx.re_ui.panel_content(ui, |_, ui| {
61+
let hover = "The Selection View contains information and options about the \
62+
currently selected object(s)";
6663
ctx.re_ui
6764
.panel_title_bar_with_buttons(ui, "Selection", Some(hover), |ui| {
6865
if let Some(selection) = self.selection_state_ui.selection_ui(
@@ -75,13 +72,20 @@ impl SelectionPanel {
7572
.set_selection(selection.iter().cloned());
7673
}
7774
});
75+
});
76+
77+
// move the vertical spacing between the title and the content to _inside_ the scroll
78+
// area
79+
ui.add_space(-ui.spacing().item_spacing.y);
7880

79-
egui::ScrollArea::both()
80-
.auto_shrink([false; 2])
81-
.show(ui, |ui| {
81+
egui::ScrollArea::both()
82+
.auto_shrink([false; 2])
83+
.show(ui, |ui| {
84+
ui.add_space(ui.spacing().item_spacing.y);
85+
ctx.re_ui.panel_content(ui, |_, ui| {
8286
self.contents(ctx, ui, viewport);
8387
});
84-
});
88+
});
8589
});
8690
}
8791

crates/re_viewport/src/viewport_blueprint_ui.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ impl ViewportBlueprint<'_> {
2222
.id_source("blueprint_tree_scroll_area")
2323
.auto_shrink([true, false])
2424
.show(ui, |ui| {
25-
if let Some(root) = self.tree.root() {
26-
self.tile_ui(ctx, ui, root);
27-
}
25+
ctx.re_ui.panel_content(ui, |_, ui| {
26+
if let Some(root) = self.tree.root() {
27+
self.tile_ui(ctx, ui, root);
28+
}
29+
});
2830
});
2931

3032
let TreeActions { focus_tab, remove } = std::mem::take(&mut self.deferred_tree_actions);

0 commit comments

Comments
 (0)