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

Subdue container labels to distinguish them from space views #4855

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion crates/re_ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ pub enum LabelStyle {

/// Label displaying the placeholder text for a yet unnamed item (e.g. an unnamed space view).
Unnamed,

/// Label for containers, which are subdued compared to space views to make them distinctive
Container,
}

// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -925,7 +928,7 @@ impl ReUi {

let mut text: egui::WidgetText = text.into();
match style {
LabelStyle::Normal => {}
LabelStyle::Normal | LabelStyle::Container => {}
LabelStyle::Unnamed => {
// TODO(ab): use design tokens
text = text.italics();
Expand Down Expand Up @@ -991,6 +994,10 @@ impl ReUi {
// TODO(ab): use design tokens
text_color = text_color.gamma_multiply(0.5);
}
LabelStyle::Container => {
// TODO(ab): use design tokens
text_color = ui.visuals().widgets.noninteractive.text_color();
}
}
ui.painter()
.galley_with_override_text_color(text_pos, galley, text_color);
Expand Down
7 changes: 6 additions & 1 deletion crates/re_ui/src/list_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,11 @@ impl<'a> ListItem<'a> {
LabelStyle::Unnamed => {
self.italics = true;
}
LabelStyle::Container => {
self.text = self
.text
.color(ui.visuals().widgets.noninteractive.text_color());
}
}

if self.italics {
Expand Down Expand Up @@ -455,7 +460,7 @@ impl<'a> ListItem<'a> {
}

match self.label_style {
LabelStyle::Normal => {}
LabelStyle::Normal | LabelStyle::Container => {}
LabelStyle::Unnamed => {
self.text = self.text.color(visuals.fg_stroke.color.gamma_multiply(0.5));
}
Expand Down
1 change: 1 addition & 0 deletions crates/re_viewer/src/ui/selection_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,7 @@ fn show_list_item_for_container_child(
(
Item::Container(child_tile_id),
ListItem::new(ctx.re_ui, format!("{:?}", container.kind()))
.label_style(re_ui::LabelStyle::Container)
.with_icon(icon_for_container_kind(&container.kind())),
)
}
Expand Down
1 change: 1 addition & 0 deletions crates/re_viewport/src/viewport_blueprint_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ impl Viewport<'_, '_> {
let response = ListItem::new(ctx.re_ui, format!("{:?}", container.kind()))
.subdued(!container_visible)
.selected(ctx.selection().contains_item(&item))
.label_style(re_ui::LabelStyle::Container)
.with_icon(crate::icon_for_container_kind(&container.kind()))
.with_buttons(|re_ui, ui| {
let vis_response = visibility_button_ui(re_ui, ui, parent_visible, &mut visible);
Expand Down
Loading