SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.
UI: keep Preferences above the Distance entry (#9016) (#9022)
SilentWolf7518b00a41925b
diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rsindex d3b197534a..f6ac713955 100644--- a/crates/ui-egui/src/canvas.rs+++ b/crates/ui-egui/src/canvas.rs@@ -857,7 +857,9 @@ fn value_box_full(at};let mut field = None;- Container::new(ui.ctx(), Surface::Canvas).area(area).fixed_pos(at).pivot(pivot).order(egui::Order::Foreground).show(ui.ctx(), |ui| {+ // Background: under Preferences, Report a bug and other system windows (#9016). The box is+ // already kept clear of the command window (#6608), which floats at Middle with Features.+ Container::new(ui.ctx(), Surface::Canvas).area(area).fixed_pos(at).pivot(pivot).order(egui::Order::Background).show(ui.ctx(), |ui| {Container::popup_frame(ui.style()).inner_margin(egui::Margin::symmetric(6, 3)).show(ui, |ui| {ui.horizontal(|ui| {ui.label(egui::RichText::new(crate::i18n::tr_label(label)).color(t.text_dim).size(crate::theme::Tokens::get().font_caption));@@ -1600,7 +1602,7 @@ fn draw_revolve(let area = Container::new(ui.ctx(), Surface::Canvas).area(egui::Id::new("sc_canvas_area")).fixed_pos(box_at)- .order(egui::Order::Foreground)+ .order(egui::Order::Background).interactable(false);area.show(ui.ctx(), |ui| {Container::popup_frame(ui.style()).inner_margin(egui::Margin::symmetric(6, 3)).show(ui, |ui| {@@ -1852,8 +1854,8 @@ mod tests {}/// #6608: a value box that has to move out of the command window does not cover the- /// manipulator's handles: the box is a foreground area, so it took the press and the drag- /// on a ring never reached the model.+ /// manipulator's handles: when it covered a handle it took the press and the drag on a ring+ /// never reached the model.#[test]fn a_value_box_keeps_clear_of_the_handles() {let mut h = crate::scenario::Harness::new();@@ -1896,6 +1898,31 @@ mod tests {assert_eq!(clear_of_dialog(clear, place), clear, "a box that misses the window stays");}+ /// Canvas value boxes sit under Preferences and Report a bug (#9016).+ #[test]+ fn a_value_box_draws_under_system_windows() {+ let mut h = crate::scenario::Harness::new();+ h.app.run("solid.box", serde_json::json!({"length": 40, "width": 30, "height": 20})).unwrap();+ h.app.session.selection = vec![Sel::Body { name: "Body1".into() }];+ h.step(&serde_json::json!({"start": "solid.move"})).unwrap();+ h.frames(6);+ let order = |h: &crate::scenario::Harness| {+ h.ctx.memory(|m| m.areas().visible_layer_ids().into_iter().find(|l| l.id == egui::Id::new("sc_canvas_area")).map(|l| l.order))+ };+ assert_eq!(order(&h), Some(egui::Order::Background), "the value box belongs under system windows");+ h.call("ui.prefs", serde_json::json!({"open": "General"}));+ h.frames(3);+ let window = h.ctx.memory(|m| m.area_rect(egui::Id::new("sc_prefs"))).expect("Preferences");+ let box_rect = h.ctx.memory(|m| m.area_rect(egui::Id::new("sc_canvas_area"))).expect("the value box");+ assert!(order(&h) < Some(egui::Order::Middle), "Preferences draws over the value box");+ if window.intersects(box_rect) {+ assert!(+ h.ctx.memory(|m| m.layer_id_at(box_rect.center())).is_some_and(|l| l.id == egui::Id::new("sc_prefs")),+ "Preferences covers the Distance box where they overlap"+ );+ }+ }+/// A box that would cover a handle moves off it, and one that cannot clear both the window/// and the handles keeps off the handles: the handle takes the press (#6608).#[test]diff --git a/crates/ui-egui/src/dim_view.rs b/crates/ui-egui/src/dim_view.rsindex e53ae0d680..93678d0204 100644--- a/crates/ui-egui/src/dim_view.rs+++ b/crates/ui-egui/src/dim_view.rs@@ -887,7 +887,8 @@ fn edit_box(app: &mut SolveApp, ctx: &egui::Context) {anchor.x = anchor.x.clamp(rect.left(), (rect.right() - popup_width - 6.0).max(rect.left()));anchor.y = anchor.y.clamp(rect.top(), (rect.bottom() - 80.0).max(rect.top()));}- Container::new(ctx, Surface::Canvas).area(egui::Id::new("sc_dim_edit_area")).fixed_pos(anchor).order(egui::Order::Foreground).show(ctx, |ui| {+ // Background: under Preferences and Report a bug (#9016), like canvas value boxes.+ Container::new(ctx, Surface::Canvas).area(egui::Id::new("sc_dim_edit_area")).fixed_pos(anchor).order(egui::Order::Background).show(ctx, |ui| {Container::popup_frame(ui.style()).fill(Tokens::get().dialog_body).inner_margin(Tokens::get().space_4).show(ui, |ui| {crate::ui_kit::scope(ui, |ui| {ui.set_max_width(popup_width);diff --git a/crates/ui-egui/src/sketch_dims.rs b/crates/ui-egui/src/sketch_dims.rsindex 58a8502ea4..3626d50efc 100644--- a/crates/ui-egui/src/sketch_dims.rs+++ b/crates/ui-egui/src/sketch_dims.rs@@ -541,7 +541,8 @@ fn boxes(app: &SolveApp, ui: &mut egui::Ui, proj: &Proj, t: &mut Tool) -> Options.store(ui.ctx(), id);}let pos = in_view(sp + vec2(-34.0, -11.0), view, ui.ctx().pointer_latest_pos());- Container::new(ui.ctx(), Surface::Canvas).area(egui::Id::new(("sc_dim_area", i))).fixed_pos(pos).order(egui::Order::Foreground).show(+ // Background: under Preferences and Report a bug (#9016), like canvas value boxes.+ Container::new(ui.ctx(), Surface::Canvas).area(egui::Id::new(("sc_dim_area", i))).fixed_pos(pos).order(egui::Order::Background).show(ui.ctx(),|ui| {let fill = if b.locked { tk.accent_soft } else { tk.panel };