Skip to content

Commit

Permalink
Show picking position when hovering something in the spatial view (#3227
Browse files Browse the repository at this point in the history
)

### What
* closes #3226

When hovering a line:

![image](https://github.com/rerun-io/rerun/assets/1148717/6cd66057-1900-4615-a9fc-d7ec4ea8f84b)


### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/3227) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/3227)
- [Docs
preview](https://rerun.io/preview/d798b5a0cf4433abaa3231c2ad21db0672fe0f33/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/d798b5a0cf4433abaa3231c2ad21db0672fe0f33/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://ref.rerun.io/dev/bench/)
- [Wasm size tracking](https://ref.rerun.io/dev/sizes/)

---------

Co-authored-by: Clement Rey <[email protected]>
  • Loading branch information
emilk and teh-cmc authored Sep 6, 2023
1 parent 9ad0da2 commit aa423ec
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/re_space_view_spatial/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,7 @@ pub fn picking(
} else {
// Hover ui for everything else
response.on_hover_ui_at_pointer(|ui| {
hit_ui(ui, hit);
item_ui::instance_path_button(ctx, ui, Some(query.space_view_id), &instance_path);
instance_path.data_ui(ctx, ui, UiVerbosity::Reduced, &ctx.current_query());
})
Expand Down Expand Up @@ -696,3 +697,10 @@ pub fn picking(

Ok(response)
}

fn hit_ui(ui: &mut egui::Ui, hit: &crate::picking::PickingRayHit) {
if hit.hit_type == PickingHitType::GpuPickingResult {
let glam::Vec3 { x, y, z } = hit.space_position;
ui.label(format!("Hover position: [{x:.5}, {y:.5}, {z:.5}]"));
}
}

0 comments on commit aa423ec

Please sign in to comment.