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() 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)); } } 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(()) } diff --git a/tests/python/release_checklist/check_hover_select_reset.py b/tests/python/release_checklist/check_hover_select_reset.py index 4fd4821440e1..a83560ba7150 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,14 @@ 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 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()) @@ -90,6 +105,8 @@ def run(args: Namespace) -> None: log_plots() log_points_3d() log_points_2d() + log_graph() + log_map() if __name__ == "__main__":