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

ListItem's collapsing triangle is now styled consistently with the rest of the item #5354

Merged
merged 2 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 13 additions & 5 deletions crates/re_ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,12 @@ impl ReUi {
);

let icon_response = header_response.clone().with_new_rect(icon_rect);
Self::paint_collapsing_triangle(ui, openness, icon_rect.center(), &icon_response);
Self::paint_collapsing_triangle(
ui,
openness,
icon_rect.center(),
ui.style().interact(&icon_response),
);
}

ui.painter().galley(text_pos, galley, visuals.text_color());
Expand Down Expand Up @@ -810,7 +815,12 @@ impl ReUi {
egui::Vec2::splat(icon_width),
);
let icon_response = header_response.clone().with_new_rect(icon_rect);
Self::paint_collapsing_triangle(ui, openness, icon_rect.center(), &icon_response);
Self::paint_collapsing_triangle(
ui,
openness,
icon_rect.center(),
ui.style().interact(&icon_response),
);

let visuals = ui.style().interact(&header_response);

Expand Down Expand Up @@ -862,10 +872,8 @@ impl ReUi {
ui: &egui::Ui,
openness: f32,
center: egui::Pos2,
response: &egui::Response,
visuals: &egui::style::WidgetVisuals,
) {
let visuals = ui.style().interact(response);

// This value is hard coded because, from a UI perspective, the size of the triangle is
// given and fixed, and shouldn't vary based on the area it's in.
static TRIANGLE_SIZE: f32 = 8.0;
Expand Down
7 changes: 1 addition & 6 deletions crates/re_ui/src/list_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,7 @@ impl<'a> ListItem<'a> {
id.unwrap_or(ui.id()).with("collapsing_triangle"),
egui::Sense::click(),
);
ReUi::paint_collapsing_triangle(
ui,
openness,
triangle_rect.center(),
&triangle_response,
);
ReUi::paint_collapsing_triangle(ui, openness, triangle_rect.center(), &visuals);
collapse_response = Some(triangle_response);
}

Expand Down