From 74e44db92e9a8bfc52caeb4a4248edd132108ab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Tue, 17 Dec 2024 09:09:05 +0100 Subject: [PATCH 1/5] Add `hover` and `click` to `TextDocumentView` --- .../re_view_text_document/src/view_class.rs | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/crates/viewer/re_view_text_document/src/view_class.rs b/crates/viewer/re_view_text_document/src/view_class.rs index 1715b5565ba4..31bedbdc97eb 100644 --- a/crates/viewer/re_view_text_document/src/view_class.rs +++ b/crates/viewer/re_view_text_document/src/view_class.rs @@ -1,10 +1,12 @@ use egui::Label; +use egui::Sense; use re_types::View; use re_types::ViewClassIdentifier; use re_ui::UiExt as _; use re_view::suggest_view_for_each_entity; +use re_viewer_context::Item; use re_viewer_context::{ external::re_log_types::EntityPath, ViewClass, ViewClassRegistryError, ViewId, ViewQuery, ViewState, ViewStateExt as _, ViewSystemExecutionError, ViewerContext, @@ -111,17 +113,16 @@ Displays text from a text component, as raw text or markdown." fn ui( &self, - _ctx: &ViewerContext<'_>, + ctx: &ViewerContext<'_>, ui: &mut egui::Ui, state: &mut dyn ViewState, - - _query: &ViewQuery<'_>, + query: &ViewQuery<'_>, system_output: re_viewer_context::SystemExecutionOutput, ) -> Result<(), ViewSystemExecutionError> { let state = state.downcast_mut::()?; let text_document = system_output.view_systems.get::()?; - egui::Frame { + let response = egui::Frame { inner_margin: re_ui::DesignTokens::view_padding().into(), ..egui::Frame::default() } @@ -176,7 +177,18 @@ Displays text from a text component, as raw text or markdown." }) }) .response - }); + }) + .response + .interact(Sense::click()); + + if response.hovered() { + ctx.selection_state().set_hovered(Item::View(query.view_id)); + } + + if response.clicked() { + ctx.selection_state() + .set_selection(Item::View(query.view_id)); + } Ok(()) } From 3d4ac8e9cd51bece300784bf02526757636d3536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Tue, 17 Dec 2024 09:14:41 +0100 Subject: [PATCH 2/5] Add `hover` to graph view --- crates/viewer/re_view_graph/src/view.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/viewer/re_view_graph/src/view.rs b/crates/viewer/re_view_graph/src/view.rs index b3227406cd51..53741b7175a7 100644 --- a/crates/viewer/re_view_graph/src/view.rs +++ b/crates/viewer/re_view_graph/src/view.rs @@ -206,6 +206,10 @@ Display a graph of nodes and edges. } }); + if resp.hovered() { + ctx.selection_state().set_hovered(Item::View(query.view_id)); + } + if resp.clicked() { // clicked elsewhere, select the view ctx.selection_state() From 1b81253c54f6e33ed73c016f788f2e8eee17422f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Tue, 17 Dec 2024 09:16:42 +0100 Subject: [PATCH 3/5] Add `hover` to map view --- crates/viewer/re_view_map/src/map_view.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/viewer/re_view_map/src/map_view.rs b/crates/viewer/re_view_map/src/map_view.rs index 7db8ad45dcf8..3a0f462a311e 100644 --- a/crates/viewer/re_view_map/src/map_view.rs +++ b/crates/viewer/re_view_map/src/map_view.rs @@ -499,6 +499,8 @@ fn handle_ui_interactions( // clicked elsewhere, select the view ctx.selection_state() .set_selection(Item::View(query.view_id)); + } else if map_response.hovered() { + ctx.selection_state().set_hovered(Item::View(query.view_id)); } } From 7cb851c5a894ded93f55796bac7fa857b6cbfaef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Tue, 17 Dec 2024 09:36:29 +0100 Subject: [PATCH 4/5] Add text and graphs to release checklist --- .../release_checklist/check_hover_select_reset.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/python/release_checklist/check_hover_select_reset.py b/tests/python/release_checklist/check_hover_select_reset.py index 4fd4821440e1..6d7dda4987d2 100644 --- a/tests/python/release_checklist/check_hover_select_reset.py +++ b/tests/python/release_checklist/check_hover_select_reset.py @@ -29,6 +29,13 @@ * If you think this is unexpected, create an issue. * Double-click the entity and verify that it becomes selected and highlighted in the blueprint tree. +### Graph Select +Should work just as 2D/3D views. + +### Text view +Clicking on a text view (what you're reading right now) should select the view. +Hovering the view should work as well. + ### Reset For each of the views: * Zoom and/or pan the view @@ -83,6 +90,10 @@ def log_points_2d() -> None: rr.log("2D/points", rr.Points2D(positions, colors=colors, radii=radii)) +def log_graph() -> None: + rr.log("graph", rr.GraphNodes(["a", "b"], labels=["A", "B"])) + + def run(args: Namespace) -> None: rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id=uuid4()) @@ -90,6 +101,7 @@ def run(args: Namespace) -> None: log_plots() log_points_3d() log_points_2d() + log_graph() if __name__ == "__main__": From 02e5f7938e3e1b6a291a5279901b83939329f148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Tue, 17 Dec 2024 10:02:56 +0100 Subject: [PATCH 5/5] Add map view to release checklist --- tests/python/release_checklist/check_hover_select_reset.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/python/release_checklist/check_hover_select_reset.py b/tests/python/release_checklist/check_hover_select_reset.py index 6d7dda4987d2..a83560ba7150 100644 --- a/tests/python/release_checklist/check_hover_select_reset.py +++ b/tests/python/release_checklist/check_hover_select_reset.py @@ -94,6 +94,10 @@ def log_graph() -> None: rr.log("graph", rr.GraphNodes(["a", "b"], labels=["A", "B"])) +def log_map() -> None: + rr.log("points", rr.GeoPoints(lat_lon=[[47.6344, 19.1397], [47.6334, 19.1399]], radii=rr.Radius.ui_points(20.0))) + + def run(args: Namespace) -> None: rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id=uuid4()) @@ -102,6 +106,7 @@ def run(args: Namespace) -> None: log_points_3d() log_points_2d() log_graph() + log_map() if __name__ == "__main__":