Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

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

SilentWolf75c94d1e989444
diff --git a/crates/ui-egui/src/viewport.rs b/crates/ui-egui/src/viewport.rs
index a7735c7a8f..251861cb5b 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 a86e874694..a6a7f31b1c 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");
}
}