From c94d1e9894448e363452f421c3cfda9b45dd7a61 Mon Sep 17 00:00:00 2001 From: SilentWolf75 <134335235+SilentWolf75@users.noreply.github.com> Date: Fri, 30 Oct 2026 03:59:33 +0000 Subject: [PATCH] Inspect: keep analysis legends clear of left History (#4515) (#9210) * claim: #4515 Co-authored-by: Cursor * Inspect: keep analysis legends clear of a left History (#4515). Draft, Accessibility and Curvature legends were painted at the viewport's left edge under a left History sidebar. Place them in the free workspace content instead. Co-authored-by: Cursor --------- Co-authored-by: Cursor --- crates/ui-egui/src/viewport.rs | 5 ++++- crates/ui-egui/src/viewport_overlays_tests.rs | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/viewport.rs b/crates/ui-egui/src/viewport.rs index a7735c7a8..251861cb5 100644 --- a/crates/ui-egui/src/viewport.rs +++ b/crates/ui-egui/src/viewport.rs @@ -2939,7 +2939,10 @@ fn analysis_legend(app: &SolveApp, painter: &egui::Painter, rect: Rect) { }; let (pad, row) = (8.0, 18.0); let h = pad * 2.0 + 18.0 + along.as_ref().map_or(0.0, |_| row) + row * rows.len() as f32; - let r = Rect::from_min_size(pos2(rect.left() + 12.0, rect.bottom() - 12.0 - h), vec2(230.0, h)); + // Clear Browser and a left History card so the legend is not painted under them (#4515). + let free = crate::shell::workspace_content(app, rect); + let width = 230.0_f32.min((free.width() - 24.0).max(120.0)); + let r = Rect::from_min_size(pos2(free.left() + 12.0, free.bottom() - 12.0 - h), vec2(width, h)); painter.rect(r, t.radius_md, t.overlay, Stroke::new(1.0, t.border), egui::StrokeKind::Inside); crate::scenario::publish_target("analysis:legend", r); let mut y = r.top() + pad; diff --git a/crates/ui-egui/src/viewport_overlays_tests.rs b/crates/ui-egui/src/viewport_overlays_tests.rs index a86e87469..a6a7f31b1 100644 --- a/crates/ui-egui/src/viewport_overlays_tests.rs +++ b/crates/ui-egui/src/viewport_overlays_tests.rs @@ -746,9 +746,18 @@ fn left_history_sidebar_leaves_bottom_readouts_at_the_bottom() { h.app.run("inspect.draft", json!({})).unwrap(); h.frame(); let viewport = h.app.viewport.layout.as_ref().unwrap().viewport; + let history = crate::scenario::rect_of("history:vertical").expect("left History"); for name in ["analysis:legend", "viewport:frame_rate"] { let readout = crate::scenario::rect_of(name).unwrap(); assert!((readout.bottom() - (viewport.bottom() - 12.0)).abs() < 0.01, "{name}: {readout:?} in {viewport:?}"); + assert!(!readout.intersects(history), "{name}: {readout:?} under History {history:?}"); + } + for command in ["inspect.accessibility", "inspect.curvature_map"] { + h.app.run(command, json!({})).unwrap(); + h.frame(); + let legend = crate::scenario::rect_of("analysis:legend").unwrap(); + assert!(!legend.intersects(history), "{command}: {legend:?} under History {history:?}"); + assert!(legend.left() >= history.right() - 0.5, "{command}: legend stays right of History"); } }