Skip to content

Commit

Permalink
Move viewer's time panel to its own crate & show number of events on …
Browse files Browse the repository at this point in the history
…component hover in Streams (#2233)

Moves the time panel to a separate crate.

Slight ui changes on hover to untangle it from the selection panel:

<img width="345" alt="image"
src="https://github.com/rerun-io/rerun/assets/1220815/76aa2038-044f-4a0d-832e-ab94442cbd5b">

<img width="564" alt="image"
src="https://github.com/rerun-io/rerun/assets/1220815/ac4ee0bf-f7c9-4cde-8185-a01969ed1ae6">


### What

### 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)

<!-- This line will get updated when the PR build summary job finishes.
-->
PR Build Summary: https://build.rerun.io/pr/2233
  • Loading branch information
Wumpf authored May 29, 2023
1 parent c4373c6 commit 689ba96
Show file tree
Hide file tree
Showing 23 changed files with 175 additions and 109 deletions.
20 changes: 19 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ re_sdk_comms = { path = "crates/re_sdk_comms", version = "0.7.0-alpha.0", defaul
re_smart_channel = { path = "crates/re_smart_channel", version = "0.7.0-alpha.0", default-features = false }
re_string_interner = { path = "crates/re_string_interner", version = "0.7.0-alpha.0", default-features = false }
re_tensor_ops = { path = "crates/re_tensor_ops", version = "0.7.0-alpha.0", default-features = false }
re_time_panel = { path = "crates/re_time_panel", version = "=0.7.0-alpha.0", default-features = false }
re_tuid = { path = "crates/re_tuid", version = "0.7.0-alpha.0", default-features = false }
re_ui = { path = "crates/re_ui", version = "0.7.0-alpha.0", default-features = false }
re_viewer = { path = "crates/re_viewer", version = "0.7.0-alpha.0", default-features = false }
Expand Down
3 changes: 1 addition & 2 deletions crates/re_data_ui/src/instance_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ impl DataUi for InstancePath {
UiVerbosity::All => {}
}

item_ui::component_path_button_to(
item_ui::component_path_button(
ctx,
ui,
component_name.short_name(),
&ComponentPath::new(self.entity_path.clone(), component_name),
);

Expand Down
14 changes: 14 additions & 0 deletions crates/re_data_ui/src/item_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,20 @@ pub fn instance_path_button_to(
cursor_interact_with_selectable(ctx.selection_state_mut(), response, item)
}

/// Show a component path and make it selectable.
pub fn component_path_button(
ctx: &mut ViewerContext<'_>,
ui: &mut egui::Ui,
component_path: &ComponentPath,
) -> egui::Response {
component_path_button_to(
ctx,
ui,
component_path.component_name.short_name(),
component_path,
)
}

/// Show a component path and make it selectable.
pub fn component_path_button_to(
ctx: &mut ViewerContext<'_>,
Expand Down
33 changes: 33 additions & 0 deletions crates/re_time_panel/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[package]
authors.workspace = true
description = "The time panel of the Rerun Viewer, allowing to control the displayed timeline & time."
edition.workspace = true
homepage.workspace = true
license.workspace = true
name = "re_time_panel"
publish = true
readme = "README.md"
repository.workspace = true
rust-version.workspace = true
version.workspace = true
include = ["../../LICENSE-APACHE", "../../LICENSE-MIT", "**/*.rs", "Cargo.toml"]

[package.metadata.docs.rs]
all-features = true

[dependencies]
re_arrow_store.workspace = true
re_data_store.workspace = true
re_data_ui.workspace = true
re_log_types.workspace = true
re_ui.workspace = true
re_viewer_context.workspace = true

egui.workspace = true
itertools.workspace = true
serde = "1.0"
time.workspace = true
vec1 = "1.8"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
puffin.workspace = true
10 changes: 10 additions & 0 deletions crates/re_time_panel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# re_time_panel

Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates.

[![Latest version](https://img.shields.io/crates/v/re_data_ui.svg)](https://crates.io/crates/re_data_ui)
[![Documentation](https://docs.rs/re_data_ui/badge.svg)](https://docs.rs/re_data_ui)
![MIT](https://img.shields.io/badge/license-MIT-blue.svg)
![Apache](https://img.shields.io/badge/license-Apache-blue.svg)

The time panel of the Rerun Viewer, allowing to control the displayed timeline & time.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ use std::ops::RangeInclusive;
use egui::{epaint::Vertex, lerp, pos2, remap, Color32, NumExt as _, Rect, Shape};

use re_data_store::TimeHistogram;
use re_data_ui::DataUi;
use re_data_ui::{item_ui, DataUi};
use re_log_types::{TimeInt, TimeRange, TimeReal};
use re_viewer_context::{Item, UiVerbosity, ViewerContext};

use crate::ui::Blueprint;

use super::time_ranges_ui::TimeRangesUi;

// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -365,7 +363,6 @@ fn smooth(density: &[f32]) -> Vec<f32> {
pub fn data_density_graph_ui(
data_dentity_graph_painter: &mut DataDensityGraphPainter,
ctx: &mut ViewerContext<'_>,
blueprint: &mut Blueprint,
time_area_response: &egui::Response,
time_area_painter: &egui::Painter,
ui: &mut egui::Ui,
Expand Down Expand Up @@ -489,7 +486,6 @@ pub fn data_density_graph_ui(
} else if !ui.ctx().memory(|mem| mem.is_anything_being_dragged()) {
show_row_ids_tooltip(
ctx,
blueprint,
ui.ctx(),
&item,
hovered_time_range,
Expand Down Expand Up @@ -519,7 +515,6 @@ fn make_brighter(color: Color32) -> Color32 {

fn show_row_ids_tooltip(
ctx: &mut ViewerContext<'_>,
blueprint: &mut Blueprint,
egui_ctx: &egui::Context,
item: &Item,
time_range: TimeRange,
Expand All @@ -536,8 +531,19 @@ fn show_row_ids_tooltip(
ui.label(format!("{num_messages} messages"));
}

ui.add_space(8.0);
crate::ui::selection_panel::what_is_selected_ui(ui, ctx, blueprint, item);
match item {
Item::ComponentPath(path) => {
item_ui::component_path_button(ctx, ui, path);
}
Item::InstancePath(_, path) => {
item_ui::instance_path_button(ctx, ui, None, path);
}
Item::SpaceView(_) | Item::DataBlueprintGroup(_, _) => {
// No extra info. This should never happen, but not worth printing a warning over.
// Even if it does go here, the ui after will still look ok.
}
}

ui.add_space(8.0);

let timeline = *ctx.rec_cfg.time_ctrl.timeline();
Expand Down
File renamed without changes.
Loading

0 comments on commit 689ba96

Please sign in to comment.