From bdcfe3ff1d39c665c4a9bc3de541790c868e198f Mon Sep 17 00:00:00 2001 From: William Dunn Date: Tue, 13 Oct 2026 14:32:13 -0400 Subject: [PATCH] One tool window for sketch Fillet and the three sketch Chamfers (#789) Sketch Fillet and the three sketch Chamfers share one tool window, with its own icons, labels and a scenario. --- crates/ui-egui/src/canvas.rs | 10 + crates/ui-egui/src/dialogs.rs | 37 ++- crates/ui-egui/src/icons.rs | 39 ++++ crates/ui-egui/src/locales/de.json | 3 + crates/ui-egui/src/locales/en.json | 3 + crates/ui-egui/src/locales/ja.json | 3 + crates/ui-egui/src/locales/ko.json | 3 + crates/ui-egui/src/sketch_corner_ui_tests.rs | 218 +++++++++++++++++- crates/ui-egui/src/sketch_modify_ui.rs | 172 +++++++++++++- crates/ui-egui/src/sketch_tools.rs | 80 ++----- crates/ui-egui/src/tools.rs | 2 - crates/ui-egui/src/viewport.rs | 11 +- .../tests/scenarios/sketch_corner_window.json | 56 +++++ 13 files changed, 567 insertions(+), 70 deletions(-) create mode 100644 crates/ui-egui/tests/scenarios/sketch_corner_window.json diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index a73a74f4..f04d2465 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -62,6 +62,16 @@ pub fn anchor(app: &SolveApp, d: &Dialog) -> Option<(Vec3, Option)> { }; (ss.plane.to_world(mid), dir) } + // A corner picked into a sketch window (":", or a bare id when it + // was selected outside one): the value box sits on the corner itself. + Sel::SketchPoint { id } => { + let (sketch, point) = match id.split_once(':') { + Some((sketch, point)) => (sketch.parse().ok()?, point), + None => (app.session.active_sketch?, id.as_str()), + }; + let ss = st.sketch(sketch)?; + (ss.plane.to_world(ss.sketch.point(ss.sketch.resolve_point(point)?)?), None) + } Sel::Body { name } => (st.body(name)?.mesh().bounds().center(), None), Sel::Plane { name } => { let pl = solidcraft_engine::geom::Plane::named(name).or_else(|| { diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index b02435b7..21f61ab9 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -1191,6 +1191,39 @@ pub(crate) fn combo(ui: &mut egui::Ui, id: &str, labels: &[&str], sel: &mut usiz publish_row(&r.response); } +/// A mode choice as a row of icon buttons rather than a drop-down: every mode is on screen at +/// once, each drawn as the shape it makes, with its name as the tooltip. `labels` and `icons` +/// run in step; a mode with no icon gets the fallback square. Publishes the handles a combo +/// does, `dialog::