From 4c8ae5d07858fb3482165de4118e6926e6e4f4ff Mon Sep 17 00:00:00 2001 From: raykholo Date: Fri, 23 Oct 2026 13:44:17 +0000 Subject: [PATCH] Hem: the direction arrow points the way the hem builds (#4794) (#4836) * claim: #4794 * Hem: the direction arrow points the way the hem builds (#4794) The Hem dialog shared the edge flange's arrow, which points out of the sheet's larger neighbouring face. A hem folds back the other way, so the arrow pointed away from the material it adds. Flip the hem's arrow so it matches the geometry; edge flanges keep theirs. A regression test compares the arrow with the side the finished hem adds material on, for both Flip states, top and bottom edge picks, and both dialog layouts. --- crates/ui-egui/src/dialogs_sheet.rs | 5 +++-- crates/ui-egui/src/dialogs_sheet_tests.rs | 27 +++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/dialogs_sheet.rs b/crates/ui-egui/src/dialogs_sheet.rs index c32e9fb51..635cfb658 100644 --- a/crates/ui-egui/src/dialogs_sheet.rs +++ b/crates/ui-egui/src/dialogs_sheet.rs @@ -716,11 +716,12 @@ pub fn for_feature(app: &SolveApp, kind: &FeatureKind) -> Option<(Kind, Vec Option { let Kind::Sheet(k) = &d.kind else { return None }; let flip = match k { - Sm::Flange { ty: 1, flip, .. } | Sm::Hem { flip, .. } => *flip, + Sm::Flange { ty: 1, flip, .. } => *flip, + Sm::Hem { flip, .. } => !flip, _ => return None, }; let Sel::Edge { body, index, point } = d.inputs.first()?.items.first()? else { return None }; diff --git a/crates/ui-egui/src/dialogs_sheet_tests.rs b/crates/ui-egui/src/dialogs_sheet_tests.rs index 2f6bdd898..94f1ed43f 100644 --- a/crates/ui-egui/src/dialogs_sheet_tests.rs +++ b/crates/ui-egui/src/dialogs_sheet_tests.rs @@ -69,6 +69,33 @@ fn flange_follows_the_picks() { } } +#[test] +fn hem_arrow_points_to_the_side_the_hem_builds_on() { + for mode in [crate::shell::LayoutMode::Floating, crate::shell::LayoutMode::Docked] { + for z in [0.0, 2.5] { + for flipped in [false, true] { + let mut app = plate(mode); + app.run("sheet.flange", json!({"sketch": "Base"})).unwrap(); + let body = app.session.model.state().sheets[0].body.clone(); + let before = app.session.world_state().body(&body).unwrap().mesh().bounds(); + app.session.selection = vec![edge_sel(&app.session, Vec3::new(50.0, 0.0, z)).unwrap()]; + app.start("sheet.hem"); + let mut d = app.dialog.clone().unwrap(); + let Kind::Sheet(Sm::Hem { flip, .. }) = &mut d.kind else { panic!("hem dialog") }; + *flip = flipped; + let direction = arrow(&app, &d).unwrap(); + let commands = apply_commands(&app, &d).unwrap(); + run_all(&mut app, commands); + let after = app.session.world_state().body(&body).unwrap().mesh().bounds(); + assert!( + direction.dot(after.center() - before.center()) > 1e-6, + "the arrow must point toward the added hem: z={z}, flip={flipped}, arrow={direction:?}, before={before:?}, after={after:?}" + ); + } + } + } +} + /// Hem takes edges and an optional gap; rules make and pick a rule with its expressions. #[test] fn hem_and_rules() {