Inspect: keep analysis legends clear of left History (#4515) (#9210)

* claim: #4515

Co-authored-by: Cursor <cursoragent@cursor.com>

* 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 <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
SilentWolf75
2026-10-30 03:59:33 +00:00
committed by GitHub
parent 46a2d6b53c
commit c94d1e9894
2 changed files with 13 additions and 1 deletions
+4 -1
View File
@@ -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;
@@ -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");
}
}