Skip to content

Commit

Permalink
Fix a Visible History UI display bug with +/-inf boundaries (sequence…
Browse files Browse the repository at this point in the history
… only) (#4276)

### What

As title says ☝🏻 

Also clarified a couple of hover text regarding what data might be
displayed.

### 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 [demo.rerun.io](https://demo.rerun.io/pr/4276) (if
applicable)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG

- [PR Build Summary](https://build.rerun.io/pr/4276)
- [Docs
preview](https://rerun.io/preview/c393e948b8bf4f3c68a6c877f792fb79c0d08cc2/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/c393e948b8bf4f3c68a6c877f792fb79c0d08cc2/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
  • Loading branch information
abey79 authored Nov 21, 2023
1 parent b672e03 commit 589555b
Showing 1 changed file with 24 additions and 40 deletions.
64 changes: 24 additions & 40 deletions crates/re_viewer/src/ui/visible_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ pub fn visible_history_ui(

collapsing_response.header_response.on_hover_text(
"Controls the time range used to display data in the Space View.\n\n\
Note that the data immediately preceding the time range is always displayed.",
Note that the data current as of the time range starting time is included.",
);
}

Expand All @@ -250,49 +250,33 @@ fn current_range_ui(
let from = visible_history.from(current_time.into());
let to = visible_history.to(current_time.into());

let (label_text, hover_text) = if is_sequence_timeline {
if from == to {
(
format!("Showing last data before frame #{}", from.as_i64()),
None,
)
} else {
(
format!(
"Showing data between frames #{:?} and #{:?}.",
visible_history.from(current_time.into()).as_i64(),
visible_history.to(current_time.into()).as_i64()
),
Some("This may include the last data logged before the starting frame"),
)
}
let (time_type, quantity_name) = if is_sequence_timeline {
(TimeType::Sequence, "frame")
} else {
let time_type = TimeType::Time;
let from_formatted = time_type.format(
visible_history.from(current_time.into()),
ctx.app_options.time_zone_for_timestamps,
);
(TimeType::Time, "time")
};

if from == to {
(format!("Showing last data before {from_formatted}"), None)
} else {
(
format!(
"Showing data between {from_formatted} and {}.",
time_type.format(
visible_history.to(current_time.into()),
ctx.app_options.time_zone_for_timestamps
)
),
Some("This may include the last data logged before the starting time."),
let from_formatted = time_type.format(
visible_history.from(current_time.into()),
ctx.app_options.time_zone_for_timestamps,
);

if from == to {
ui.label(format!(
"Showing last data logged on or before {quantity_name} {from_formatted}"
));
} else {
ui.label(format!(
"Showing data between {quantity_name}s {from_formatted} and {}.",
time_type.format(
visible_history.to(current_time.into()),
ctx.app_options.time_zone_for_timestamps
)
}
))
.on_hover_text(format!(
"This includes the data current as of the starting {quantity_name}."
));
};

let resp = ui.label(label_text);
if let Some(hover_text) = hover_text {
resp.on_hover_text(hover_text);
}
}

#[allow(clippy::too_many_arguments)]
Expand Down

0 comments on commit 589555b

Please sign in to comment.