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

Show data density graph in collapsed time panel #8137

Merged
merged 4 commits into from
Nov 14, 2024
Merged
Changes from 2 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
34 changes: 30 additions & 4 deletions crates/viewer/re_time_panel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,13 @@ impl TimePanel {
entity_db.times_per_timeline(),
ui,
);
collapsed_time_marker_and_time(ui, ctx, entity_db, time_ctrl);
collapsed_time_marker_and_time(
ui,
ctx,
&mut self.data_density_graph_painter,
entity_db,
time_ctrl,
);
});
});
} else {
Expand All @@ -318,7 +324,13 @@ impl TimePanel {
self.time_control_ui.fps_ui(time_ctrl, ui);
}

collapsed_time_marker_and_time(ui, ctx, entity_db, time_ctrl);
collapsed_time_marker_and_time(
ui,
ctx,
&mut self.data_density_graph_painter,
entity_db,
time_ctrl,
);
}
}

Expand Down Expand Up @@ -983,6 +995,7 @@ fn highlight_timeline_row(
fn collapsed_time_marker_and_time(
ui: &mut egui::Ui,
ctx: &ViewerContext<'_>,
data_density_graph_painter: &mut data_density_graph::DataDensityGraphPainter,
entity_db: &re_entity_db::EntityDb,
time_ctrl: &mut TimeControl,
) {
Expand All @@ -1005,6 +1018,8 @@ fn collapsed_time_marker_and_time(
time_range_rect.max.x -= space_needed_for_current_time;

if time_range_rect.width() > 50.0 {
ui.allocate_rect(time_range_rect, egui::Sense::hover());

let time_ranges_ui =
initialize_time_ranges_ui(entity_db, time_ctrl, time_range_rect.x_range(), None);
time_ranges_ui.snap_time_control(time_ctrl);
Expand All @@ -1025,6 +1040,19 @@ fn collapsed_time_marker_and_time(
time_range_rect.center().y,
ui.visuals().widgets.noninteractive.fg_stroke,
);

data_density_graph::data_density_graph_ui(
data_density_graph_painter,
ctx,
time_ctrl,
entity_db,
ui.painter(),
ui,
&time_ranges_ui,
time_range_rect.shrink2(egui::vec2(0.0, 8.0)),
&TimePanelItem::entity_path(EntityPath::root()),
);

time_marker_ui(
&time_ranges_ui,
time_ctrl,
Expand All @@ -1033,8 +1061,6 @@ fn collapsed_time_marker_and_time(
&painter,
&time_range_rect,
);

ui.allocate_rect(time_range_rect, egui::Sense::hover());
}
}

Expand Down
Loading