Skip to content

Commit

Permalink
debug_ui: Indent non-expandable items in object- and display trees
Browse files Browse the repository at this point in the history
  • Loading branch information
torokati44 authored and Dinnerbone committed Aug 2, 2023
1 parent 006393c commit 515df16
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
13 changes: 12 additions & 1 deletion core/src/debug_ui/display_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,18 @@ impl DisplayObjectWindow {
}
});
} else {
open_display_object_button(ui, context, messages, object, &mut self.hovered_debug_rect);
// This item is not expandable, but we want to keep
// the space empty where the expand button would be,
// so it doesn't look like a sibling of the parent.
ui.indent(ui.id().with(object.as_ptr()), |ui| {
open_display_object_button(
ui,
context,
messages,
object,
&mut self.hovered_debug_rect,
);
});
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion core/src/debug_ui/display_object/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ fn show_object_tree(
hovered_debug_rect: &mut Option<DisplayObjectHandle>,
) {
if tree.children.is_empty() {
show_item(ui, context, tree, messages, hovered_debug_rect);
// This item is not expandable, but we want to keep the space empty where the
// expand button would be, so it doesn't look like a sibling of the parent.
ui.indent(ui.id().with(tree.handle.as_ptr()), |ui| {
show_item(ui, context, tree, messages, hovered_debug_rect);
});
} else {
CollapsingState::load_with_default_open(ui.ctx(), ui.id().with(tree.handle.as_ptr()), true)
.show_header(ui, |ui| {
Expand Down

0 comments on commit 515df16

Please sign in to comment.