SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.
Finished sketches on a face stay visible: a dark halo under each curve (#4862) (#4956)
raykholoeb37a82bc08b
diff --git a/assets/locales/pending/sketch-halo.json b/assets/locales/pending/sketch-halo.jsonnew file mode 100644index 0000000000..6a356ced64--- /dev/null+++ b/assets/locales/pending/sketch-halo.json@@ -0,0 +1,11 @@+{+ "en": {+ "Halo under sketch curves": "Halo under sketch curves"+ },+ "ja": {+ "Halo under sketch curves": "スケッチ曲線の下に縁取りを表示"+ },+ "zh": {+ "Halo under sketch curves": "在草图曲线下方显示光晕"+ }+}diff --git a/assets/styles/ui/palettes.rs b/assets/styles/ui/palettes.rsindex 9be2093203..13875f323e 100644--- a/assets/styles/ui/palettes.rs+++ b/assets/styles/ui/palettes.rs@@ -178,6 +178,7 @@ impl Tokens {body_selected: Color32::from_rgb(110, 170, 235),sketch: Color32::from_rgb(30, 90, 200),sketch_fixed: Color32::from_rgb(20, 20, 20),+ sketch_halo: Color32::from_rgb(240, 243, 247),sketch_point: Color32::BLACK,sketch_locked: Color32::from_rgb(0, 140, 60),dimension: Color32::from_rgb(36, 40, 48),@@ -336,6 +337,7 @@ impl Tokens {t.body_edge = Color32::from_rgb(16, 16, 18);t.sketch = Color32::from_rgb(92, 150, 255);t.sketch_fixed = Color32::from_rgb(232, 234, 238);+ t.sketch_halo = Color32::from_rgb(28, 32, 40);t.sketch_point = Color32::from_rgb(232, 234, 238);t.sketch_locked = Color32::from_rgb(96, 204, 116);t.dimension = Color32::from_rgb(224, 228, 234);diff --git a/assets/styles/ui/themes/amber-phosphor.json b/assets/styles/ui/themes/amber-phosphor.jsonindex 22dba6d227..b514247b75 100644--- a/assets/styles/ui/themes/amber-phosphor.json+++ b/assets/styles/ui/themes/amber-phosphor.json@@ -168,6 +168,7 @@"sketch_centerline": "#ba7e29","sketch_construction": "#ad7626","sketch_fixed": "#c68b2f",+ "sketch_halo": "#170d03","sketch_ink": "#f7ce88","sketch_locked": "#d4902f","sketch_lost": "#fff0ca",diff --git a/assets/styles/ui/themes/blueprint.json b/assets/styles/ui/themes/blueprint.jsonindex a04a3fe723..5c2b939939 100644--- a/assets/styles/ui/themes/blueprint.json+++ b/assets/styles/ui/themes/blueprint.json@@ -168,6 +168,7 @@"sketch_centerline": "#e7b374","sketch_construction": "#78b8dc","sketch_fixed": "#e3f0fa",+ "sketch_halo": "#092c50","sketch_ink": "#9ddab7","sketch_locked": "#6ee0bb","sketch_lost": "#ff968d",diff --git a/assets/styles/ui/themes/catppuccin-mocha.json b/assets/styles/ui/themes/catppuccin-mocha.jsonindex 7e2a2f61ac..801f73e5e4 100644--- a/assets/styles/ui/themes/catppuccin-mocha.json+++ b/assets/styles/ui/themes/catppuccin-mocha.json@@ -168,6 +168,7 @@"sketch_centerline": "#f9e2af","sketch_construction": "#f9e2af","sketch_fixed": "#cdd6f4",+ "sketch_halo": "#11111b","sketch_ink": "#a6e3a1","sketch_locked": "#a6e3a1","sketch_lost": "#f38ba8",diff --git a/assets/styles/ui/themes/cupertino.json b/assets/styles/ui/themes/cupertino.jsonindex 8a1a5d983e..322e200970 100644--- a/assets/styles/ui/themes/cupertino.json+++ b/assets/styles/ui/themes/cupertino.json@@ -168,6 +168,7 @@"sketch_centerline": "#b77c47","sketch_construction": "#cb8b37","sketch_fixed": "#262628",+ "sketch_halo": "#ffffff","sketch_ink": "#236f40","sketch_locked": "#318348","sketch_lost": "#c94f68",diff --git a/assets/styles/ui/themes/graphite.json b/assets/styles/ui/themes/graphite.jsonindex ca1bc3dbbd..82bfe6d7da 100644--- a/assets/styles/ui/themes/graphite.json+++ b/assets/styles/ui/themes/graphite.json@@ -168,6 +168,7 @@"sketch_centerline": "#dbb879","sketch_construction": "#dbb879","sketch_fixed": "#e0e2e5",+ "sketch_halo": "#17191d","sketch_ink": "#88b298","sketch_locked": "#83c69b","sketch_lost": "#ed7777",diff --git a/assets/styles/ui/themes/green-phosphor.json b/assets/styles/ui/themes/green-phosphor.jsonindex 221de93f6d..9ac21ea057 100644--- a/assets/styles/ui/themes/green-phosphor.json+++ b/assets/styles/ui/themes/green-phosphor.json@@ -168,6 +168,7 @@"sketch_centerline": "#32ba50","sketch_construction": "#2fad4a","sketch_fixed": "#8def9f",+ "sketch_halo": "#021007","sketch_ink": "#bbffca","sketch_locked": "#39d45c","sketch_lost": "#d8ffdf",diff --git a/assets/styles/ui/themes/gruvbox-dark-hard.json b/assets/styles/ui/themes/gruvbox-dark-hard.jsonindex 1fac3d49f6..e76952a95c 100644--- a/assets/styles/ui/themes/gruvbox-dark-hard.json+++ b/assets/styles/ui/themes/gruvbox-dark-hard.json@@ -53,6 +53,7 @@"body_selected": "#83a598","sketch": "#83a598","sketch_fixed": "#ebdbb2",+ "sketch_halo": "#141617","sketch_locked": "#b8bb26","dimension": "#ebdbb2","dimension_driven": "#928374",diff --git a/assets/styles/ui/themes/gruvbox-dark-soft.json b/assets/styles/ui/themes/gruvbox-dark-soft.jsonindex 6a5daef40b..cb8d65f358 100644--- a/assets/styles/ui/themes/gruvbox-dark-soft.json+++ b/assets/styles/ui/themes/gruvbox-dark-soft.json@@ -53,6 +53,7 @@"body_selected": "#83a598","sketch": "#83a598","sketch_fixed": "#ebdbb2",+ "sketch_halo": "#1d2021","sketch_locked": "#b8bb26","dimension": "#ebdbb2","dimension_driven": "#928374",diff --git a/assets/styles/ui/themes/gruvbox-dark.json b/assets/styles/ui/themes/gruvbox-dark.jsonindex 2224cf99d7..baea81d3d5 100644--- a/assets/styles/ui/themes/gruvbox-dark.json+++ b/assets/styles/ui/themes/gruvbox-dark.json@@ -53,6 +53,7 @@"body_selected": "#83a598","sketch": "#83a598","sketch_fixed": "#ebdbb2",+ "sketch_halo": "#1d2021","sketch_locked": "#b8bb26","dimension": "#ebdbb2","dimension_driven": "#928374",diff --git a/assets/styles/ui/themes/gruvbox-light-hard.json b/assets/styles/ui/themes/gruvbox-light-hard.jsonindex 690bced1a1..0baa3612d1 100644--- a/assets/styles/ui/themes/gruvbox-light-hard.json+++ b/assets/styles/ui/themes/gruvbox-light-hard.json@@ -53,6 +53,7 @@"body_selected": "#83a598","sketch": "#076678","sketch_fixed": "#282828",+ "sketch_halo": "#fbf8e3","sketch_locked": "#79740e","dimension": "#3c3836","dimension_driven": "#7c6f64",diff --git a/assets/styles/ui/themes/gruvbox-light-soft.json b/assets/styles/ui/themes/gruvbox-light-soft.jsonindex 7128bdd9c0..bec7dc40f3 100644--- a/assets/styles/ui/themes/gruvbox-light-soft.json+++ b/assets/styles/ui/themes/gruvbox-light-soft.json@@ -53,6 +53,7 @@"body_selected": "#83a598","sketch": "#076678","sketch_fixed": "#282828",+ "sketch_halo": "#f6edd0","sketch_locked": "#79740e","dimension": "#3c3836","dimension_driven": "#7c6f64",diff --git a/assets/styles/ui/themes/gruvbox-light.json b/assets/styles/ui/themes/gruvbox-light.jsonindex 7e750545b5..848c754ac1 100644--- a/assets/styles/ui/themes/gruvbox-light.json+++ b/assets/styles/ui/themes/gruvbox-light.json@@ -53,6 +53,7 @@"body_selected": "#83a598","sketch": "#076678","sketch_fixed": "#282828",+ "sketch_halo": "#fcf5d8","sketch_locked": "#79740e","dimension": "#3c3836","dimension_driven": "#7c6f64",diff --git a/assets/styles/ui/themes/high-contrast.json b/assets/styles/ui/themes/high-contrast.jsonindex f7b40c8aa6..961e53303a 100644--- a/assets/styles/ui/themes/high-contrast.json+++ b/assets/styles/ui/themes/high-contrast.json@@ -168,6 +168,7 @@"sketch_centerline": "#ffcc00","sketch_construction": "#ffcc00","sketch_fixed": "#ffffff",+ "sketch_halo": "#000000","sketch_ink": "#00ff80","sketch_locked": "#40e080","sketch_lost": "#ff6666",diff --git a/assets/styles/ui/themes/nord.json b/assets/styles/ui/themes/nord.jsonindex b9f056660a..fdf3bb5704 100644--- a/assets/styles/ui/themes/nord.json+++ b/assets/styles/ui/themes/nord.json@@ -168,6 +168,7 @@"sketch_centerline": "#ebcb8b","sketch_construction": "#ebcb8b","sketch_fixed": "#eceff4",+ "sketch_halo": "#242f40","sketch_ink": "#a3be8c","sketch_locked": "#a3be8c","sketch_lost": "#bf616a",diff --git a/assets/styles/ui/themes/nosferatu.json b/assets/styles/ui/themes/nosferatu.jsonindex 5331931369..7904adcc3f 100644--- a/assets/styles/ui/themes/nosferatu.json+++ b/assets/styles/ui/themes/nosferatu.json@@ -168,6 +168,7 @@"sketch_centerline": "#f1fa8c","sketch_construction": "#f1fa8c","sketch_fixed": "#f8f8f2",+ "sketch_halo": "#1d1e29","sketch_ink": "#50fa7b","sketch_locked": "#50fa7b","sketch_lost": "#ff5555",diff --git a/assets/styles/ui/themes/one-dark.json b/assets/styles/ui/themes/one-dark.jsonindex bd8a2be038..1dd88440cf 100644--- a/assets/styles/ui/themes/one-dark.json+++ b/assets/styles/ui/themes/one-dark.json@@ -168,6 +168,7 @@"sketch_centerline": "#d19a66","sketch_construction": "#d19a66","sketch_fixed": "#abb2bf",+ "sketch_halo": "#181a1f","sketch_ink": "#98c379","sketch_locked": "#98c379","sketch_lost": "#e06c75",diff --git a/assets/styles/ui/themes/platinum-9.json b/assets/styles/ui/themes/platinum-9.jsonindex 68bf60fae8..39999dac88 100644--- a/assets/styles/ui/themes/platinum-9.json+++ b/assets/styles/ui/themes/platinum-9.json@@ -168,6 +168,7 @@"sketch_centerline": "#c86e3c","sketch_construction": "#e68228","sketch_fixed": "#222222",+ "sketch_halo": "#ffffff","sketch_ink": "#456045","sketch_locked": "#447744","sketch_lost": "#c83c5a",diff --git a/assets/styles/ui/themes/solarized-light.json b/assets/styles/ui/themes/solarized-light.jsonindex 87e696a8f0..00813ef7cf 100644--- a/assets/styles/ui/themes/solarized-light.json+++ b/assets/styles/ui/themes/solarized-light.json@@ -168,6 +168,7 @@"sketch_centerline": "#b58900","sketch_construction": "#b58900","sketch_fixed": "#586e75",+ "sketch_halo": "#fdf6e3","sketch_ink": "#5a6800","sketch_locked": "#859900","sketch_lost": "#dc322f",diff --git a/assets/styles/ui/themes/solidcraft-95.json b/assets/styles/ui/themes/solidcraft-95.jsonindex f60abdc1e6..2d37e5c256 100644--- a/assets/styles/ui/themes/solidcraft-95.json+++ b/assets/styles/ui/themes/solidcraft-95.json@@ -168,6 +168,7 @@"sketch_centerline": "#808000","sketch_construction": "#808000","sketch_fixed": "#000000",+ "sketch_halo": "#ffffff","sketch_ink": "#005400","sketch_locked": "#008000","sketch_lost": "#800080",diff --git a/assets/styles/ui/themes/tokyo-night.json b/assets/styles/ui/themes/tokyo-night.jsonindex bc371b5d5e..9f3bb52e8c 100644--- a/assets/styles/ui/themes/tokyo-night.json+++ b/assets/styles/ui/themes/tokyo-night.json@@ -168,6 +168,7 @@"sketch_centerline": "#e0af68","sketch_construction": "#e0af68","sketch_fixed": "#c0caf5",+ "sketch_halo": "#151722","sketch_ink": "#9ece6a","sketch_locked": "#9ece6a","sketch_lost": "#f7768e",diff --git a/crates/ui-egui/src/colour_vision_tests.rs b/crates/ui-egui/src/colour_vision_tests.rsindex df530f322d..347d403a23 100644--- a/crates/ui-egui/src/colour_vision_tests.rs+++ b/crates/ui-egui/src/colour_vision_tests.rs@@ -517,6 +517,7 @@ const NO_MEANING: &[(&str, &str)] = &[("origin_point", "the origin, alone"),("construction_plane", "a plane"),("body_edge", "the model's edges"),+ ("sketch_halo", "neutral rim beneath sketch curves; the curves carry the state colours"),("grid", "the grid"),("grid_major", "the grid"),("profile_fill", "a closed profile's tint"),diff --git a/crates/ui-egui/src/prefs.rs b/crates/ui-egui/src/prefs.rsindex 8b2b0104ed..ce15244ab0 100644--- a/crates/ui-egui/src/prefs.rs+++ b/crates/ui-egui/src/prefs.rs@@ -537,6 +537,8 @@ preference_settings! {show_frame_rate: bool = false, PAGE_GRAPHICS => check_id("ui.frame_rate");/// With the frame rate: a frame-time graph, a histogram and what the GPU drew (#2548).frame_rate_details: bool = false, PAGE_GRAPHICS;+ /// Draw a wider rim under finished sketch curves to improve contrast on shaded faces.+ sketch_halo: bool = false, PAGE_GRAPHICS => check("Halo under sketch curves");/// Show world X/Y/Z component dimensions beside the total distance in Measure.measure_axis_distances: bool = true, PAGE_GRAPHICS => check_id("settings.measure_axis_distances");/// Decimals shown for lengths and angles.@@ -3494,6 +3496,19 @@ mod tests {assert_eq!(app.preferences.display_quality, "normal");}+ #[test]+ fn sketch_halo_is_off_by_default_saved_and_restored() {+ use serde_json::json;+ let mut app = crate::SolveApp::new(solidcraft_engine::Session::default(), crate::Services::default());+ assert_eq!(serde_json::to_value(&app.preferences).unwrap()["sketch_halo"], false);+ assert_eq!(serde_json::to_value(super::lenient(&json!({}))).unwrap()["sketch_halo"], false);+ let saved = super::set(&mut app, &json!({"sketch_halo": true})).unwrap();+ assert_eq!(saved["sketch_halo"], true);+ assert_eq!(serde_json::to_value(super::lenient(&saved)).unwrap()["sketch_halo"], true);+ super::defaults(&mut app, super::PAGE_GRAPHICS);+ assert_eq!(serde_json::to_value(&app.preferences).unwrap()["sketch_halo"], false);+ }+/// Supersampling (#1288): off by default, adaptive, set by factor and checked.#[test]fn supersampling_is_off_by_default_and_checked() {diff --git a/crates/ui-egui/src/prefs/graphics.rs b/crates/ui-egui/src/prefs/graphics.rsindex bb46fc7121..227d740332 100644--- a/crates/ui-egui/src/prefs/graphics.rs+++ b/crates/ui-egui/src/prefs/graphics.rs@@ -158,6 +158,7 @@ pub(super) fn show(app: &mut SolveApp, ui: &mut egui::Ui) {.on_hover_text(app.tr("settings.frame_rate_details_note"));});setting::reference_geometry_through_bodies(app, left).on_hover_text(app.tr("settings.reference_geometry_through_bodies_help"));+ setting::sketch_halo(app, left);}if let Some(right) = columns.get_mut(1) {ui_kit::checkbox(right, crate::i18n::tr_label("Ground shadow"), &mut app.ui.ground_shadow);diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rsindex aa111750b2..8c0d8e6b22 100644--- a/crates/ui-egui/src/theme.rs+++ b/crates/ui-egui/src/theme.rs@@ -674,6 +674,8 @@ pub struct Tokens {/// Sketch curves: under-constrained, fully constrained (and finished sketches).pub sketch: Color32,pub sketch_fixed: Color32,+ /// Wider rim beneath sketch curves to separate them from shaded faces.+ pub sketch_halo: Color32,/// Fixed (locked) sketch geometry.pub sketch_locked: Color32,/// Sketch dimensions: driving, driven (reference).diff --git a/crates/ui-egui/src/theme_files.rs b/crates/ui-egui/src/theme_files.rsindex 692f54d3c9..3a2aafb422 100644--- a/crates/ui-egui/src/theme_files.rs+++ b/crates/ui-egui/src/theme_files.rs@@ -305,7 +305,7 @@ theme_keys! {sel_profile_edge, hover_profile, hover_profile_edge, sel_vertex, origin_plane, origin_plane_edge, origin_plane_hover,origin_point, axis_x, axis_y, axis_z, construction_plane, construction_geom, body, body_edge, manipulator,preview_add, preview_new, preview_sketch, preview_cut, cube_face, cube_border, cube_text, cube_hover, viewport_top,- viewport_bottom, grid, grid_major, body_selected, sketch, sketch_fixed, sketch_locked, dimension, dimension_driven,+ viewport_bottom, grid, grid_major, body_selected, sketch, sketch_fixed, sketch_halo, sketch_locked, dimension, dimension_driven,sketch_point, sketch_point_free, dialog_bg, dialog_border, chip, section_cap,profile_fill, glyph_bg, glyph_edge, glyph_text, overlay, rubber_band, app_bar_text, app_bar_hover, timeline_item,timeline_item_error, timeline_marker, field, box_window, box_crossing, sketch_projected, sketch_lost,diff --git a/crates/ui-egui/src/viewport.rs b/crates/ui-egui/src/viewport.rsindex 080bc60e4d..1b07149af0 100644--- a/crates/ui-egui/src/viewport.rs+++ b/crates/ui-egui/src/viewport.rs@@ -420,6 +420,7 @@ fn sketch_scene_key(app: &SolveApp, proj: &Proj) -> u64 {app.preferences.grid_follows_view.hash(&mut h);// Finished sketches are drawn over the bodies when the preference says so.app.preferences.reference_geometry_through_bodies.hash(&mut h);+ app.preferences.sketch_halo.hash(&mut h);(std::sync::Arc::as_ptr(&crate::open_meshing::shown_world(app)) as usize).hash(&mut h);crate::sketch_display::projection_key(proj, app.viewport.pixels_per_point()).hash(&mut h);h.finish()@@ -1150,7 +1151,11 @@ fn build_sketch_scene(app: &SolveApp, proj: &Proj) -> GpuScene {}}// Construction curves are dashed, centerlines dash-dot (lengths follow the grid).+ // When enabled, a finished sketch's own curves sit on a wider halo (#4862) to read on a+ // shaded face. Projected (reference) curves get none: they trace the face's own edges.+ // All the halos go first, so one curve's halo never cuts into another where they meet.let unit = grid_step(app.cam.half_height()).0;+ let mut strokes = Vec::new();for (pts, col, cons) in sketch_lines_with_sampler(&ss.sketch, &ss.plane, active, &ss.report.curve_determined, |_, index, plane| {crate::sketch_display::curve_sample(app, sid, index, plane, proj).parts.clone()}) {@@ -1165,11 +1170,21 @@ fn build_sketch_scene(app: &SolveApp, proj: &Proj) -> GpuScene {},unit,);+ let haloed = app.preferences.sketch_halo && !active && col != colors::SKETCH_PROJECTED && col != colors::SKETCH_LOST;+ strokes.push((segs, sketch_color(&tk, col), if cons { 1.2 } else { 2.0 }, haloed));+ }+ // Active sketches retain their existing through-body display. Inactive sketches+ // can opt into the same behaviour in Preferences.+ let through = active || app.preferences.reference_geometry_through_bodies;+ let halo = c4(tk.sketch_halo);+ for (segs, _, width, _) in strokes.iter().filter(|stroke| stroke.3) {for (a, b) in segs {- // Active sketches retain their existing through-body display. Inactive sketches- // can opt into the same behaviour in Preferences.- let through = active || app.preferences.reference_geometry_through_bodies;- sc.line(a.to_f32(), b.to_f32(), sketch_color(&tk, col), if cons { 1.2 } else { 2.0 }, through);+ sc.line(a.to_f32(), b.to_f32(), halo, width + SKETCH_HALO_WIDTH, through);+ }+ }+ for (segs, color, width, _) in &strokes {+ for (a, b) in segs {+ sc.line(a.to_f32(), b.to_f32(), *color, *width, through);}}}@@ -2329,6 +2344,9 @@ fn mesh_tris(sc: &mut GpuScene, m: &solidcraft_engine::geom::Mesh, col: [u8; 4],}}+/// How much wider a sketch curve's halo is than the curve (#4862): a 1 px rim each side.+const SKETCH_HALO_WIDTH: f32 = 2.0;+/// A highlighted edge: a halo and a core, and where the model hides it, the core dimmed (so a/// pick on the far side still shows).fn edge_lines(sc: &mut GpuScene, e: &[Vec3], core: Color32, halo: Color32, w: f32, normals: &[[[f32; 3]; 2]]) {diff --git a/crates/ui-egui/src/viewport_appearance_tests.rs b/crates/ui-egui/src/viewport_appearance_tests.rsindex 333feca077..f1a6a8e110 100644--- a/crates/ui-egui/src/viewport_appearance_tests.rs+++ b/crates/ui-egui/src/viewport_appearance_tests.rs@@ -3,6 +3,73 @@ use crate::{Services, SolveApp};use serde_json::json;use solidcraft_engine::{Session, doc, geom::Vec3, kernel};+#[test]+fn a_finished_sketch_on_a_face_draws_a_halo_under_its_own_curves_only() {+ use crate::theme::{self, ColorVision, Tokens};++ let mut app = SolveApp::new(Session::default(), Services::default());+ app.run("solid.box", json!({"length":40,"width":30,"height":20})).unwrap();+ app.run("sketch.create", json!({"plane":{"face":[20,15,20]},"project_edges":true})).unwrap();+ app.run("sketch.rectangle.two_point", json!({"p0":[-5,-5],"p1":[5,5]})).unwrap();+ app.run("sketch.circle.center", json!({"center":[0,0],"radius":3})).unwrap();+ app.run("sketch.line", json!({"points":[[-4,0],[4,0]]})).unwrap();+ let rect = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(800.0, 600.0));+ let original_dark = theme::is_dark();+ let original_vision = theme::vision();+ for finished in [false, true] {+ if finished {+ app.run("sketch.finish", json!({})).unwrap();+ }+ for dark in [false, true] {+ for vision in ColorVision::ALL {+ theme::set_dark(dark);+ theme::set_vision(vision);+ let tokens = Tokens::get();+ crate::prefs::set(&mut app, &json!({"sketch_halo": true})).unwrap();+ let projection = super::projection(&app, rect);+ let enabled_key = super::sketch_scene_key(&app, &projection);+ let scene = super::build_sketch_scene(&app, &projection);+ // The sketch being edited draws on top; a finished one is depth-tested.+ let bytes = if finished { &scene.lines } else { &scene.overlay };+ let (lines, remainder) = bytes.as_chunks::<{ crate::gpu::LINE_SIZE }>();+ assert!(remainder.is_empty());+ let halo = super::c4(tokens.sketch_halo);+ let halo_count = lines.iter().filter(|line| line[24..28] == halo).count();+ crate::prefs::set(&mut app, &json!({"sketch_halo": false})).unwrap();+ assert_ne!(super::sketch_scene_key(&app, &projection), enabled_key, "changing the preference rebuilds the sketch scene");+ let disabled = super::build_sketch_scene(&app, &projection);+ let without_halos: Vec<u8> = lines.iter().filter(|line| line[24..28] != halo).flat_map(|line| line.iter().copied()).collect();+ assert_eq!(if finished { &disabled.lines } else { &disabled.overlay }, &without_halos, "off draws only the original curves");+ if !finished {+ assert_eq!(halo_count, 0, "a sketch being edited has no halo");+ continue;+ }+ assert!(halo_count > 5, "rectangle, circle and line emit halos");+ let width = |line: &[u8]| f32::from_le_bytes(line[28..32].try_into().unwrap());+ let projected = super::c4(tokens.sketch_projected);+ let mut cores = 0;+ let mut references = 0;+ for (index, core) in lines.iter().enumerate().filter(|(_, line)| line[24..28] != halo) {+ let rim = lines[..index].iter().find(|line| line[..24] == core[..24] && line[24..28] == halo);+ if core[24..28] == projected {+ assert!(rim.is_none(), "the face's projected outline has no halo");+ references += 1;+ } else {+ assert_eq!(core[24..28], super::c4(tokens.sketch_fixed));+ let rim = rim.unwrap();+ assert_eq!(width(rim), width(core) + super::SKETCH_HALO_WIDTH, "halo precedes the narrower core");+ cores += 1;+ }+ }+ assert!(references > 0, "the projected face outline is drawn");+ assert_eq!(cores, halo_count, "one halo per curve segment");+ }+ }+ }+ theme::set_dark(original_dark);+ theme::set_vision(original_vision);+}+#[test]fn placed_step_body_uses_imported_opacity_until_a_design_look_overrides_it() {let body = kernel::box_solid(Vec3::ZERO, Vec3::new(10.0, 10.0, 10.0))