Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't show 2D labels in 3D space views. #1641

Merged
merged 2 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions crates/re_viewer/src/ui/view_spatial/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ pub fn create_labels(
eye3d: &Eye,
parent_ui: &mut egui::Ui,
highlights: &SpaceViewHighlights,
skip_2d_labels: bool,
Wumpf marked this conversation as resolved.
Show resolved Hide resolved
) -> Vec<egui::Shape> {
crate::profile_function!();

Expand All @@ -547,6 +548,9 @@ pub fn create_labels(
for label in &scene_ui.labels {
let (wrap_width, text_anchor_pos) = match label.target {
UiLabelTarget::Rect(rect) => {
if skip_2d_labels {
continue;
}
let rect_in_ui = ui_from_space2d.transform_rect(rect);
(
// Place the text centered below the rect
Expand All @@ -555,6 +559,9 @@ pub fn create_labels(
)
}
UiLabelTarget::Point2D(pos) => {
if skip_2d_labels {
continue;
}
let pos_in_ui = ui_from_space2d.transform_pos(pos);
(f32::INFINITY, pos_in_ui + egui::vec2(0.0, 3.0))
}
Expand Down
1 change: 1 addition & 0 deletions crates/re_viewer/src/ui/view_spatial/ui_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ fn view_2d_scrollable(
&eye,
parent_ui,
highlights,
false,
);

// Check if we're hovering any hover primitive.
Expand Down
2 changes: 2 additions & 0 deletions crates/re_viewer/src/ui/view_spatial/ui_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ pub fn view_3d(
&eye,
ui,
highlights,
// TODO(#1640): 2D labels are not visible in 3D for now.
true,
Wumpf marked this conversation as resolved.
Show resolved Hide resolved
);

// TODO(andreas): We're very close making the hover reaction of ui2d and ui3d the same. Finish the job!
Expand Down