diff --git a/crates/re_ui/src/design_tokens.rs b/crates/re_ui/src/design_tokens.rs index e5c4f49998ca..dc3e247b89f6 100644 --- a/crates/re_ui/src/design_tokens.rs +++ b/crates/re_ui/src/design_tokens.rs @@ -172,7 +172,7 @@ impl DesignTokens { egui_style.visuals.widgets.inactive.fg_stroke.color = default; // button text egui_style.visuals.widgets.active.fg_stroke.color = strong; // strong text and active button text - let wide_stroke_width = 1.5; // Make it a bit more visible, especially important for spatial primitives. + let wide_stroke_width = 2.0; // Make it a bit more visible, especially important for spatial primitives. egui_style.visuals.widgets.active.fg_stroke.width = wide_stroke_width; egui_style.visuals.selection.stroke.width = wide_stroke_width; diff --git a/crates/re_viewport/src/viewport.rs b/crates/re_viewport/src/viewport.rs index 14f1cd97594b..07d1a32b6bfb 100644 --- a/crates/re_viewport/src/viewport.rs +++ b/crates/re_viewport/src/viewport.rs @@ -169,6 +169,36 @@ impl<'a> Viewport<'a> { // TODO(#4687): Be extra careful here. If we mark edited inappropriately we can create an infinite edit loop. self.tree_edited |= tab_viewer.edited; + + // Outline hovered & selected tiles: + for contents in blueprint.contents_iter() { + let tile_id = contents.as_tile_id(); + if let Some(rect) = tree.tiles.rect(tile_id) { + let item = contents.as_item(); + + let mut hovered = ctx.hovered().contains_item(&item); + let selected = ctx.selection().contains_item(&item); + + if hovered && ui.rect_contains_pointer(rect) { + // Showing a hover-outline when hovering the same thing somewhere else + // (e.g. in the blueprint panel) is really helpful, + // but showing a hover-outline when just dragging around the camera is + // just annoying. + hovered = false; + } + + let stroke = if hovered { + ui.ctx().hover_stroke() + } else if selected { + ui.ctx().selection_stroke() + } else { + continue; + }; + + ui.painter() + .rect_stroke(rect.shrink(stroke.width / 2.0), 0.0, stroke); + } + } }); self.blueprint.set_maximized(maximized, ctx);