From 696ea49a200bfd08ec60d36d4b7b58a0d06716d6 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Mon, 4 Nov 2024 12:53:27 +0100 Subject: [PATCH] hover tooltips --- .../src/decode/async_decoder_wrapper.rs | 2 +- crates/viewer/re_data_ui/src/video.rs | 28 +++++++++++++------ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/crates/store/re_video/src/decode/async_decoder_wrapper.rs b/crates/store/re_video/src/decode/async_decoder_wrapper.rs index 8bfac6842fb4..546a5cbffa2a 100644 --- a/crates/store/re_video/src/decode/async_decoder_wrapper.rs +++ b/crates/store/re_video/src/decode/async_decoder_wrapper.rs @@ -73,7 +73,7 @@ impl AsyncDecoderWrapper { let comms = Comms::default(); let thread = std::thread::Builder::new() - .name(format!("decoer thread for {debug_name}")) + .name(format!("decoder of {debug_name}")) .spawn({ let comms = comms.clone(); move || { diff --git a/crates/viewer/re_data_ui/src/video.rs b/crates/viewer/re_data_ui/src/video.rs index bc9724923094..2cd4c69a4eea 100644 --- a/crates/viewer/re_data_ui/src/video.rs +++ b/crates/viewer/re_data_ui/src/video.rs @@ -198,24 +198,36 @@ fn frame_info_ui(ui: &mut egui::Ui, frame_info: &FrameInfo, timescale: re_video: let time_range = frame_info.time_range(); ui.list_item_flat_noninteractive(PropertyContent::new("Time range").value_text(format!( "{} - {}", - re_format::format_timestamp_seconds(time_range.start.into_secs(timescale),), - re_format::format_timestamp_seconds(time_range.end.into_secs(timescale),), + re_format::format_timestamp_seconds(time_range.start.into_secs(timescale)), + re_format::format_timestamp_seconds(time_range.end.into_secs(timescale)), ))) .on_hover_text("Time range in which this frame is valid."); - ui.list_item_flat_noninteractive( - PropertyContent::new("PTS").value_text(frame_info.presentation_timestamp.0.to_string()), - ) - .on_hover_text("Raw presentation timestamp prior to applying the timescale.\n\ - This specifies the time at which the frame should be shown relative to the start of a video stream."); + fn value_fn_for_time( + time: re_video::Time, + timescale: re_video::Timescale, + ) -> impl FnOnce(&mut egui::Ui, egui::style::WidgetVisuals) { + move |ui, _| { + ui.add(egui::Label::new(time.0.to_string()).truncate()) + .on_hover_text(re_format::format_timestamp_seconds( + time.into_secs(timescale), + )); + } + } if let Some(dts) = frame_info.latest_decode_timestamp { ui.list_item_flat_noninteractive( - PropertyContent::new("DTS").value_text(dts.0.to_string()), + PropertyContent::new("DTS").value_fn(value_fn_for_time(dts, timescale)), ) .on_hover_text("Raw decode timestamp prior to applying the timescale.\n\ If a frame is made up of multiple chunks, this is the last decode timestamp that was needed to decode the frame."); } + + ui.list_item_flat_noninteractive( + PropertyContent::new("PTS").value_fn(value_fn_for_time(frame_info.presentation_timestamp, timescale)), + ) + .on_hover_text("Raw presentation timestamp prior to applying the timescale.\n\ + This specifies the time at which the frame should be shown relative to the start of a video stream."); } fn source_image_data_format_ui(ui: &mut egui::Ui, format: &SourceImageDataFormat) {