Skip to content

Commit 17d450a

Browse files
authored
Show data density graph in collapsed time panel (#8137)
### What ![image](https://github.com/user-attachments/assets/fcb58ca4-9908-46e8-b29b-6b2704c04ba4) ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested the web demo (if applicable): * Using examples from latest `main` build: [rerun.io/viewer](https://rerun.io/viewer/pr/8137?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [rerun.io/viewer](https://rerun.io/viewer/pr/8137?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG * [x] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)! * [x] If have noted any breaking changes to the log API in `CHANGELOG.md` and the migration guide - [PR Build Summary](https://build.rerun.io/pr/8137) - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html) To run all checks from `main`, comment on the PR with `@rerun-bot full-check`. To deploy documentation changes immediately after merging this PR, add the `deploy docs` label.
1 parent a6f0f4f commit 17d450a

File tree

1 file changed

+32
-6
lines changed
  • crates/viewer/re_time_panel/src

1 file changed

+32
-6
lines changed

crates/viewer/re_time_panel/src/lib.rs

+32-6
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ impl TimePanel {
158158
return;
159159
}
160160

161+
self.data_density_graph_painter.begin_frame(ui.ctx());
162+
161163
// Naturally, many parts of the time panel need the time control.
162164
// Copy it once, read/edit, and then write back at the end if there was a change.
163165
let time_ctrl_before = rec_cfg.time_ctrl.read().clone();
@@ -298,7 +300,13 @@ impl TimePanel {
298300
entity_db.times_per_timeline(),
299301
ui,
300302
);
301-
collapsed_time_marker_and_time(ui, ctx, entity_db, time_ctrl);
303+
collapsed_time_marker_and_time(
304+
ui,
305+
ctx,
306+
&mut self.data_density_graph_painter,
307+
entity_db,
308+
time_ctrl,
309+
);
302310
});
303311
});
304312
} else {
@@ -318,7 +326,13 @@ impl TimePanel {
318326
self.time_control_ui.fps_ui(time_ctrl, ui);
319327
}
320328

321-
collapsed_time_marker_and_time(ui, ctx, entity_db, time_ctrl);
329+
collapsed_time_marker_and_time(
330+
ui,
331+
ctx,
332+
&mut self.data_density_graph_painter,
333+
entity_db,
334+
time_ctrl,
335+
);
322336
}
323337
}
324338

@@ -332,8 +346,6 @@ impl TimePanel {
332346
) {
333347
re_tracing::profile_function!();
334348

335-
self.data_density_graph_painter.begin_frame(ui.ctx());
336-
337349
// |timeline |
338350
// ------------------------------------
339351
// tree |streams |
@@ -983,6 +995,7 @@ fn highlight_timeline_row(
983995
fn collapsed_time_marker_and_time(
984996
ui: &mut egui::Ui,
985997
ctx: &ViewerContext<'_>,
998+
data_density_graph_painter: &mut data_density_graph::DataDensityGraphPainter,
986999
entity_db: &re_entity_db::EntityDb,
9871000
time_ctrl: &mut TimeControl,
9881001
) {
@@ -1005,6 +1018,8 @@ fn collapsed_time_marker_and_time(
10051018
time_range_rect.max.x -= space_needed_for_current_time;
10061019

10071020
if time_range_rect.width() > 50.0 {
1021+
ui.allocate_rect(time_range_rect, egui::Sense::hover());
1022+
10081023
let time_ranges_ui =
10091024
initialize_time_ranges_ui(entity_db, time_ctrl, time_range_rect.x_range(), None);
10101025
time_ranges_ui.snap_time_control(time_ctrl);
@@ -1025,6 +1040,19 @@ fn collapsed_time_marker_and_time(
10251040
time_range_rect.center().y,
10261041
ui.visuals().widgets.noninteractive.fg_stroke,
10271042
);
1043+
1044+
data_density_graph::data_density_graph_ui(
1045+
data_density_graph_painter,
1046+
ctx,
1047+
time_ctrl,
1048+
entity_db,
1049+
ui.painter(),
1050+
ui,
1051+
&time_ranges_ui,
1052+
time_range_rect.shrink2(egui::vec2(0.0, 10.0)),
1053+
&TimePanelItem::entity_path(EntityPath::root()),
1054+
);
1055+
10281056
time_marker_ui(
10291057
&time_ranges_ui,
10301058
time_ctrl,
@@ -1033,8 +1061,6 @@ fn collapsed_time_marker_and_time(
10331061
&painter,
10341062
&time_range_rect,
10351063
);
1036-
1037-
ui.allocate_rect(time_range_rect, egui::Sense::hover());
10381064
}
10391065
}
10401066

0 commit comments

Comments
 (0)