From 1a57030fee93cbb21143645bcebc4a0c00b7db6b Mon Sep 17 00:00:00 2001 From: Antoine Beyeler Date: Fri, 10 Jan 2025 18:02:51 +0100 Subject: [PATCH] fixed vertical alignment and updated test snapshots --- Cargo.lock | 1 - crates/viewer/re_time_panel/Cargo.toml | 3 ++- crates/viewer/re_time_panel/src/lib.rs | 6 +++++- .../re_time_panel/tests/snapshots/time_panel_dense_data.png | 4 ++-- .../tests/snapshots/time_panel_two_sections.png | 4 ++-- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b89fb005b90e..6938535c1872 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6426,7 +6426,6 @@ dependencies = [ "anyhow", "criterion", "egui", - "egui_kittest", "itertools 0.13.0", "nohash-hasher", "once_cell", diff --git a/crates/viewer/re_time_panel/Cargo.toml b/crates/viewer/re_time_panel/Cargo.toml index 307898a5982e..626c8fa8b575 100644 --- a/crates/viewer/re_time_panel/Cargo.toml +++ b/crates/viewer/re_time_panel/Cargo.toml @@ -41,9 +41,10 @@ serde.workspace = true vec1.workspace = true [dev-dependencies] +re_viewer_context = { workspace = true, features = ["testing"] } + anyhow.workspace = true criterion.workspace = true -egui_kittest.workspace = true rand.workspace = true [lib] diff --git a/crates/viewer/re_time_panel/src/lib.rs b/crates/viewer/re_time_panel/src/lib.rs index 0766882f467b..6543d561b7ce 100644 --- a/crates/viewer/re_time_panel/src/lib.rs +++ b/crates/viewer/re_time_panel/src/lib.rs @@ -444,11 +444,13 @@ impl TimePanel { let timeline_rect = { let top = ui.min_rect().bottom(); + ui.add_space(-4.0); // hack to vertically center the text + let size = egui::vec2(self.prev_col_width, 28.0); ui.allocate_ui_with_layout(size, egui::Layout::top_down(egui::Align::LEFT), |ui| { ui.set_min_size(size); ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend); - ui.add_space(4.0); // hack to vertically center the text + ui.spacing_mut().item_spacing.y = 0.0; ui.full_span_scope(0.0..=time_x_left, |ui| { self.filter_state.ui( @@ -461,6 +463,8 @@ impl TimePanel { .strong(), ); }); + + ui.add_space(2.0); // hack to vertically center the text }) .response .on_hover_text( diff --git a/crates/viewer/re_time_panel/tests/snapshots/time_panel_dense_data.png b/crates/viewer/re_time_panel/tests/snapshots/time_panel_dense_data.png index 0afc9600de09..2d30e99a20b8 100644 --- a/crates/viewer/re_time_panel/tests/snapshots/time_panel_dense_data.png +++ b/crates/viewer/re_time_panel/tests/snapshots/time_panel_dense_data.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f1ef5ede53c243b9d9986f4a502f3b232da202815a24a325bab737b07a69e64e -size 27223 +oid sha256:da37f484f89f6e385fadfc6ffcbd8d4119dcbc6236bf5f91d16cc711074d5189 +size 25965 diff --git a/crates/viewer/re_time_panel/tests/snapshots/time_panel_two_sections.png b/crates/viewer/re_time_panel/tests/snapshots/time_panel_two_sections.png index 857e28cef367..ef2c4cc7a969 100644 --- a/crates/viewer/re_time_panel/tests/snapshots/time_panel_two_sections.png +++ b/crates/viewer/re_time_panel/tests/snapshots/time_panel_two_sections.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:877df4e6bc5be8caa89fb5e721e32527701260ba249fa8313cb78d7828573be9 -size 32092 +oid sha256:7e2086ecac13e41e291aa7780e006faf05a9cc9e9f26c3410f67af152603c963 +size 32001