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

Fix a Visible History UI display bug with +/-inf boundaries (sequence only) #4276

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Changes from all 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
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
Loading