Skip to content

Commit

Permalink
Filter entities in the UI (part 7): Refactor and optimize `re_time_pa…
Browse files Browse the repository at this point in the history
…nel` and add more tests (#8863)
  • Loading branch information
abey79 authored Jan 30, 2025
1 parent f51085f commit ceafc87
Show file tree
Hide file tree
Showing 16 changed files with 493 additions and 260 deletions.
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6570,6 +6570,7 @@ dependencies = [
"re_viewer_context",
"re_viewport_blueprint",
"serde",
"smallvec",
"vec1",
]

Expand Down
3 changes: 1 addition & 2 deletions crates/viewer/re_data_ui/src/item_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,7 @@ pub fn instance_path_icon(
if db
.storage_engine()
.store()
.all_components_on_timeline(timeline, &instance_path.entity_path)
.is_some()
.entity_has_data_on_timeline(timeline, &instance_path.entity_path)
{
&icons::ENTITY
} else {
Expand Down
1 change: 1 addition & 0 deletions crates/viewer/re_time_panel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ itertools.workspace = true
nohash-hasher.workspace = true
once_cell.workspace = true
serde.workspace = true
smallvec.workspace = true
vec1.workspace = true

[dev-dependencies]
Expand Down
11 changes: 2 additions & 9 deletions crates/viewer/re_time_panel/src/data_density_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
//! The data density is the number of data points per unit of time.
//! We collect this into a histogram, blur it, and then paint it.
use std::ops::RangeInclusive;
use std::sync::Arc;

use egui::emath::Rangef;
Expand Down Expand Up @@ -211,7 +210,6 @@ impl DensityGraph {
y_range: Rangef,
painter: &egui::Painter,
full_color: Color32,
hovered_x_range: RangeInclusive<f32>,
) {
re_tracing::profile_function!();

Expand Down Expand Up @@ -270,11 +268,8 @@ impl DensityGraph {
let inner_radius =
(max_radius * normalized_density).at_least(MIN_RADIUS) - feather_radius;

let inner_color = if hovered_x_range.contains(&x) {
Color32::WHITE
} else {
full_color.gamma_multiply(lerp(0.5..=1.0, normalized_density))
};
let inner_color = full_color.gamma_multiply(lerp(0.5..=1.0, normalized_density));

(inner_radius, inner_color)
};
let outer_radius = inner_radius + feather_radius;
Expand Down Expand Up @@ -417,8 +412,6 @@ pub fn data_density_graph_ui(
row_rect.y_range(),
time_area_painter,
graph_color(ctx, &item.to_item(), ui),
// TODO(jprochazk): completely remove `hovered_x_range` and associated code from painter
0f32..=0f32,
);

if tooltips_enabled {
Expand Down
Loading

0 comments on commit ceafc87

Please sign in to comment.