SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.
Viewport status item: standard details card (#8613) (#8614)
Nathan Dane5bd5be95431b
diff --git a/assets/locales/pending/viewport-status-details.json b/assets/locales/pending/viewport-status-details.jsonnew file mode 100644index 0000000000..2efef31acb--- /dev/null+++ b/assets/locales/pending/viewport-status-details.json@@ -0,0 +1,318 @@+{+ "ar": {+ "cmd.view.status_details": "تفاصيل حالة منفذ العرض",+ "prefs.viewport_status_details": "تفاصيل منفذ العرض المباشرة",+ "prefs.viewport_status_details_help": "حرّر إعدادات التحليل والمقطع النشطين في بطاقات التفاصيل القياسية. عطّل هذا الخيار لاستعادة وسائل إيضاح التحليل للقراءة فقط ومربع حوار المقطع.",+ "ui.details_access_caption": "توضح الأوجه ما إذا كان بإمكان الأداة الوصول إليها من الاتجاه المحدد.",+ "ui.details_angle": "الزاوية",+ "ui.details_continuity_caption": "حرّر الوصلة المحددة. تحتفظ الوصلات الأخرى بإعداداتها الخاصة.",+ "ui.details_continuity_stale": "هندسة سابقة: أعد تشغيل التحليل لتحرير هذه الوصلة أو ملاءمة العرض لها.",+ "ui.details_copy_list": "نسخ القائمة",+ "ui.details_curvature": "سماحية الانحناء",+ "ui.details_curvature_caption": "تُلوَّن الأوجه وفقًا لنصف قطر الانحناء المحلي لها.",+ "ui.details_direction": "اتجاه الأداة",+ "ui.details_draft_caption": "تُلوَّن الأوجه وفقًا لزاويتها بالنسبة إلى اتجاه السحب.",+ "ui.details_edit_seam": "تحرير الوصلة",+ "ui.details_fixture": "نموذج عرض لمكوّن الواجهة — بيانات توضيحية فقط",+ "ui.details_fixture_caption": "نموذج عرض لمكوّن الواجهة بقيم توضيحية؛ هذه ليست نتيجة من النموذج الهندسي.",+ "ui.details_fixture_problem": "مثال على نتيجة تشير إلى مشكلة",+ "ui.details_fixture_readout": "مثال على قيمة مقاسة",+ "ui.details_flip": "عكس",+ "ui.details_gap": "الفجوة",+ "ui.details_hatch": "تهشير أوجه القطع",+ "ui.details_jump": "قفزة الانحناء",+ "ui.details_key": "وسيلة الإيضاح",+ "ui.details_offset": "إزاحة",+ "ui.details_plane": "مستوى",+ "ui.details_pull": "اتجاه السحب",+ "ui.details_radius": "نصف القطر",+ "ui.details_readout": "القراءات",+ "ui.details_samples": "العينات",+ "ui.details_seam": "{body} · حافة {edge}",+ "ui.details_settings": "الإعدادات",+ "ui.details_sharp_gap": "حافة حادة أو فجوة",+ "ui.details_show_all": "عرض الكل ({count})",+ "ui.details_smooth": "أملس",+ "ui.details_stripes": "الخطوط",+ "ui.details_target": "ملاءمة العرض للهندسة",+ "ui.details_worst_seams": "الوصلات الأقل استمرارية",+ "ui.details_zebra_caption": "تُظهر الخطوط المنعكسة مدى سلاسة اتصال الأوجه."+ },+ "de": {+ "cmd.view.status_details": "Statusdetails des Ansichtsfensters",+ "prefs.viewport_status_details": "Live-Details im Ansichtsfenster",+ "prefs.viewport_status_details_help": "Aktive Analyse- und Schnitteinstellungen in standardisierten Detailkarten bearbeiten. Deaktivieren, um schreibgeschützte Analyselegenden und den Schnittdialog wiederherzustellen.",+ "ui.details_access_caption": "Flächen zeigen, ob ein Werkzeug sie aus der gewählten Richtung erreichen kann.",+ "ui.details_angle": "Winkel",+ "ui.details_continuity_caption": "Ausgewählte Naht bearbeiten. Andere Nähte behalten ihre eigenen Einstellungen.",+ "ui.details_continuity_stale": "Frühere Geometrie: Analyse erneut ausführen, um diese Naht zu bearbeiten oder in die Ansicht einzupassen.",+ "ui.details_copy_list": "Liste kopieren",+ "ui.details_curvature": "Krümmungstoleranz",+ "ui.details_curvature_caption": "Flächen werden anhand ihres lokalen Krümmungsradius eingefärbt.",+ "ui.details_direction": "Werkzeugrichtung",+ "ui.details_draft_caption": "Flächen werden anhand ihres Winkels zur Entformungsrichtung eingefärbt.",+ "ui.details_edit_seam": "Naht bearbeiten",+ "ui.details_fixture": "UI-Bausteinbeispiel — nur Beispieldaten",+ "ui.details_fixture_caption": "UI-Bausteinbeispiel mit veranschaulichenden Werten; dies ist kein Modellergebnis.",+ "ui.details_fixture_problem": "Beispielbefund mit einem Problem",+ "ui.details_fixture_readout": "Beispielmesswert",+ "ui.details_flip": "Umkehren",+ "ui.details_gap": "Spalt",+ "ui.details_hatch": "Schnittflächen schraffieren",+ "ui.details_jump": "Krümmungssprung",+ "ui.details_key": "Legende",+ "ui.details_offset": "Versatz",+ "ui.details_plane": "Ebene",+ "ui.details_pull": "Entformungsrichtung",+ "ui.details_radius": "Radius",+ "ui.details_readout": "Messwerte",+ "ui.details_samples": "Abtastpunkte",+ "ui.details_seam": "{body} · Kante {edge}",+ "ui.details_settings": "Einstellungen",+ "ui.details_sharp_gap": "Scharfe Kante oder Spalt",+ "ui.details_show_all": "Alle {count} anzeigen",+ "ui.details_smooth": "Glatt",+ "ui.details_stripes": "Streifen",+ "ui.details_target": "Geometrie in Ansicht einpassen",+ "ui.details_worst_seams": "Schlechteste Nähte",+ "ui.details_zebra_caption": "Reflektierte Streifen zeigen, wie glatt die Flächen ineinander übergehen."+ },+ "en": {+ "cmd.view.status_details": "Viewport Status Details",+ "prefs.viewport_status_details": "Live viewport details",+ "prefs.viewport_status_details_help": "Edit active analysis and section settings in standard details cards. Disable to restore read-only analysis keys and the Section dialog.",+ "ui.details_access_caption": "Faces show whether a tool can reach them from the chosen direction.",+ "ui.details_angle": "Angle",+ "ui.details_continuity_caption": "Edit the selected seam. Other seams keep their own settings.",+ "ui.details_continuity_stale": "Earlier geometry: rerun the analysis to edit or frame this seam.",+ "ui.details_copy_list": "Copy list",+ "ui.details_curvature": "Curvature tolerance",+ "ui.details_curvature_caption": "Faces are colored by their local radius of curvature.",+ "ui.details_direction": "Tool direction",+ "ui.details_draft_caption": "Faces are colored by their angle to the pull direction.",+ "ui.details_edit_seam": "Edit seam",+ "ui.details_fixture": "Component specimen — sample data only",+ "ui.details_fixture_caption": "Component specimen with illustrative values; this is not a model result.",+ "ui.details_fixture_problem": "Example finding with a problem",+ "ui.details_fixture_readout": "Example measured value",+ "ui.details_flip": "Flip",+ "ui.details_gap": "Gap",+ "ui.details_hatch": "Hatch cut faces",+ "ui.details_jump": "Curvature jump",+ "ui.details_key": "Key",+ "ui.details_offset": "Offset",+ "ui.details_plane": "Plane",+ "ui.details_pull": "Pull direction",+ "ui.details_radius": "Radius",+ "ui.details_readout": "Readout",+ "ui.details_samples": "Samples",+ "ui.details_seam": "{body} · Edge {edge}",+ "ui.details_settings": "Settings",+ "ui.details_sharp_gap": "Sharp or gap",+ "ui.details_show_all": "Show all {count}",+ "ui.details_smooth": "Smooth",+ "ui.details_stripes": "Stripes",+ "ui.details_target": "Frame geometry",+ "ui.details_worst_seams": "Worst seams",+ "ui.details_zebra_caption": "Reflected stripes show how smoothly faces join."+ },+ "en-GB": {+ "ui.details_curvature_caption": "Faces are coloured by their local radius of curvature.",+ "ui.details_draft_caption": "Faces are coloured by their angle to the pull direction."+ },+ "he": {+ "cmd.view.status_details": "פרטי מצב חלון התצוגה",+ "prefs.viewport_status_details": "פרטים בזמן אמת בחלון התצוגה",+ "prefs.viewport_status_details_help": "עריכת הגדרות הניתוח והחתך הפעילים בכרטיסי פרטים אחידים. השבתה מחזירה את מקראי הניתוח לקריאה בלבד ואת תיבת הדו-שיח של חתך.",+ "ui.details_access_caption": "הפאות מציגות אם כלי יכול להגיע אליהן מהכיוון שנבחר.",+ "ui.details_angle": "זווית",+ "ui.details_continuity_caption": "עריכת התפר שנבחר. שאר התפרים שומרים על ההגדרות שלהם.",+ "ui.details_continuity_stale": "גאומטריה קודמת: יש להריץ שוב את הניתוח כדי לערוך את התפר הזה או להתאים את התצוגה אליו.",+ "ui.details_copy_list": "העתקת הרשימה",+ "ui.details_curvature": "סבולת עקמומיות",+ "ui.details_curvature_caption": "הפאות נצבעות לפי רדיוס העקמומיות המקומי שלהן.",+ "ui.details_direction": "כיוון הכלי",+ "ui.details_draft_caption": "הפאות נצבעות לפי הזווית שלהן ביחס לכיוון החליצה.",+ "ui.details_edit_seam": "עריכת תפר",+ "ui.details_fixture": "דוגמת רכיב ממשק — נתוני דוגמה בלבד",+ "ui.details_fixture_caption": "דוגמת רכיב ממשק עם ערכים להמחשה; זו אינה תוצאה של מודל.",+ "ui.details_fixture_problem": "ממצא לדוגמה עם בעיה",+ "ui.details_fixture_readout": "ערך מדידה לדוגמה",+ "ui.details_flip": "היפוך",+ "ui.details_gap": "פער",+ "ui.details_hatch": "קיווקוו פאות החתך",+ "ui.details_jump": "קפיצת עקמומיות",+ "ui.details_key": "מקרא",+ "ui.details_offset": "היסט",+ "ui.details_plane": "מישור",+ "ui.details_pull": "כיוון החליצה",+ "ui.details_radius": "רדיוס",+ "ui.details_readout": "ערכים נמדדים",+ "ui.details_samples": "דגימות",+ "ui.details_seam": "{body} · מקצוע {edge}",+ "ui.details_settings": "הגדרות",+ "ui.details_sharp_gap": "חד או בעל פער",+ "ui.details_show_all": "הצגת הכול ({count})",+ "ui.details_smooth": "חלק",+ "ui.details_stripes": "פסים",+ "ui.details_target": "התאמת התצוגה לגאומטריה",+ "ui.details_worst_seams": "התפרים הגרועים ביותר",+ "ui.details_zebra_caption": "פסי ההשתקפות מראים באיזו מידה הפאות מתחברות בצורה חלקה."+ },+ "ja": {+ "cmd.view.status_details": "ビューポートの状態の詳細",+ "prefs.viewport_status_details": "ビューポートのライブ詳細",+ "prefs.viewport_status_details_help": "標準の詳細カードで、実行中の解析と断面の設定を編集します。無効にすると、読み取り専用の解析凡例と断面ダイアログに戻ります。",+ "ui.details_access_caption": "選択した方向から工具が各面に届くかどうかを表示します。",+ "ui.details_angle": "角度",+ "ui.details_continuity_caption": "選択した継ぎ目を編集します。他の継ぎ目の設定は変更されません。",+ "ui.details_continuity_stale": "以前の形状です。この継ぎ目を編集または画面にフィットするには、解析を再実行してください。",+ "ui.details_copy_list": "リストをコピー",+ "ui.details_curvature": "曲率許容差",+ "ui.details_curvature_caption": "面は局所的な曲率半径に応じて色分けされます。",+ "ui.details_direction": "工具方向",+ "ui.details_draft_caption": "面は抜き方向に対する角度に応じて色分けされます。",+ "ui.details_edit_seam": "継ぎ目を編集",+ "ui.details_fixture": "UIコンポーネントの表示例 — サンプルデータのみ",+ "ui.details_fixture_caption": "説明用の値を用いたUIコンポーネントの表示例です。モデルの解析結果ではありません。",+ "ui.details_fixture_problem": "問題を示す検出結果の例",+ "ui.details_fixture_readout": "測定値の例",+ "ui.details_flip": "反転",+ "ui.details_gap": "間隔",+ "ui.details_hatch": "切断面をハッチング",+ "ui.details_jump": "曲率の不連続",+ "ui.details_key": "凡例",+ "ui.details_offset": "オフセット",+ "ui.details_plane": "平面",+ "ui.details_pull": "抜き方向",+ "ui.details_radius": "半径",+ "ui.details_readout": "測定値",+ "ui.details_samples": "サンプル数",+ "ui.details_seam": "{body} · エッジ {edge}",+ "ui.details_settings": "設定",+ "ui.details_sharp_gap": "角が鋭い、または間隔あり",+ "ui.details_show_all": "すべて表示({count} 件)",+ "ui.details_smooth": "滑らか",+ "ui.details_stripes": "縞模様",+ "ui.details_target": "形状を画面にフィット",+ "ui.details_worst_seams": "連続性の悪い継ぎ目",+ "ui.details_zebra_caption": "反射した縞模様で、面のつながりの滑らかさを確認できます。"+ },+ "ko": {+ "cmd.view.status_details": "뷰포트 상태 상세 정보",+ "prefs.viewport_status_details": "뷰포트 실시간 상세 정보",+ "prefs.viewport_status_details_help": "표준 상세 카드에서 활성 분석 및 단면 설정을 편집합니다. 끄면 읽기 전용 분석 범례와 단면 대화상자로 돌아갑니다.",+ "ui.details_access_caption": "선택한 방향에서 공구가 각 면에 도달할 수 있는지 표시합니다.",+ "ui.details_angle": "각도",+ "ui.details_continuity_caption": "선택한 이음부를 편집합니다. 다른 이음부는 각자의 설정을 유지합니다.",+ "ui.details_continuity_stale": "이전 형상입니다. 이 이음부를 편집하거나 화면에 맞추려면 분석을 다시 실행하세요.",+ "ui.details_copy_list": "목록 복사",+ "ui.details_curvature": "곡률 공차",+ "ui.details_curvature_caption": "각 면의 국소 곡률 반지름에 따라 색상이 표시됩니다.",+ "ui.details_direction": "공구 방향",+ "ui.details_draft_caption": "금형 분리 방향에 대한 각 면의 각도에 따라 색상이 표시됩니다.",+ "ui.details_edit_seam": "이음부 편집",+ "ui.details_fixture": "UI 구성 요소 예시 — 샘플 데이터만 표시",+ "ui.details_fixture_caption": "설명용 값을 사용하는 UI 구성 요소 예시입니다. 모델의 분석 결과가 아닙니다.",+ "ui.details_fixture_problem": "문제가 있는 결과 예시",+ "ui.details_fixture_readout": "측정값 예시",+ "ui.details_flip": "뒤집기",+ "ui.details_gap": "간격",+ "ui.details_hatch": "절단면 해칭",+ "ui.details_jump": "곡률 불연속",+ "ui.details_key": "범례",+ "ui.details_offset": "오프셋",+ "ui.details_plane": "평면",+ "ui.details_pull": "금형 분리 방향",+ "ui.details_radius": "반지름",+ "ui.details_readout": "측정값",+ "ui.details_samples": "샘플 수",+ "ui.details_seam": "{body} · 모서리 {edge}",+ "ui.details_settings": "설정",+ "ui.details_sharp_gap": "날카로운 이음 또는 간격",+ "ui.details_show_all": "전체 {count}개 표시",+ "ui.details_smooth": "매끄러움",+ "ui.details_stripes": "줄무늬",+ "ui.details_target": "형상에 맞게 보기 조정",+ "ui.details_worst_seams": "연속성이 가장 나쁜 이음부",+ "ui.details_zebra_caption": "반사된 줄무늬는 면이 얼마나 매끄럽게 이어지는지 보여 줍니다."+ },+ "vi": {+ "cmd.view.status_details": "Chi tiết trạng thái khung nhìn",+ "prefs.viewport_status_details": "Chi tiết trực tiếp trong khung nhìn",+ "prefs.viewport_status_details_help": "Chỉnh sửa thiết lập phân tích và mặt cắt đang hoạt động trong các thẻ chi tiết chuẩn. Tắt để khôi phục chú giải phân tích chỉ đọc và hộp thoại Mặt cắt.",+ "ui.details_access_caption": "Các bề mặt cho biết dụng cụ có thể tiếp cận chúng từ hướng đã chọn hay không.",+ "ui.details_angle": "Góc",+ "ui.details_continuity_caption": "Chỉnh sửa đường nối đã chọn. Các đường nối khác giữ nguyên thiết lập riêng.",+ "ui.details_continuity_stale": "Hình học trước đó: chạy lại phân tích để chỉnh sửa đường nối này hoặc điều chỉnh khung nhìn vừa với nó.",+ "ui.details_copy_list": "Sao chép danh sách",+ "ui.details_curvature": "Dung sai độ cong",+ "ui.details_curvature_caption": "Các bề mặt được tô màu theo bán kính cong cục bộ.",+ "ui.details_direction": "Hướng dụng cụ",+ "ui.details_draft_caption": "Các bề mặt được tô màu theo góc so với hướng tháo khuôn.",+ "ui.details_edit_seam": "Chỉnh sửa đường nối",+ "ui.details_fixture": "Mẫu thành phần giao diện — chỉ dùng dữ liệu minh họa",+ "ui.details_fixture_caption": "Mẫu thành phần giao diện với các giá trị minh họa; đây không phải là kết quả của mô hình.",+ "ui.details_fixture_problem": "Ví dụ kết quả có vấn đề",+ "ui.details_fixture_readout": "Ví dụ giá trị đo",+ "ui.details_flip": "Đảo hướng",+ "ui.details_gap": "Khe hở",+ "ui.details_hatch": "Gạch các mặt cắt",+ "ui.details_jump": "Gián đoạn độ cong",+ "ui.details_key": "Chú giải",+ "ui.details_offset": "Độ lệch",+ "ui.details_plane": "Mặt phẳng",+ "ui.details_pull": "Hướng tháo khuôn",+ "ui.details_radius": "Bán kính",+ "ui.details_readout": "Giá trị đo",+ "ui.details_samples": "Số mẫu",+ "ui.details_seam": "{body} · Cạnh {edge}",+ "ui.details_settings": "Thiết lập",+ "ui.details_sharp_gap": "Sắc cạnh hoặc có khe hở",+ "ui.details_show_all": "Hiển thị tất cả {count}",+ "ui.details_smooth": "Trơn mượt",+ "ui.details_stripes": "Sọc",+ "ui.details_target": "Điều chỉnh khung nhìn vừa với hình học",+ "ui.details_worst_seams": "Các đường nối kém nhất",+ "ui.details_zebra_caption": "Các sọc phản chiếu cho thấy mức độ trơn mượt khi các bề mặt nối với nhau."+ },+ "zh": {+ "cmd.view.status_details": "视口状态详情",+ "prefs.viewport_status_details": "视口实时详情",+ "prefs.viewport_status_details_help": "在标准详情卡片中编辑当前分析和剖面设置。禁用后恢复只读分析图例和剖面对话框。",+ "ui.details_access_caption": "面显示刀具能否从所选方向到达它们。",+ "ui.details_angle": "角度",+ "ui.details_continuity_caption": "编辑所选接缝。其他接缝保留各自的设置。",+ "ui.details_continuity_stale": "先前的几何体:请重新运行分析,以编辑此接缝或使其适合视图。",+ "ui.details_copy_list": "复制列表",+ "ui.details_curvature": "曲率容差",+ "ui.details_curvature_caption": "面按其局部曲率半径着色。",+ "ui.details_direction": "刀具方向",+ "ui.details_draft_caption": "面按其与脱模方向的夹角着色。",+ "ui.details_edit_seam": "编辑接缝",+ "ui.details_fixture": "界面组件示例 — 仅含示例数据",+ "ui.details_fixture_caption": "使用说明性数值的界面组件示例;这不是模型的分析结果。",+ "ui.details_fixture_problem": "含问题的检查结果示例",+ "ui.details_fixture_readout": "测量值示例",+ "ui.details_flip": "翻转",+ "ui.details_gap": "间隙",+ "ui.details_hatch": "为切割面添加剖面线",+ "ui.details_jump": "曲率突变",+ "ui.details_key": "图例",+ "ui.details_offset": "偏移",+ "ui.details_plane": "平面",+ "ui.details_pull": "脱模方向",+ "ui.details_radius": "半径",+ "ui.details_readout": "读数",+ "ui.details_samples": "采样数",+ "ui.details_seam": "{body} · 边 {edge}",+ "ui.details_settings": "设置",+ "ui.details_sharp_gap": "尖锐或有间隙",+ "ui.details_show_all": "显示全部 {count} 项",+ "ui.details_smooth": "光顺",+ "ui.details_stripes": "条纹",+ "ui.details_target": "使几何体适合视图",+ "ui.details_worst_seams": "连续性最差的接缝",+ "ui.details_zebra_caption": "反射条纹显示面之间连接的光顺程度。"+ }+}diff --git a/crates/engine/src/cmd/section.rs b/crates/engine/src/cmd/section.rsindex 80cc6d62da..ebae74fa2d 100644--- a/crates/engine/src/cmd/section.rs+++ b/crates/engine/src/cmd/section.rs@@ -1,15 +1,19 @@//! Section Analysis: a view-only cut through the model by a plane (what is on the plane's//! positive side is hidden). It changes no geometry and is not an undo step.-use serde_json::{Value, json};+use serde_json::Value;use solidcraft_geom::{Plane, Vec3};use super::CommandSpec;use crate::params::{bad, bool_, expr, vec3};+use crate::schema::{TypedContract, output_schema_for, section as contract};use crate::{Result, Session};+const SECTION: TypedContract<contract::SectionParams> = TypedContract::new();pub static COMMANDS: &[CommandSpec] =- &[CommandSpec::new("inspect.section", "Section Analysis", section).at("SOLID", "INSPECT").icon("section").noundo().params(+ &[CommandSpec::new("inspect.section", "Section Analysis", crate::checked!("inspect.section", section))+ .contract(&SECTION).output(output_schema_for::<contract::SectionResult>)+ .at("SOLID", "INSPECT").icon("section").noundo().params("plane: XY|XZ|YZ | construction plane name or id | {origin, normal}; offset?: expr along the plane's normal (XY: +Z, XZ: +Y, YZ: +X); \at?: expr, the cut's world coordinate on the named plane's axis (XY: Z, XZ: Y, YZ: X), instead of offset; \flip?: bool; hatch?: bool (hatch the cut faces, in each body's colour; default true); or clear: true. Returns the cut's origin and normal, and for a named plane its axis and at",@@ -21,7 +25,7 @@ fn section(s: &mut Session, p: &Value) -> Result<Value> {s.section = None;s.status_slot(crate::status_items::StatusId::Section, false);s.revision += 1;- return Ok(json!({"section": null}));+ return serde_json::to_value(contract::SectionResult { section: None, param_warnings: Vec::new() }).map_err(|e| bad(cmd, e.to_string()));}// A named plane's world axis: which component of a point lies along its normal.let (origin, normal, axis) = match p.get("plane") {@@ -79,12 +83,14 @@ fn section(s: &mut Session, p: &Value) -> Result<Value> {s.status_slot(crate::status_items::StatusId::Section, true);s.status_activated(crate::status_items::StatusId::Section);s.revision += 1;- let mut section = json!({"origin": origin, "normal": normal, "hatch": s.section_hatch});- if let Some(i) = axis {- section["axis"] = json!(["X", "Y", "Z"].get(i).copied().unwrap_or("?"));- section["at"] = json!(axis_component(origin, i));- }- Ok(json!({"section": section}))+ let section = contract::Section {+ origin: [origin.x, origin.y, origin.z],+ normal: [normal.x, normal.y, normal.z],+ hatch: s.section_hatch,+ axis: axis.and_then(|i| ["X", "Y", "Z"].get(i).map(|v| (*v).to_owned())),+ at: axis.map(|i| axis_component(origin, i)),+ };+ serde_json::to_value(contract::SectionResult { section: Some(section), param_warnings: Vec::new() }).map_err(|e| bad(cmd, e.to_string()))}fn axis_component(v: Vec3, i: usize) -> f64 {diff --git a/crates/engine/src/cmd/surface_analysis.rs b/crates/engine/src/cmd/surface_analysis.rsindex cc73d98f3a..cd1c051c7b 100644--- a/crates/engine/src/cmd/surface_analysis.rs+++ b/crates/engine/src/cmd/surface_analysis.rs@@ -1,13 +1,21 @@//! Surface analyses: zebra stripes, draft angle and curvature map shading of the model's faces.//! View state only: no geometry changes and no undo step.-use serde_json::{Value, json};+use serde_json::Value;use solidcraft_geom::Vec3;use super::CommandSpec;use crate::params::{bad, bool_, num, str_, vec3};+use crate::schema::{TypedContract, output_schema_for, surface_analysis as contract};use crate::{ContinuitySeam, Result, Session, SurfaceAnalysis, kernel};+const ZEBRA: TypedContract<contract::ZebraParams> = TypedContract::new();+const DRAFT: TypedContract<contract::DraftParams> = TypedContract::new();+const ENVIRONMENT: TypedContract<contract::EnvironmentParams> = TypedContract::new();+const ACCESSIBILITY: TypedContract<contract::AccessibilityParams> = TypedContract::new();+const CURVATURE: TypedContract<contract::CurvatureParams> = TypedContract::new();+const CONTINUITY: TypedContract<contract::ContinuityParams> = TypedContract::new();+/// Stations along each edge when the call does not say (`samples`).const DEFAULT_SAMPLES: usize = 33;/// Tolerances a seam is judged against when the call does not say: a micron of position gap, a@@ -20,42 +28,62 @@ const MAX_PICKS: usize = 512;const MAX_BODIES: usize = 64;pub static COMMANDS: &[CommandSpec] = &[- CommandSpec::new("inspect.zebra", "Zebra Analysis", zebra)+ CommandSpec::new("inspect.zebra", "Zebra Analysis", crate::checked!("inspect.zebra", zebra))+ .contract(&ZEBRA)+ .output(output_schema_for::<contract::AnalysisResult>).at("SKETCH", "INSPECT").icon("zebra").noundo().params("stripes?: number across the view (default 12); clear?: true turns the analysis off"),- CommandSpec::new("inspect.draft", "Draft Analysis", draft)+ CommandSpec::new("inspect.draft", "Draft Analysis", crate::checked!("inspect.draft", draft))+ .contract(&DRAFT)+ .output(output_schema_for::<contract::AnalysisResult>).at("SKETCH", "INSPECT").icon("draft_analysis").noundo().params("pull?: [x,y,z] direction (default Z); angle?: degrees (default 1); clear?: true turns the analysis off"),- CommandSpec::new("inspect.environment_map", "Environment Map Analysis", |s, p| set(s, p, SurfaceAnalysis::Environment))+ CommandSpec::new("inspect.environment_map", "Environment Map Analysis", crate::checked!("inspect.environment_map", environment))+ .contract(&ENVIRONMENT)+ .output(output_schema_for::<contract::AnalysisResult>).at("SKETCH", "INSPECT").icon("environment_map").noundo().params("clear?: true turns the analysis off"),- CommandSpec::new("inspect.accessibility", "Accessibility Analysis", accessibility)+ CommandSpec::new("inspect.accessibility", "Accessibility Analysis", crate::checked!("inspect.accessibility", accessibility))+ .contract(&ACCESSIBILITY)+ .output(output_schema_for::<contract::AnalysisResult>).at("SKETCH", "INSPECT").icon("accessibility").noundo().params("direction?: [x,y,z] the tool comes from (default Z, from above); clear?: true turns the analysis off"),- CommandSpec::new("inspect.curvature_map", "Curvature Map Analysis", curvature_map)+ CommandSpec::new("inspect.curvature_map", "Curvature Map Analysis", crate::checked!("inspect.curvature_map", curvature_map))+ .contract(&CURVATURE)+ .output(output_schema_for::<contract::AnalysisResult>).at("SKETCH", "INSPECT").icon("curvature_map").noundo().params("radius?: mm shown red (default: a tenth of the model's size); clear?: true turns the analysis off"),- CommandSpec::new("inspect.continuity", "Continuity Analysis", continuity).at("SURFACE", "INSPECT").icon("continuity").noundo().params(- "body?: name (default: the visible bodies); edges?: [x,y,z] points or {\"index\": i} (default: every edge of the body; \+ CommandSpec::new("inspect.continuity", "Continuity Analysis", crate::checked!("inspect.continuity", continuity))+ .contract(&CONTINUITY)+ .output(output_schema_for::<contract::ContinuityResult>)+ .at("SURFACE", "INSPECT")+ .icon("continuity")+ .noundo()+ .params(+ "body?: name (default: the visible bodies); edges?: [x,y,z] points or {\"index\": i} (default: every edge of the body; \a pick must match one body); samples?: 3…257 stations along each edge, ends included (default 33); \gap_tolerance_mm? (default 0.001), angle_tolerance_deg? (default 1), curvature_tolerance_per_mm? (default 0.01); \add?: true keeps the seams already shaded and adds these (measuring an edge again replaces it); \clear?: true turns the analysis off. → each edge's worst gap (G0), normal angle (G1) and curvature jump (G2) as \{value, at: [x,y,z], edge_fraction}, its verdict (smooth, curvature_jump, sharp or gap) and a summary; \the seams are shaded in the viewport",- ),+ ),];+fn environment(s: &mut Session, p: &Value) -> Result<Value> {+ set(s, p, SurfaceAnalysis::Environment)+}+fn set(s: &mut Session, p: &Value, a: SurfaceAnalysis) -> Result<Value> {if bool_(p, "clear").unwrap_or(false) {s.analysis = None;@@ -64,7 +92,15 @@ fn set(s: &mut Session, p: &Value, a: SurfaceAnalysis) -> Result<Value> {}s.status_analysis_changed((!bool_(p, "clear").unwrap_or(false)).then_some(crate::status_items::StatusId::SurfaceAnalysis));s.revision += 1;- Ok(json!({ "analysis": s.analysis }))+ let vector = |v: Vec3| [v.x, v.y, v.z];+ let analysis = s.analysis.map(|a| match a {+ SurfaceAnalysis::Zebra { stripes } => contract::Analysis::Zebra { stripes },+ SurfaceAnalysis::Draft { pull, angle } => contract::Analysis::Draft { pull: vector(pull), angle },+ SurfaceAnalysis::Curvature { radius } => contract::Analysis::Curvature { radius },+ SurfaceAnalysis::Environment => contract::Analysis::Environment,+ SurfaceAnalysis::Access { dir } => contract::Analysis::Access { dir: vector(dir) },+ });+ serde_json::to_value(contract::AnalysisResult { analysis, param_warnings: Vec::new() }).map_err(|e| bad("surface analysis", e.to_string()))}fn zebra(s: &mut Session, p: &Value) -> Result<Value> {@@ -120,7 +156,12 @@ fn continuity(s: &mut Session, p: &Value) -> Result<Value> {s.continuity.clear();s.status_analysis_changed(None);s.revision += 1;- return Ok(json!({ "analysis": "continuity", "cleared": true }));+ return serde_json::to_value(contract::ContinuityResult::Cleared {+ analysis: "continuity".into(),+ cleared: true,+ param_warnings: Vec::new(),+ })+ .map_err(|e| bad(cmd, e.to_string()));}let samples = match p.get("samples") {None => DEFAULT_SAMPLES,@@ -180,25 +221,49 @@ fn continuity(s: &mut Session, p: &Value) -> Result<Value> {let mut rows = Vec::new();for seam in &report.seams {summary.count(seam.verdict);- seams.push(ContinuitySeam { body: body.name.clone(), edge: seam.edge, points: seam.points.clone(), verdict: seam.verdict });- rows.push(json!({- "edge": seam.edge,- "length_mm": seam.length,- "samples": seam.samples,- "gap_mm": seam.gap_mm,- "normal_angle_deg": seam.normal_angle_deg,- "curvature_jump_per_mm": seam.curvature_jump_per_mm,- "verdict": seam.verdict,- }));+ seams.push(ContinuitySeam {+ body: body.name.clone(),+ edge: seam.edge,+ points: seam.points.clone(),+ verdict: seam.verdict,+ details: crate::status_details::ContinuityDetail {+ body: body.name.clone(),+ edge: seam.edge,+ samples: seam.samples,+ gap_tolerance_mm: tolerances.gap_mm,+ angle_tolerance_deg: tolerances.angle_deg,+ curvature_tolerance_per_mm: tolerances.curvature_per_mm,+ gap_mm: seam.gap_mm.value,+ normal_angle_deg: seam.normal_angle_deg.value,+ curvature_jump_per_mm: seam.curvature_jump_per_mm.value,+ length_mm: seam.length,+ verdict: seam.verdict.into(),+ gap_at: [seam.gap_mm.at.x, seam.gap_mm.at.y, seam.gap_mm.at.z],+ gap_fraction: seam.gap_mm.edge_fraction,+ normal_angle_at: [seam.normal_angle_deg.at.x, seam.normal_angle_deg.at.y, seam.normal_angle_deg.at.z],+ normal_angle_fraction: seam.normal_angle_deg.edge_fraction,+ curvature_jump_at: [seam.curvature_jump_per_mm.at.x, seam.curvature_jump_per_mm.at.y, seam.curvature_jump_per_mm.at.z],+ curvature_jump_fraction: seam.curvature_jump_per_mm.edge_fraction,+ skipped: report.skipped,+ unmeasured: report.unmeasured,+ current: true,+ geometry_key: body.geometry_key(),+ feature: body.feature,+ },+ });+ rows.push(contract::EdgeReport {+ edge: seam.edge,+ length_mm: seam.length,+ samples: seam.samples,+ gap_mm: metric(seam.gap_mm),+ normal_angle_deg: metric(seam.normal_angle_deg),+ curvature_jump_per_mm: metric(seam.curvature_jump_per_mm),+ verdict: verdict(seam.verdict),+ });}summary.skipped += report.skipped;summary.unmeasured += report.unmeasured;- bodies.push(json!({- "body": body.name,- "edges": rows,- "skipped": report.skipped,- "unmeasured": report.unmeasured,- }));+ bodies.push(contract::BodyReport { body: body.name.clone(), edges: rows, skipped: report.skipped, unmeasured: report.unmeasured });}if bool_(p, "add").unwrap_or(false) {// The seams shown stay; an edge measured again takes its new reading.@@ -209,26 +274,40 @@ fn continuity(s: &mut Session, p: &Value) -> Result<Value> {}s.status_analysis_changed(Some(crate::status_items::StatusId::Continuity));s.revision += 1;- Ok(json!({- "analysis": "continuity",- "samples": samples,- "tolerances": {- "gap_mm": tolerances.gap_mm,- "angle_deg": tolerances.angle_deg,- "curvature_per_mm": tolerances.curvature_per_mm,+ serde_json::to_value(contract::ContinuityResult::Measured {+ analysis: "continuity".into(),+ samples,+ tolerances: contract::Tolerances {+ gap_mm: tolerances.gap_mm,+ angle_deg: tolerances.angle_deg,+ curvature_per_mm: tolerances.curvature_per_mm,},- "bodies": bodies,- "summary": {- "edges": summary.edges,- "smooth": summary.smooth,- "curvature_jump": summary.curvature_jump,- "sharp": summary.sharp,- "gap": summary.gap,- "skipped": summary.skipped,- "unmeasured": summary.unmeasured,- "worst": summary.worst(),+ bodies,+ summary: contract::Summary {+ edges: summary.edges,+ smooth: summary.smooth,+ curvature_jump: summary.curvature_jump,+ sharp: summary.sharp,+ gap: summary.gap,+ skipped: summary.skipped,+ unmeasured: summary.unmeasured,+ worst: summary.worst().map(verdict),},- }))+ param_warnings: Vec::new(),+ })+ .map_err(|e| bad(cmd, e.to_string()))+}++fn verdict(value: kernel::SeamVerdict) -> contract::Verdict {+ match value {+ kernel::SeamVerdict::Smooth => contract::Verdict::Smooth,+ kernel::SeamVerdict::CurvatureJump => contract::Verdict::CurvatureJump,+ kernel::SeamVerdict::Sharp => contract::Verdict::Sharp,+ kernel::SeamVerdict::Gap => contract::Verdict::Gap,+ }+}+fn metric(value: kernel::SeamWorst) -> contract::Metric {+ contract::Metric { value: value.value, at: [value.at.x, value.at.y, value.at.z], edge_fraction: value.edge_fraction }}/// A tolerance parameter. A value that is given but unusable (NaN, infinity, negative, a@@ -682,6 +761,59 @@ mod tests {assert!(s.status_order.is_empty(), "new design resets transient chronology");}+ #[test]+ fn continuity_details_never_validate_old_matching_geometry_during_a_live_drag() {+ use std::sync::Arc;+ let mut s = Session::default();+ for (command, params) in [+ ("sketch.create", json!({"plane":"XY"})),+ ("sketch.rectangle.two_point", json!({"p0":[5,5],"p1":[25,20]})),+ ("sketch.dimension", json!({"entities":["l1"],"value":20})),+ ("sketch.dimension", json!({"entities":["l2"],"value":15})),+ ("sketch.finish", json!({})),+ ("solid.extrude", json!({"distance":5})),+ ("inspect.continuity", json!({"samples":5})),+ ("sketch.edit", json!({"sketch":"Sketch1"})),+ ] {+ s.execute(command, ¶ms).unwrap();+ }+ let records = s.continuity.clone();+ assert!(!records.is_empty());+ assert!(s.continuity_details().iter().all(|row| row.current));+ let before_drag = s.model.state();+ s.execute("sketch.drag", &json!({"entity":"l1.start","from":[5,5],"to":[4,5],"live":true})).unwrap();+ assert!(s.model.is_stale());+ // The live solver replaces ModelState to show the moved sketch, while retaining+ // its old downstream B-rep body. That body/key, not the whole container Arc,+ // is the misleading geometry the pure descriptor must refuse.+ let retained_model = s.model.state();+ assert!(before_drag.body(&records[0].body).unwrap().body.same_shape(&retained_model.body(&records[0].body).unwrap().body));+ assert_eq!(+ retained_model.body(&records[0].body).unwrap().geometry_key(),+ records[0].details.geometry_key,+ "this real pending edit retains exactly the misleading old matching geometry key"+ );+ let document = s.doc.clone();+ let before = (s.revision, s.undo.len(), s.redo.len(), s.is_dirty(), s.evaluations, s.status_order.clone());+ for _ in 0..3 {+ let reply = s.execute("view.status_details", &json!({})).unwrap();+ assert!(reply["continuity"].as_array().unwrap().iter().all(|row| row["current"] == false));+ assert!(s.continuity_target_points(&records[0].body, records[0].edge).is_none());+ }+ assert!(s.model.is_stale());+ assert!(Arc::ptr_eq(&document, &s.doc));+ assert!(Arc::ptr_eq(&retained_model, &s.model.state()));+ assert_eq!(s.continuity, records, "query does not clean or fabricate measurements");+ assert_eq!((s.revision, s.undo.len(), s.redo.len(), s.is_dirty(), s.evaluations, s.status_order.clone()), before);+ s.execute("sketch.drag_end", &json!({})).unwrap();+ s.execute("sketch.finish", &json!({})).unwrap();+ s.execute("inspect.continuity", &json!({"samples":5})).unwrap();+ assert!(!s.model.is_stale());+ assert!(s.continuity_details().iter().all(|row| row.current));+ let fresh = &s.continuity[0];+ assert!(s.continuity_target_points(&fresh.body, fresh.edge).is_some(), "normal fresh evaluation/measurement restores valid targets");+ }+/// The edges of the first body of a continuity reply.fn edges(v: &Value) -> &Vec<Value> {v["bodies"][0]["edges"].as_array().unwrap_or_else(|| panic!("no edges in {v}"))@@ -827,6 +959,112 @@ mod tests {}/// Hostile parameters are refused with an error, never a panic.+ #[test]+ fn continuity_details_keep_successful_per_record_settings_and_query_is_pure() {+ let mut s = Session::default();+ boxed(&mut s, 10.0);+ let first = s+ .execute(+ "inspect.continuity",+ &json!({"edges":[[5,0,0]],"samples":5,"gap_tolerance_mm":0.002,"angle_tolerance_deg":2,"curvature_tolerance_per_mm":0.03}),+ )+ .unwrap();+ let old = s.continuity[0].clone();+ s.execute(+ "inspect.continuity",+ &json!({"edges":[[0,5,0]],"samples":9,"gap_tolerance_mm":0.007,"angle_tolerance_deg":4,"curvature_tolerance_per_mm":0.06,"add":true}),+ )+ .unwrap();+ let rows = s.continuity_details();+ assert_eq!(rows.len(), 2);+ assert_eq!(rows[0].samples, 5);+ assert_eq!(rows[0].gap_tolerance_mm, 0.002);+ assert_eq!(rows[1].samples, 9);+ assert_eq!(rows[1].angle_tolerance_deg, 4.0);+ assert!(rows.iter().all(|row| row.current));+ assert_eq!(rows[0].gap_mm, first["bodies"][0]["edges"][0]["gap_mm"]["value"].as_f64().unwrap());+ assert_eq!(rows[0].gap_at, serde_json::from_value::<[f64; 3]>(first["bodies"][0]["edges"][0]["gap_mm"]["at"].clone()).unwrap());+ let before = (s.revision, s.doc.to_json(), s.undo.len(), s.status_activation.clone(), s.continuity.clone(), s.is_dirty());+ for _ in 0..3 {+ let query = s.execute("view.status_details", &json!({})).unwrap();+ assert_eq!(query["continuity"][0]["samples"], 5);+ assert_eq!(query["continuity"][1]["samples"], 9);+ }+ assert_eq!((s.revision, s.doc.to_json(), s.undo.len(), s.status_activation.clone(), s.continuity.clone(), s.is_dirty()), before);+ assert!(s.execute("view.status_details", &json!({"extra":true})).is_err());+ assert!(s.execute("inspect.continuity", &json!({"body":old.body,"edges":[{"index":old.edge}],"samples":2,"add":true})).is_err());+ assert_eq!(s.continuity, before.4, "failed live update is atomic across mixed settings");+ s.execute("inspect.continuity",&json!({"body":old.body,"edges":[{"index":old.edge}],"samples":7,"gap_tolerance_mm":old.details.gap_tolerance_mm,"angle_tolerance_deg":old.details.angle_tolerance_deg,"curvature_tolerance_per_mm":old.details.curvature_tolerance_per_mm,"add":true})).unwrap();+ let remaining = s.continuity.iter().find(|row| row.edge != old.edge).unwrap();+ assert_eq!(remaining.details, rows[1]);+ assert_eq!(s.continuity.iter().find(|row| row.edge == old.edge).unwrap().details.samples, 7);+ }++ #[test]+ fn continuity_targets_follow_geometry_identity_rather_than_view_revision() {+ let mut s = Session::default();+ boxed(&mut s, 10.0);+ s.execute("inspect.continuity", &json!({"edges":[[5,0,0]],"samples":5})).unwrap();+ let seam = s.continuity[0].clone();+ let revision = s.revision;+ s.execute("view.apply", &json!({"camera":{"target":[1,2,3],"yaw":0,"pitch":0,"distance":40}})).unwrap();+ assert_eq!(s.camera.unwrap().target, solidcraft_geom::Vec3::new(1.0, 2.0, 3.0));+ // Camera apply is an echo; these real display changes advance Session's view revision.+ s.execute("browser.visibility", &json!({"items":[seam.body],"visible":false})).unwrap();+ s.execute("browser.visibility", &json!({"items":[seam.body],"visible":true})).unwrap();+ assert!(s.revision > revision);+ assert!(s.continuity_target_points(&seam.body, seam.edge).is_some());+ s.execute("body.rename", &json!({"body":seam.body,"name":"Renamed"})).unwrap();+ assert!(!s.continuity_details()[0].current);+ assert!(s.continuity_target_points(&seam.body, seam.edge).is_none());+ s.execute("edit.undo", &json!({})).unwrap();+ assert!(s.continuity_details()[0].current, "restored matching geometry may be targeted again");+ let feature = s.doc.features[0].id;+ s.execute("timeline.redefine", &json!({"feature":feature,"command":"solid.box","params":{"length":20,"width":10,"height":10}})).unwrap();+ assert!(!s.continuity_details()[0].current);+ assert!(s.continuity_target_points(&seam.body, seam.edge).is_none());+ s.execute("edit.undo", &json!({})).unwrap();+ let restored_key = s.model.state().body(&seam.body).unwrap().geometry_key();+ assert_ne!(+ restored_key, seam.details.geometry_key,+ "feature redefinition undo produces a new evaluated generation, despite restoring dimensions"+ );+ assert!(!s.continuity_details()[0].current);+ assert!(s.continuity_target_points(&seam.body, seam.edge).is_none());+ s.execute("inspect.continuity",&json!({"body":seam.body,"edges":[{"index":seam.edge}],"samples":seam.details.samples,+ "gap_tolerance_mm":seam.details.gap_tolerance_mm,"angle_tolerance_deg":seam.details.angle_tolerance_deg,"curvature_tolerance_per_mm":seam.details.curvature_tolerance_per_mm})).unwrap();+ assert!(s.continuity_details()[0].current, "a real fresh report validates the restored geometry generation");+ assert!(s.continuity_target_points(&seam.body, seam.edge).is_some());+ s.execute("edit.redo", &json!({})).unwrap();+ assert!(!s.continuity_details()[0].current);+ s.execute("inspect.continuity", &json!({"clear":true})).unwrap();+ assert!(s.continuity_details().is_empty());+ }++ #[test]+ fn continuity_details_reject_changed_occurrence_placement_without_query_evaluation() {+ let mut s = Session::default();+ let component = s.execute("component.create", &json!({"name":"Part","grounded":false})).unwrap();+ let occurrence = component["occurrence"].as_u64().unwrap();+ s.execute("solid.box", &json!({"length":10,"width":10,"height":10,"body_name":"PartBody"})).unwrap();+ s.execute("component.activate", &json!({"component":0})).unwrap();+ s.execute("inspect.continuity", &json!({"body":"PartBody","edges":[[5,0,0]],"samples":5})).unwrap();+ let record = s.continuity[0].clone();+ assert!(s.continuity_details()[0].current);+ s.execute("occurrence.move", &json!({"occurrence":occurrence,"translate":[0,20,0],"capture":false})).unwrap();+ assert!(s.pending_moves.contains_key(&occurrence), "this test intentionally exercises a pending, revertible placement");+ let revision = s.revision;+ assert!(!s.continuity_details()[0].current);+ assert_eq!(s.revision, revision, "descriptor does not prepare a stale world or mutate it");+ let _placed = s.world_state();+ assert!(!s.continuity_details()[0].current, "a warmed moved occurrence is still different geometry placement");+ assert!(s.continuity_target_points(&record.body, record.edge).is_none());+ s.execute("component.revert_position", &json!({"occurrences":[occurrence]})).unwrap();+ assert!(!s.pending_moves.contains_key(&occurrence));+ let _restored = s.world_state();+ assert!(s.continuity_details()[0].current, "matching restored placement is validated by real geometry identity");+ }+#[test]fn hostile_continuity_params_are_refused() {let mut s = Session::default();diff --git a/crates/engine/src/cmd/view_navigation.rs b/crates/engine/src/cmd/view_navigation.rsindex 4e34336d17..a69ddc0d51 100644--- a/crates/engine/src/cmd/view_navigation.rs+++ b/crates/engine/src/cmd/view_navigation.rs@@ -35,6 +35,10 @@ const RENDER_SELECT: TypedContract<RenderSelect> = TypedContract::new();const STATUS_ITEMS_CONTRACT: TypedContract<crate::schema::view_navigation::StatusItemsParams> = TypedContract::new();pub static COMMANDS: &[CommandSpec] = &[+CommandSpec::new("view.status_details", "Viewport Status Details", crate::checked!("view.status_details", status_details))+ .icon("list").noundo().doc_only()+ .contract(&STATUS_ITEMS_CONTRACT).output(output_schema_for::<crate::status_details::StatusDetails>)+ .params("no parameters → current effect settings/detail capabilities and retained per-seam Continuity diagnostics, with current geometry validity; read-only, no evaluation"),CommandSpec::new("view.status_items", "Viewport Status Items", crate::checked!("view.status_items", status_items)).icon("list").noundo().doc_only().contract(&STATUS_ITEMS_CONTRACT).output(output_schema_for::<crate::status_items::StatusItems>)@@ -186,6 +190,23 @@ fn normal_target(s: &Session) -> Option<(solidcraft_geom::Vec3, solidcraft_geom:})}+fn status_details(s: &mut Session, p: &Value) -> Result<Value> {+ let p = if p.is_null() { json!({}) } else { p.clone() };+ if !p.as_object().is_some_and(|object| object.is_empty()) {+ return Err(bad("view.status_details", "parameters must be an empty object"));+ }+ let _: crate::schema::view_navigation::StatusItemsParams = serde_json::from_value(p).map_err(|e| bad("view.status_details", e.to_string()))?;+ let items =+ s.status_items().into_iter().map(|source| crate::status_details::StatusDetailItem { has_details: source.has_details(), source }).collect();+ serde_json::to_value(crate::status_details::StatusDetails {+ document_id: s.document_id.clone(),+ items,+ continuity: s.continuity_details(),+ param_warnings: Vec::new(),+ })+ .map_err(|e| bad("view.status_details", e.to_string()))+}+fn normal_to(s: &mut Session, p: &Value) -> Result<Value> {let cmd = "view.normal_to";let (point, normal) = normal_target(s).ok_or_else(|| bad(cmd, "select a planar face or plane"))?;diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rsindex 6989149acb..a860dd7edd 100644--- a/crates/engine/src/lib.rs+++ b/crates/engine/src/lib.rs@@ -33,6 +33,7 @@ pub mod slicer_files;mod slicer_icon;pub mod slicers;pub mod snap;+pub mod status_details;pub mod status_items;pub mod timing;pub mod view;@@ -593,6 +594,8 @@ pub struct ContinuitySeam {pub points: Vec<Vec3>,/// The seam's worst verdict along its length.pub verdict: kernel::SeamVerdict,+ /// Successful measurement settings and diagnostics, owned by this particular seam.+ pub details: status_details::ContinuityDetail,}impl SurfaceAnalysis {diff --git a/crates/engine/src/schema/mod.rs b/crates/engine/src/schema/mod.rsindex 04a13fbe40..fa7b7a5920 100644--- a/crates/engine/src/schema/mod.rs+++ b/crates/engine/src/schema/mod.rs@@ -63,10 +63,12 @@ pub mod print_face;pub mod render;pub mod render_lights;pub mod render_ui;+pub mod section;pub mod sheet;pub mod sketch_constraints;pub mod sketch_create;pub mod sketch_equation;+pub mod surface_analysis;pub mod view_navigation;pub use check::{Contract, Issue, ParamCheck, TypedContract, input_schema_for, issues, output_schema_for, run_checked, run_checked_as};diff --git a/crates/engine/src/schema/section.rs b/crates/engine/src/schema/section.rsnew file mode 100644index 0000000000..a99e66b8b3--- /dev/null+++ b/crates/engine/src/schema/section.rs@@ -0,0 +1,43 @@+//! Section clipping contract. Explicit planes use numerical millimetre coordinates.+use super::{AxisDir, LengthExpr, Point3, present};+use schemars::JsonSchema;+use serde::{Deserialize, Serialize};++#[derive(Debug, Deserialize, JsonSchema)]+#[serde(untagged)]+pub enum Plane {+ Name(String),+ Id(u64),+ Explicit { origin: Option<Point3>, normal: AxisDir },+}+#[derive(Debug, Deserialize, JsonSchema)]+#[schemars(deny_unknown_fields)]+pub struct SectionParams {+ /// Required unless clearing. XY/XZ/YZ, construction name/id, or {origin?,normal}.+ #[serde(default, deserialize_with = "present", skip_serializing_if = "Option::is_none")]+ #[schemars(with = "Plane")]+ pub plane: Option<Plane>,+ /// Signed distance along the original plane normal, in design units or an expression.+ pub offset: Option<LengthExpr>,+ /// World coordinate on a named plane's normal axis; mutually exclusive with offset.+ pub at: Option<LengthExpr>,+ pub flip: Option<bool>,+ pub hatch: Option<bool>,+ pub clear: Option<bool>,+}+#[derive(Serialize, JsonSchema)]+pub struct Section {+ pub origin: [f64; 3],+ pub normal: [f64; 3],+ pub hatch: bool,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub axis: Option<String>,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub at: Option<f64>,+}+#[derive(Serialize, JsonSchema)]+pub struct SectionResult {+ pub section: Option<Section>,+ #[serde(default, skip_serializing_if = "Vec::is_empty")]+ pub param_warnings: Vec<String>,+}diff --git a/crates/engine/src/schema/surface_analysis.rs b/crates/engine/src/schema/surface_analysis.rsnew file mode 100644index 0000000000..72c37800ea--- /dev/null+++ b/crates/engine/src/schema/surface_analysis.rs@@ -0,0 +1,163 @@+//! Contracts for view-only surface analyses; the handlers validate domain ranges.+use super::{AxisDir, Point3, present};+use schemars::JsonSchema;+use serde::{Deserialize, Serialize};++#[derive(Debug, Deserialize, JsonSchema)]+#[schemars(deny_unknown_fields)]+pub struct ZebraParams {+ /// Stripe frequency across the view, including fractional values. Default 12; 1…200.+ pub stripes: Option<f64>,+ pub clear: Option<bool>,+}+#[derive(Debug, Deserialize, JsonSchema)]+#[schemars(deny_unknown_fields)]+pub struct DraftParams {+ /// Nonzero pull direction. Default +Z; normalised by the handler.+ #[serde(default, deserialize_with = "present", skip_serializing_if = "Option::is_none")]+ #[schemars(with = "AxisDir")]+ pub pull: Option<AxisDir>,+ /// Threshold in degrees, 0 inclusive to 90 exclusive. Default 1.+ pub angle: Option<f64>,+ pub clear: Option<bool>,+}+#[derive(Debug, Deserialize, JsonSchema)]+#[schemars(deny_unknown_fields)]+pub struct EnvironmentParams {+ pub clear: Option<bool>,+}+#[derive(Debug, Deserialize, JsonSchema)]+#[schemars(deny_unknown_fields)]+pub struct AccessibilityParams {+ /// Nonzero direction the tool comes from. Default +Z.+ #[serde(default, deserialize_with = "present", skip_serializing_if = "Option::is_none")]+ #[schemars(with = "AxisDir")]+ pub direction: Option<AxisDir>,+ pub clear: Option<bool>,+}+#[derive(Debug, Deserialize, JsonSchema)]+#[schemars(deny_unknown_fields)]+pub struct CurvatureParams {+ /// Radius in mm shown red, greater than 1e-6 and less than 1e9.+ /// Default a tenth of the largest model diagonal, or 10 mm for an empty model.+ pub radius: Option<f64>,+ pub clear: Option<bool>,+}+#[derive(Debug, Deserialize, JsonSchema)]+#[serde(untagged)]+pub enum EdgePick {+ Index { index: usize },+ Point(Point3),+}+#[derive(Debug, Deserialize, JsonSchema)]+#[schemars(deny_unknown_fields)]+pub struct ContinuityParams {+ /// Body name; otherwise visible bodies. At most 64 bodies in one call.+ pub body: Option<String>,+ /// At most 512 edge indices or points. Empty/absent measures all seams.+ #[serde(default, deserialize_with = "present", skip_serializing_if = "Option::is_none")]+ #[schemars(with = "Vec<EdgePick>")]+ pub edges: Option<Vec<EdgePick>>,+ /// Integer stations per edge, 3…257. Default 33.+ #[serde(default, deserialize_with = "present", skip_serializing_if = "Option::is_none")]+ #[schemars(with = "f64")]+ pub samples: Option<f64>,+ /// Positional tolerance in mm, 0…1e9 exclusive. Default .001.+ #[serde(default, deserialize_with = "present", skip_serializing_if = "Option::is_none")]+ #[schemars(with = "f64")]+ pub gap_tolerance_mm: Option<f64>,+ /// Normal angle tolerance in degrees. Default 1.+ #[serde(default, deserialize_with = "present", skip_serializing_if = "Option::is_none")]+ #[schemars(with = "f64")]+ pub angle_tolerance_deg: Option<f64>,+ /// Curvature tolerance in inverse mm. Default .01.+ #[serde(default, deserialize_with = "present", skip_serializing_if = "Option::is_none")]+ #[schemars(with = "f64")]+ pub curvature_tolerance_per_mm: Option<f64>,+ /// Preserve other measured seams, replacing only matching body/edge records.+ pub add: Option<bool>,+ pub clear: Option<bool>,+}++#[derive(Serialize, JsonSchema)]+#[serde(tag = "type", rename_all = "snake_case")]+pub enum Analysis {+ Zebra { stripes: f64 },+ Draft { pull: [f64; 3], angle: f64 },+ Curvature { radius: f64 },+ Environment,+ Access { dir: [f64; 3] },+}+#[derive(Serialize, JsonSchema)]+pub struct AnalysisResult {+ pub analysis: Option<Analysis>,+ #[serde(default, skip_serializing_if = "Vec::is_empty")]+ pub param_warnings: Vec<String>,+}+#[derive(Serialize, JsonSchema)]+pub struct Metric {+ pub value: f64,+ pub at: [f64; 3],+ pub edge_fraction: f64,+}+#[derive(Serialize, JsonSchema)]+#[serde(rename_all = "snake_case")]+pub enum Verdict {+ Smooth,+ CurvatureJump,+ Sharp,+ Gap,+}+#[derive(Serialize, JsonSchema)]+pub struct EdgeReport {+ pub edge: usize,+ pub length_mm: f64,+ pub samples: usize,+ pub gap_mm: Metric,+ pub normal_angle_deg: Metric,+ pub curvature_jump_per_mm: Metric,+ pub verdict: Verdict,+}+#[derive(Serialize, JsonSchema)]+pub struct BodyReport {+ pub body: String,+ pub edges: Vec<EdgeReport>,+ pub skipped: usize,+ pub unmeasured: usize,+}+#[derive(Serialize, JsonSchema)]+pub struct Tolerances {+ pub gap_mm: f64,+ pub angle_deg: f64,+ pub curvature_per_mm: f64,+}+#[derive(Serialize, JsonSchema)]+pub struct Summary {+ pub edges: usize,+ pub smooth: usize,+ pub curvature_jump: usize,+ pub sharp: usize,+ pub gap: usize,+ pub skipped: usize,+ pub unmeasured: usize,+ pub worst: Option<Verdict>,+}+#[derive(Serialize, JsonSchema)]+#[serde(untagged)]+pub enum ContinuityResult {+ Cleared {+ analysis: String,+ cleared: bool,+ #[serde(default, skip_serializing_if = "Vec::is_empty")]+ param_warnings: Vec<String>,+ },+ Measured {+ analysis: String,+ samples: usize,+ tolerances: Tolerances,+ bodies: Vec<BodyReport>,+ summary: Summary,+ #[serde(default, skip_serializing_if = "Vec::is_empty")]+ param_warnings: Vec<String>,+ },+}diff --git a/crates/engine/src/schema/unconverted.txt b/crates/engine/src/schema/unconverted.txtindex bc165ff770..511bc1cd7e 100644--- a/crates/engine/src/schema/unconverted.txt+++ b/crates/engine/src/schema/unconverted.txt@@ -95,23 +95,16 @@ frame.memberframe.profile.insertframe.profile.listframe.profile.properties-inspect.accessibilityinspect.center_of_massinspect.clearanceinspect.compare-inspect.continuityinspect.curvature_comb-inspect.curvature_map-inspect.draft-inspect.environment_mapinspect.interferenceinspect.isocurveinspect.measureinspect.minimum_radiusinspect.parameter_sweep-inspect.sectioninspect.silhouette-inspect.zebrajoint.as_builtjoint.camjoint.creatediff --git a/crates/engine/src/schema/view_navigation_tests.rs b/crates/engine/src/schema/view_navigation_tests.rsindex 7ef13a61cc..1abe2043f8 100644--- a/crates/engine/src/schema/view_navigation_tests.rs+++ b/crates/engine/src/schema/view_navigation_tests.rs@@ -10,6 +10,62 @@ fn schemas_and_the_key_check_agree() {assert_keys(input_schema_for::<AngleReadoutParams>(), &["enabled"]);}+#[test]+fn status_details_has_checked_pure_query_and_current_typed_diagnostics() {+ let schema = output_schema_for::<crate::status_details::StatusDetails>();+ let root = schema.as_value();+ let mut s = Session::default();+ let spec = crate::find_command("view.status_details").unwrap();+ assert!(!spec.undoable && !spec.reads_model);+ assert!(spec.contract.is_some() && spec.output.is_some());+ s.execute("solid.box", &json!({"length":10,"width":10,"height":10})).unwrap();+ s.execute("inspect.continuity", &json!({"edges":[[5,0,0]],"samples":5})).unwrap();+ for mode in [ParamCheck::Off, ParamCheck::Warn, ParamCheck::Strict] {+ s.param_check = mode;+ let before = (s.revision, s.doc.to_json(), s.undo.len(), s.continuity.clone());+ for params in [json!({}), Value::Null] {+ let reply = s.execute("view.status_details", ¶ms).unwrap();+ assert!(conforms(root, root, &reply), "{reply} does not match {root}");+ assert_eq!(reply["continuity"][0]["samples"], 5);+ assert_eq!(reply["continuity"][0]["current"], true);+ assert_eq!(reply["continuity"][0]["verdict"], "sharp");+ assert_eq!(reply["items"][0]["source"]["command"], "inspect.continuity");+ assert_eq!(reply["items"][0]["has_details"], true);+ }+ for params in [json!({"clear":true}), json!([]), json!(false)] {+ assert!(s.execute("view.status_details", ¶ms).is_err());+ }+ assert_eq!((s.revision, s.doc.to_json(), s.undo.len(), s.continuity.clone()), before);+ }+}++#[test]+fn surface_and_section_contracts_match_successful_existing_reply_shapes() {+ let mut s = Session { param_check: ParamCheck::Strict, ..Default::default() };+ s.execute("solid.box", &json!({"length":10,"width":10,"height":10})).unwrap();+ for (command, params) in [+ ("inspect.zebra", json!({"stripes":14.5})),+ ("inspect.draft", json!({"pull":[-2,3,-4],"angle":12.75})),+ ("inspect.environment_map", json!({})),+ ("inspect.accessibility", json!({"direction":[0,0,-1]})),+ ("inspect.curvature_map", json!({"radius":25.4})),+ ("inspect.section", json!({"plane":{"origin":[4,5,6],"normal":[-1,2,-3]},"offset":"-2 mm","flip":true,"hatch":false})),+ (+ "inspect.continuity",+ json!({"edges":[[5,0,0]],"samples":5,"gap_tolerance_mm":0.002,"angle_tolerance_deg":2,"curvature_tolerance_per_mm":0.03}),+ ),+ ] {+ let description = s.execute("engine.describe", &json!({"command":command})).unwrap();+ assert_eq!(description["input"]["additionalProperties"], false);+ for params in [params, json!({"clear":true})] {+ let reply = s.execute(command, ¶ms).unwrap();+ let root = &description["output"];+ assert!(conforms(root, root, &reply), "{command}: {reply} does not match {root}");+ }+ assert!(s.execute(command, &json!({"unknown_setting":true})).is_err(), "checked registration for {command}");+ }+}+#[test]fn status_items_has_strict_empty_input_and_a_typed_output_schema() {use crate::status_items::StatusItems;diff --git a/crates/engine/src/status_details.rs b/crates/engine/src/status_details.rsnew file mode 100644index 0000000000..349b6c2142--- /dev/null+++ b/crates/engine/src/status_details.rs@@ -0,0 +1,93 @@+//! Retained diagnostics for the existing Continuity effect. Queries never evaluate geometry.+use schemars::JsonSchema;+use serde::Serialize;++#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Serialize, JsonSchema)]+#[serde(rename_all = "snake_case")]+pub enum ContinuityVerdict {+ Smooth,+ CurvatureJump,+ Sharp,+ Gap,+}+impl From<crate::kernel::SeamVerdict> for ContinuityVerdict {+ fn from(value: crate::kernel::SeamVerdict) -> Self {+ match value {+ crate::kernel::SeamVerdict::Smooth => Self::Smooth,+ crate::kernel::SeamVerdict::CurvatureJump => Self::CurvatureJump,+ crate::kernel::SeamVerdict::Sharp => Self::Sharp,+ crate::kernel::SeamVerdict::Gap => Self::Gap,+ }+ }+}++#[derive(Clone, Debug, PartialEq, Serialize, JsonSchema)]+pub struct ContinuityDetail {+ pub body: String,+ pub edge: usize,+ pub samples: usize,+ pub gap_tolerance_mm: f64,+ pub angle_tolerance_deg: f64,+ pub curvature_tolerance_per_mm: f64,+ pub gap_mm: f64,+ pub normal_angle_deg: f64,+ pub curvature_jump_per_mm: f64,+ pub length_mm: f64,+ pub verdict: ContinuityVerdict,+ pub gap_at: [f64; 3],+ pub gap_fraction: f64,+ pub normal_angle_at: [f64; 3],+ pub normal_angle_fraction: f64,+ pub curvature_jump_at: [f64; 3],+ pub curvature_jump_fraction: f64,+ pub skipped: usize,+ pub unmeasured: usize,+ /// True only while the exact evaluated geometry and occurrence placement still exist.+ pub current: bool,+ #[serde(skip)]+ pub(crate) geometry_key: Option<u64>,+ #[serde(skip)]+ pub(crate) feature: u64,+}++#[derive(Serialize, JsonSchema)]+pub struct StatusDetailItem {+ pub source: crate::status_items::StatusItem,+ pub has_details: bool,+}++#[derive(Serialize, JsonSchema)]+pub struct StatusDetails {+ pub document_id: String,+ pub items: Vec<StatusDetailItem>,+ pub continuity: Vec<ContinuityDetail>,+ #[serde(default, skip_serializing_if = "Vec::is_empty")]+ pub param_warnings: Vec<String>,+}++impl crate::Session {+ /// Cheap current-state lookup. A pending model evaluation or cold/stale assembly world+ /// is conservatively unavailable, even if the old state's geometry keys still match.+ pub fn continuity_details(&self) -> Vec<ContinuityDetail> {+ let world = if self.model.is_stale() { None } else { self.cached_world_state() };+ self.continuity+ .iter()+ .map(|seam| {+ let mut detail = seam.details.clone();+ detail.verdict = seam.verdict.into();+ detail.current = world.as_ref().and_then(|world| world.body(&seam.body)).is_some_and(|body| {+ detail.geometry_key.is_some() && body.geometry_key() == detail.geometry_key && body.feature == detail.feature+ });+ detail+ })+ .collect()+ }++ /// Validate again at activation; a button's earlier descriptor is never authority.+ pub fn continuity_target_points(&self, body: &str, edge: usize) -> Option<&[solidcraft_geom::Vec3]> {+ if !self.continuity_details().iter().any(|row| row.body == body && row.edge == edge && row.current) {+ return None;+ }+ self.continuity.iter().find(|seam| seam.body == body && seam.edge == edge).map(|seam| seam.points.as_slice())+ }+}diff --git a/crates/engine/src/status_items.rs b/crates/engine/src/status_items.rsindex a132303ec2..5dff8791ce 100644--- a/crates/engine/src/status_items.rs+++ b/crates/engine/src/status_items.rs@@ -90,6 +90,14 @@ pub struct StatusItems {pub items: Vec<StatusItem>,}+impl StatusItem {+ /// Capability independent of a window's presentation preferences. `has_key` retains+ /// the existing read-only legend contract; live details also include settings/findings.+ pub fn has_details(&self) -> bool {+ !matches!(self.setting, StatusSetting::Environment)+ }+}+impl Session {/// Whether shading and Continuity share one slot (the default). This is session/// configuration, never design data; SDK clients may choose the legacy independent policy.diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rsindex 6b6b9bcf16..1a64929a71 100644--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@ -304,6 +304,7 @@ pub(crate) mod view_angles;mod view_confirm;pub mod view_pick;pub mod viewport;+mod viewport_details;mod viewport_layout;mod viewport_status;mod viewport_status_fixture;diff --git a/crates/ui-egui/src/prefs.rs b/crates/ui-egui/src/prefs.rsindex 3eaa2e09df..e7cd026fd2 100644--- a/crates/ui-egui/src/prefs.rs+++ b/crates/ui-egui/src/prefs.rs@@ -1081,6 +1081,7 @@ preference_settings! {persistent_ribbon_pressed: bool = true, PAGE_INTERFACE => check_id("prefs.persistent_ribbon_pressed");viewport_analysis_status: bool = true, PAGE_INTERFACE => check_id("prefs.viewport_analysis_status");viewport_section_status: bool = true, PAGE_INTERFACE => check_id("prefs.viewport_section_status");+ viewport_status_details: bool = true, PAGE_INTERFACE => check_id("prefs.viewport_status_details");viewport_status_summary: bool = true, PAGE_INTERFACE => check_id("prefs.viewport_status_summary");/// Keep the SKETCH tab in the ribbon, right after MODEL, while no sketch is open; its drawing/// tools then start a sketch first (#7904).@@ -5047,6 +5048,7 @@ mod tests {("persistent_ribbon_pressed", json!(false), PAGE_INTERFACE),("viewport_analysis_status", json!(false), PAGE_INTERFACE),("viewport_section_status", json!(false), PAGE_INTERFACE),+ ("viewport_status_details", json!(false), PAGE_INTERFACE),("viewport_status_summary", json!(false), PAGE_INTERFACE),("sketch_tab_always", json!(true), PAGE_INTERFACE),("ribbon_reveal", json!(true), PAGE_INTERFACE),@@ -6616,6 +6618,38 @@ mod tests {assert_eq!(h.app.session.doc.to_json(), design);}+ #[test]+ fn viewport_status_details_preference_checkbox_control_persists_cancels_and_resets() {+ assert!(Prefs::default().viewport_status_details);+ assert!(lenient(&json!({"theme":"light"})).viewport_status_details);+ assert!(lenient(&json!({"viewport_status_details":"no"})).viewport_status_details);+ let mut h = crate::scenario::Harness::new();+ let design = h.app.session.doc.to_json();+ let revision = h.app.session.revision;+ h.call("ui.prefs", json!({"open":"Interface"}));+ super::reveal_preference(&mut h, "prefs:viewport_status_details");+ let checkbox = crate::scenario::handle_at("prefs:viewport_status_details").unwrap();+ h.call("ui.click", json!({"x":checkbox.x,"y":checkbox.y}));+ assert!(!h.app.preferences.viewport_status_details);+ assert_eq!(h.call("ui.prefs", json!({}))["result"]["viewport_status_details"], false);+ let mut restored = SolveApp::new(Default::default(), Default::default());+ restored.load_prefs(&h.app.prefs());+ assert!(!restored.preferences.viewport_status_details);+ h.call("ui.prefs", json!({"button":"cancel"}));+ assert!(h.app.preferences.viewport_status_details);+ h.call("ui.prefs", json!({"open":"Interface","viewport_status_details":false,"button":"apply"}));+ h.call("ui.prefs", json!({"button":"defaults"}));+ assert!(h.app.preferences.viewport_status_details);+ h.call("ui.prefs", json!({"button":"cancel"}));+ assert!(!h.app.preferences.viewport_status_details);+ for malformed in [json!("false"), json!(null), json!(0), json!([])] {+ assert!(super::set(&mut h.app, &json!({"viewport_status_details":malformed})).is_err());+ assert!(!h.app.preferences.viewport_status_details);+ }+ assert_eq!(h.app.session.revision, revision);+ assert_eq!(h.app.session.doc.to_json(), design);+ }+#[test]fn viewport_status_summary_preference_checkbox_control_persists_cancels_and_resets() {assert!(Prefs::default().viewport_status_summary);diff --git a/crates/ui-egui/src/prefs/interface.rs b/crates/ui-egui/src/prefs/interface.rsindex 60f4add0cb..fb39a34388 100644--- a/crates/ui-egui/src/prefs/interface.rs+++ b/crates/ui-egui/src/prefs/interface.rs@@ -106,6 +106,10 @@ pub(super) fn interface(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {let check = setting::viewport_section_status(app, ui).on_hover_text(app.tr("prefs.viewport_section_status_help"));crate::scenario::publish_target("prefs:viewport_section_status", check.rect);});+ ui_kit::row(ui, "", |ui| {+ let check = setting::viewport_status_details(app, ui).on_hover_text(app.tr("prefs.viewport_status_details_help"));+ crate::scenario::publish_target("prefs:viewport_status_details", check.rect);+ });ui_kit::row(ui, "", |ui| {let check = setting::viewport_status_summary(app, ui).on_hover_text(app.tr("prefs.viewport_status_summary_help"));crate::scenario::publish_target("prefs:viewport_status_summary", check.rect);diff --git a/crates/ui-egui/src/section_browser_tests.rs b/crates/ui-egui/src/section_browser_tests.rsindex f2008b6d18..fa9cca193d 100644--- a/crates/ui-egui/src/section_browser_tests.rs+++ b/crates/ui-egui/src/section_browser_tests.rs@@ -245,6 +245,7 @@ fn editing_programmatic_sections_keeps_actual_plane_flip_hatch_and_cancel_then_m#[test]fn section_ribbon_toggle_and_setting_edit_have_separate_intent_and_compatibility() {let mut h = harness();+ h.app.preferences.viewport_status_details = false;h.app.run("inspect.zebra", json!({})).unwrap();h.app.run("inspect.section", json!({"plane":"YZ","offset":3})).unwrap();h.frames(3);diff --git a/crates/ui-egui/src/sketch_continuity_tests.rs b/crates/ui-egui/src/sketch_continuity_tests.rsindex b624c8ab6e..d53c925376 100644--- a/crates/ui-egui/src/sketch_continuity_tests.rs+++ b/crates/ui-egui/src/sketch_continuity_tests.rs@@ -48,6 +48,7 @@ fn a_tangent_seam_is_labelled_with_its_curvature_jump() {#[test]fn the_legend_shows_while_seams_are_shaded() {let mut h = crate::scenario::Harness::new();+ h.app.preferences.viewport_status_details = false;h.app.run("solid.box", json!({"length": 20, "width": 20, "height": 20})).unwrap();h.settle();assert!(crate::scenario::rect_of("continuity_legend").is_none());diff --git a/crates/ui-egui/src/sketch_tools.rs b/crates/ui-egui/src/sketch_tools.rsindex 1d1cd616f8..cf07dd5f2c 100644--- a/crates/ui-egui/src/sketch_tools.rs+++ b/crates/ui-egui/src/sketch_tools.rs@@ -214,30 +214,6 @@ fn continuity_label(app: &SolveApp, seam: &Value) -> String {/// The Continuity Analysis legend in the viewport's lower left corner: each class in its/// colour, while seams are shaded.-fn continuity_legend(app: &SolveApp, painter: &egui::Painter, proj: &Proj) {- if app.session.continuity.is_empty() {- return;- }- let tk = crate::theme::Tokens::get();- let [smooth, jump, sharp, gap] = tk.continuity;- // Stable ids: this Gap is a hole between faces, not the sheet-metal gap (`ui.sheet_gap`).- let tr = crate::i18n::tr;- let rows = [(tr("ui.continuity_g2"), smooth), (tr("ui.continuity_g1"), jump), (tr("ui.continuity_g0"), sharp), (tr("ui.continuity_gap"), gap)];- let font = egui::FontId::proportional(tk.font_body);- let (row, pad, swatch) = (18.0, 8.0, 22.0);- let text_width = rows.iter().map(|(label, _)| painter.layout_no_wrap(label.to_string(), font.clone(), tk.text).size().x).fold(0.0, f32::max);- let size = egui::vec2(pad + swatch + 8.0 + text_width + pad, rows.len() as f32 * row + 2.0 * pad);- let available = crate::shell::bottom_overlay_rect(app, proj.rect);- let frame = egui::Rect::from_min_size(available.left_bottom() + egui::vec2(16.0, -(size.y + 16.0)), size);- painter.rect_filled(frame, tk.radius_sm, tk.panel.gamma_multiply(0.9));- crate::scenario::publish_rect("continuity_legend", frame);- for (i, (label, col)) in rows.iter().enumerate() {- let y = frame.top() + pad + row * (i as f32 + 0.5);- painter.line_segment([egui::pos2(frame.left() + pad, y), egui::pos2(frame.left() + pad + swatch, y)], Stroke::new(3.0, *col));- painter.text(egui::pos2(frame.left() + pad + swatch + 8.0, y), egui::Align2::LEFT_CENTER, *label, font.clone(), tk.text);- }-}-/// Isocurve analysis lines.fn iso_lines(app: &SolveApp, painter: &egui::Painter, proj: &Proj) {if app.tool.as_ref().map(|t| t.cmd) != Some("inspect.isocurve") {@@ -1804,7 +1780,6 @@ pub fn show(app: &mut SolveApp, ui: &egui::Ui, painter: &egui::Painter, proj: &P}marks(app, painter, proj);iso_lines(app, painter, proj);- continuity_legend(app, painter, proj);}#[cfg(test)]diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rsindex 7f20d7ab06..f0d0e335fe 100644--- a/crates/ui-egui/src/toolbar.rs+++ b/crates/ui-egui/src/toolbar.rs@@ -2977,6 +2977,20 @@ pub fn shortcuts(app: &mut SolveApp, ctx: &egui::Context) {|| crate::hole_presets::name_prompt_open(ctx, app.dialog.as_ref())|| crate::personal_sheet_rules::name_prompt_open(ctx, app.dialog.as_ref());let inline_editor = crate::dim_view::editing();+ if !popup_owner+ && app.viewport_status.open_key.is_some()+ && crate::ui_kit::details_field_owned_escape(ctx)+ && ctx.input_mut(|input| input.consume_key(egui::Modifiers::NONE, egui::Key::Escape))+ {+ ctx.memory_mut(|memory| {+ if let Some(id) = memory.focused() {+ memory.surrender_focus(id);+ }+ });+ app.esc_handled = true;+ app.escape_owner = Some(crate::EscapeOwner::Overlay);+ return;+ }if popup_owner|| inline_editor|| (crate::viewport_status::enabled(app) && app.ui.palette_open)diff --git a/crates/ui-egui/src/ui_kit/choice.rs b/crates/ui-egui/src/ui_kit/choice.rsindex e5325c8368..871eff4dd8 100644--- a/crates/ui-egui/src/ui_kit/choice.rs+++ b/crates/ui-egui/src/ui_kit/choice.rs@@ -12,6 +12,8 @@ use egui::{Ui, vec2};/// Text segments retain mixed states and optional compact clipping instead of dropdown fallback.#[derive(Default)]pub(crate) struct Segments<'a> {+ /// Explicit focus requested by the owning form when a setting is opened for editing.+ pub focus: Option<usize>,/// Per-option availability; omitted entries are enabled. Unavailable options stay faded.pub enabled: &'a [bool],/// Optional per-option refusal reasons. Disabled options remain visible and explain why.@@ -41,6 +43,7 @@ pub(crate) fn segmented(ui: &mut Ui, selected: &mut usize, options: &[&str], concrate::prefs_search::reveal(ui);}let Segments {+ focus,enabled,disabled,targets,@@ -127,6 +130,9 @@ pub(crate) fn segmented(ui: &mut Ui, selected: &mut usize, options: &[&str], conlet ui = &mut segment_ui;let segment_enabled = ui.is_enabled();let response = ui.interact(segment, id, egui::Sense::click());+ if focus == Some(index) && segment_enabled && ui.is_visible() && ui.is_rect_visible(segment) {+ response.request_focus();+ }let on = states.get(index).copied().unwrap_or(*selected == index);let rounding = egui::CornerRadius {nw: if index == 0 { t.control_radius } else { 0 },diff --git a/crates/ui-egui/src/ui_kit/details.rs b/crates/ui-egui/src/ui_kit/details.rsnew file mode 100644index 0000000000..250a0c182e--- /dev/null+++ b/crates/ui-egui/src/ui_kit/details.rs@@ -0,0 +1,368 @@+//! Description-driven details content. No tool, document or command knowledge lives here.+use crate::{fonts::RichTextExt as _, scenario, theme::Tokens};+use egui::{RichText, Ui};++const FIELD_FOCUS: &str = "details_field_focus";+const CONTROL_FOCUS: &str = "details_control_focus";+const OWNED_POPUPS: &str = "details_owned_popups";+pub(crate) fn dismiss_details_popups(ctx: &egui::Context) {+ let popups = ctx.data(|data| data.get_temp::<Vec<egui::Id>>(egui::Id::new(OWNED_POPUPS))).unwrap_or_default();+ for popup in popups {+ egui::Popup::close_id(ctx, popup);+ }+}+fn remember_control(ui: &Ui, id: egui::Id) {+ if !ui.is_visible() || !ui.is_enabled() {+ return;+ }+ ui.ctx().data_mut(|data| {+ let key = egui::Id::new(CONTROL_FOCUS);+ let mut ids = data.get_temp::<Vec<egui::Id>>(key).unwrap_or_default();+ ids.push(id);+ data.insert_temp(key, ids);+ });+}+pub(crate) fn details_control_owns_focus(ctx: &egui::Context) -> bool {+ let ids = ctx.data(|data| data.get_temp::<Vec<egui::Id>>(egui::Id::new(CONTROL_FOCUS))).unwrap_or_default();+ ctx.memory(|memory| memory.focused().is_some_and(|id| ids.contains(&id)))+}+pub(crate) fn details_field_owns_focus(ctx: &egui::Context) -> bool {+ let fields = ctx.data(|data| data.get_temp::<Vec<(egui::Id, egui::Rect)>>(egui::Id::new(FIELD_FOCUS))).unwrap_or_default();+ let focused = ctx.memory(|memory| memory.focused());+ focused.is_some_and(|id| {+ fields.iter().any(|(field, rect)| *field == id || ctx.read_response(id).is_some_and(|response| rect.contains(response.rect.center())))+ })+}+pub(crate) fn details_field_owned_escape(ctx: &egui::Context) -> bool {+ if details_field_owns_focus(ctx) {+ return true;+ }+ let fields = ctx.data(|data| data.get_temp::<Vec<(egui::Id, egui::Rect)>>(egui::Id::new(FIELD_FOCUS))).unwrap_or_default();+ // egui blurs native value editors before global shortcuts see Escape. The+ // preceding visible frame still owns that press, just as a text editor does.+ ctx.memory(|memory| memory.focused().is_none() && fields.iter().any(|(id, _)| memory.had_focus_last_frame(*id)))+}++#[derive(Clone, Debug, PartialEq)]+pub(crate) enum DetailValue {+ Number { value: f64, min: f64, max: f64, suffix: String },+ Length { value: f64, units: String },+ Angle(f64),+ Slider { value: f64, min: f64, max: f64 },+ Axis { value: [f64; 3], current: String },+ Check(bool),+ Choice { selected: usize, options: Vec<String> },+}++pub(crate) struct DetailSetting {+ pub id: String,+ pub label: String,+ pub value: DetailValue,+ pub enabled: bool,+}++pub(crate) struct DetailKey {+ pub colour: egui::Color32,+ pub pattern: bool,+ pub label: String,+ pub value: String,+ pub numeric: bool,+ pub pattern_colour: Option<egui::Color32>,+}++pub(crate) struct DetailFinding {+ pub id: String,+ pub label: String,+ pub value: String,+ pub warning: bool,+ pub target: bool,+}++/// All blocks are optional. Strings and numeric values are current caller-owned data.+#[derive(Default)]+pub(crate) struct Details {+ pub caption: Option<String>,+ pub settings: Vec<DetailSetting>,+ pub key: Vec<DetailKey>,+ pub findings_title: String,+ pub findings_count: Option<String>,+ pub findings: Vec<DetailFinding>,+ pub readout: Vec<(String, String)>,+ pub actions: Vec<(String, String)>,+}++#[derive(Debug, PartialEq)]+pub(crate) enum DetailEvent {+ Change(String, DetailValue),+ Target(String),+ Action(String),+}++fn heading(ui: &mut Ui, label: &str) {+ heading_value(ui, label, None);+}+fn heading_value(ui: &mut Ui, label: &str, value: Option<&str>) {+ let t = Tokens::get();+ super::divider(ui, label);+ ui.horizontal(|ui| {+ ui.label(RichText::new(label).semibold().size(t.font_small).color(t.text_dim));+ if let Some(value) = value {+ ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {+ ui.label(RichText::new(value).monospace().size(t.font_small).color(t.text_dim));+ });+ }+ });+}++/// Shared semantic swatch: pattern supplements the analysis colour in every vision mode.+pub(crate) fn patterned_swatch(ui: &mut Ui, colour: egui::Color32, pattern: bool, pattern_colour: Option<egui::Color32>) {+ let t = Tokens::get();+ let (rect, _) = ui.allocate_exact_size(egui::vec2(t.space_12, t.space_12), egui::Sense::hover());+ ui.painter().rect_filled(rect, t.radius_sm, colour);+ if pattern {+ let painter = ui.painter().with_clip_rect(rect);+ for offset in [-t.space_8, -t.space_4, 0.0, t.space_4, t.space_8] {+ let from = rect.left_bottom() + egui::vec2(offset, 0.0);+ painter.line_segment([from, from + egui::vec2(rect.height(), -rect.height())], t.primary_border(pattern_colour.unwrap_or(t.text)));+ }+ }+}++fn setting(ui: &mut Ui, field: &DetailSetting, focus: bool) -> Option<DetailEvent> {+ let mut value = field.value.clone();+ let mut changed = false;+ super::row(ui, &field.label, |ui| {+ ui.add_enabled_ui(field.enabled, |ui| {+ ui.style_mut().drag_value_text_style = egui::TextStyle::Monospace;+ let response = match &mut value {+ DetailValue::Number { value, min, max, suffix } => Some(super::number_field(ui, value, *min..=*max, 0.01, suffix)),+ DetailValue::Length { value, units } => Some(super::length_field(ui, value, units, 6)),+ DetailValue::Angle(value) => Some(super::angle_field(ui, value)),+ DetailValue::Slider { value, min, max } => Some(super::slider(ui, value, *min..=*max, Default::default())),+ DetailValue::Check(value) => Some(super::checkbox(ui, "", value)),+ DetailValue::Axis { value, .. } => {+ let axes = [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]];+ let mut selected = axes.iter().position(|axis| *value == *axis).unwrap_or(usize::MAX);+ let wanted_focus = (focus && ui.is_visible()).then_some(if selected < 3 { selected } else { 0 });+ for index in 0..3 {+ remember_control(ui, ui.make_persistent_id(("segment", index)));+ }+ if super::segmented(+ ui,+ &mut selected,+ &["X", "Y", "Z"],+ super::Segments { focus: wanted_focus, compact: true, ..Default::default() },+ ) && let Some(axis) = axes.get(selected)+ {+ *value = *axis;+ changed = true;+ }+ None+ }+ DetailValue::Choice { selected, options } => {+ let before = *selected;+ let current = options.get(*selected).cloned().unwrap_or_default();+ let response = super::dropdown_menu(ui, &field.id, ¤t, |ui| {+ for (index, option) in options.iter().enumerate() {+ let response = ui.selectable_value(selected, index, option);+ remember_control(ui, response.id);+ }+ });+ ui.ctx().data_mut(|data| {+ let key = egui::Id::new(OWNED_POPUPS);+ let mut popups = data.get_temp::<Vec<egui::Id>>(key).unwrap_or_default();+ // ComboBox's native popup is keyed by the returned button response.+ popups.push(response.id.with("popup"));+ data.insert_temp(key, popups);+ });+ changed = *selected != before;+ Some(response)+ }+ };+ if let Some(response) = response {+ scenario::publish_target(&format!("details:field:{}", field.id), response.rect);+ // Visibility reads Context::will_discard. Never re-enter Context while+ // holding its data write lock.+ let visible = ui.is_visible() && ui.is_enabled() && ui.is_rect_visible(response.rect);+ if focus {+ ui.scroll_to_rect(response.rect, None);+ if visible {+ response.request_focus();+ }+ }+ // A DragValue may focus its inner TextEdit rather than its outer+ // response. Retain only the actual native editor inside this field.+ let native_focus = ui.ctx().memory(|memory| memory.focused()).filter(|id| {+ *id == response.id || ui.ctx().read_response(*id).is_some_and(|native| response.rect.contains(native.rect.center()))+ });+ ui.ctx().data_mut(|data| {+ let key = egui::Id::new(FIELD_FOCUS);+ let mut fields = data.get_temp::<Vec<(egui::Id, egui::Rect)>>(key).unwrap_or_default();+ if visible {+ fields.push((response.id, response.rect));+ if let Some(id) = native_focus {+ fields.push((id, response.rect));+ }+ }+ data.insert_temp(key, fields);+ });+ changed |= response.changed();+ }+ });+ });+ if let DetailValue::Axis { value: vector, current } = &value+ && ![[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]].contains(vector)+ {+ let response = ui.add(egui::Label::new(RichText::new(current).monospace()).wrap()).on_hover_text(current);+ scenario::publish_target(&format!("details:current:{}", field.id), response.rect);+ }+ changed.then(|| DetailEvent::Change(field.id.clone(), value))+}++/// Fixed caption and actions surround one bounded scrolling body. The six-row findings+/// preview expands inside that body; it never creates another popup or steals CAD input.+pub(crate) fn details(ui: &mut Ui, id: &str, description: &Details, max_height: f32, focus: Option<&str>) -> Vec<DetailEvent> {+ let t = Tokens::get();+ let mut events = Vec::new();+ ui.ctx().data_mut(|data| data.insert_temp(egui::Id::new(FIELD_FOCUS), Vec::<(egui::Id, egui::Rect)>::new()));+ ui.ctx().data_mut(|data| data.insert_temp(egui::Id::new(CONTROL_FOCUS), Vec::<egui::Id>::new()));+ ui.ctx().data_mut(|data| data.insert_temp(egui::Id::new(OWNED_POPUPS), Vec::<egui::Id>::new()));+ ui.set_width((t.form_card_width + if description.findings.is_empty() { 0.0 } else { t.space_24 * 2.0 }).min(ui.available_width()));+ super::scope(ui, |ui| {+ let mut caption_height = 0.0;+ if let Some(caption) = &description.caption {+ let response = ui.add(egui::Label::new(RichText::new(caption).size(t.font_label).color(t.text_dim)).wrap());+ caption_height = response.rect.height() + t.space_8;+ scenario::publish_rect("details:caption", response.rect);+ }+ let footer_height = if description.actions.is_empty() { 0.0 } else { t.control_height + t.space_16 };+ let body = egui::ScrollArea::vertical()+ .id_salt(("details", id))+ .max_height((max_height - caption_height - footer_height - t.space_24).max(0.0))+ .min_scrolled_height(0.0)+ .auto_shrink([false, true])+ .show(ui, |ui| {+ if !description.settings.is_empty() {+ heading(ui, crate::i18n::tr("ui.details_settings"));+ super::settings_form(ui, t.form_label_width, |ui| {+ for field in &description.settings {+ ui.push_id(&field.id, |ui| {+ if let Some(event) = setting(ui, field, focus == Some(field.id.as_str())) {+ events.push(event);+ }+ });+ }+ });+ }+ if !description.key.is_empty() {+ heading(ui, crate::i18n::tr("ui.details_key"));+ for row in &description.key {+ ui.horizontal(|ui| {+ patterned_swatch(ui, row.colour, row.pattern, row.pattern_colour);+ let label = RichText::new(&row.label);+ ui.label(if row.numeric { label.monospace() } else { label });+ ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {+ ui.label(RichText::new(&row.value).monospace());+ });+ });+ }+ }+ if !description.findings.is_empty() {+ heading_value(ui, &description.findings_title, description.findings_count.as_deref());+ let expanded_id = ui.make_persistent_id((id, "all_findings"));+ let expanded = ui.data(|data| data.get_temp::<bool>(expanded_id)).unwrap_or(false);+ let columns = [super::Column::new("", 1.0).flex(), super::Column::new("", 1.0).flex(), super::Column::new("", 0.0).icon_only()];+ super::table_custom(ui, id, &columns, "", |ui, table| {+ for row in description.findings.iter().take(if expanded { usize::MAX } else { 6 }) {+ table.row(ui, &row.id, false, |cells| {+ cells.cell(|ui| {+ ui.horizontal(|ui| {+ if row.warning {+ let (rect, _) = ui.allocate_exact_size(egui::vec2(t.space_16, t.space_16), egui::Sense::hover());+ crate::icons::paint_icon(ui.painter(), rect, "warning", 1.0);+ }+ ui.label(&row.label).on_hover_text(&row.label);+ });+ });+ cells.cell(|ui| {+ ui.label(RichText::new(&row.value).monospace().size(t.font_small)).on_hover_text(&row.value);+ });+ cells.cell(|ui| {+ if row.target {+ let (rect, _) = ui.allocate_exact_size(egui::vec2(t.control_height, t.control_height), egui::Sense::hover());+ let response = ui+ .push_id(&row.id, |ui| super::icon_button_at(ui, rect, "fit", crate::i18n::tr("ui.details_target")))+ .inner;+ remember_control(ui, response.id);+ scenario::publish_target(&format!("details:target:{}", row.id), response.rect);+ if response.clicked() {+ events.push(DetailEvent::Target(row.id.clone()));+ }+ }+ });+ });+ }+ });+ scenario::publish_count(+ "details:findings_visible",+ if expanded { description.findings.len() } else { description.findings.len().min(6) } as f64,+ );+ if !expanded && description.findings.len() > 6 {+ let text = crate::i18n::format("ui.details_show_all", &[("count", &description.findings.len().to_string())]);+ let response = super::button(ui, text, super::Button::Ghost);+ remember_control(ui, response.id);+ scenario::publish_target("details:show_all", response.rect);+ if response.clicked() {+ ui.data_mut(|data| data.insert_temp(expanded_id, true));+ }+ }+ } else if !description.readout.is_empty() {+ heading(ui, crate::i18n::tr("ui.details_readout"));+ let expanded_id = ui.make_persistent_id((id, "all_readout"));+ let expanded = ui.data(|data| data.get_temp::<bool>(expanded_id)).unwrap_or(false);+ let columns = [super::Column::new("", 1.0).flex(), super::Column::new("", 1.0).flex()];+ super::table_custom(ui, id, &columns, "", |ui, table| {+ for (index, (label, value)) in description.readout.iter().take(if expanded { usize::MAX } else { 6 }).enumerate() {+ table.row(ui, &index.to_string(), false, |row| {+ row.cell(|ui| {+ ui.label(label);+ });+ row.cell(|ui| {+ ui.label(RichText::new(value).monospace());+ });+ });+ }+ });+ scenario::publish_count(+ "details:readout_visible",+ if expanded { description.readout.len() } else { description.readout.len().min(6) } as f64,+ );+ if !expanded && description.readout.len() > 6 {+ let text = crate::i18n::format("ui.details_show_all", &[("count", &description.readout.len().to_string())]);+ let response = super::button(ui, text, super::Button::Ghost);+ remember_control(ui, response.id);+ scenario::publish_target("details:show_all", response.rect);+ if response.clicked() {+ ui.data_mut(|data| data.insert_temp(expanded_id, true));+ }+ }+ }+ });+ scenario::publish_rect("details:body", body.inner_rect);+ if !description.actions.is_empty() {+ super::divider(ui, "details_actions");+ let actions = ui.horizontal(|ui| {+ for (id, label) in description.actions.iter().take(2) {+ let response = super::text_button(ui, label, true);+ remember_control(ui, response.id);+ scenario::publish_target(&format!("details:action:{id}"), response.rect);+ if response.clicked() {+ events.push(DetailEvent::Action(id.clone()));+ }+ }+ });+ scenario::publish_rect("details:actions", actions.response.rect);+ }+ });+ events+}diff --git a/crates/ui-egui/src/ui_kit/mod.rs b/crates/ui-egui/src/ui_kit/mod.rsindex 78800da043..9e828329e6 100644--- a/crates/ui-egui/src/ui_kit/mod.rs+++ b/crates/ui-egui/src/ui_kit/mod.rs@@ -9,6 +9,7 @@ mod choice;mod color;mod confirm;pub mod container;+mod details;mod disclosure;mod drag;mod fields;@@ -57,6 +58,7 @@ pub(crate) use choice::*;pub(crate) use color::*;pub(crate) use confirm::{Confirm, Tone};pub use container::{Container, DockEdges, Edge, Surface};+pub(crate) use details::*;pub(crate) use disclosure::*;pub(crate) use drag::*;pub(crate) use fields::*;diff --git a/crates/ui-egui/src/ui_kit/viewport_status.rs b/crates/ui-egui/src/ui_kit/viewport_status.rsindex 1788fb6cca..90e7db1875 100644--- a/crates/ui-egui/src/ui_kit/viewport_status.rs+++ b/crates/ui-egui/src/ui_kit/viewport_status.rs@@ -35,15 +35,52 @@ pub(crate) struct StatusItem {#[derive(Default)]pub(crate) struct StatusPresentation {pub open_key: Option<String>,+ pub focus_field: Option<String>,+ pub selected_record: Option<String>,+ pub live_details: bool,+ return_focus: Option<Id>,+ return_pending: bool,+ card_owner: Option<String>,+ opened_frame: Option<u64>,+ session_uid: Option<u64>,focus_ids: Vec<Id>,summary_popup: Option<Id>,summary_members: Vec<String>,+ summary_suspended: bool,}impl StatusPresentation {+ /// A card and its focus/popup identities never follow a different document's equal slot ID.+ pub(crate) fn reconcile_session(&mut self, ctx: &egui::Context, uid: u64) {+ if self.session_uid.is_some_and(|previous| previous != uid) {+ super::dismiss_details_popups(ctx);+ if let Some(popup) = self.summary_popup {+ egui::Popup::close_id(ctx, popup);+ }+ if self.owns_focus(ctx) || super::details_field_owns_focus(ctx) {+ ctx.memory_mut(|memory| {+ if let Some(id) = memory.focused() {+ memory.surrender_focus(id);+ }+ });+ }+ *self = Self::default();+ }+ self.session_uid = Some(uid);+ }/// Only popup/focus identities are retained; every displayed value comes from this frame.pub(crate) fn reconcile_summary(&mut self, ctx: &egui::Context, members: Vec<String>) {if self.summary_members != members {+ super::dismiss_details_popups(ctx);+ if self.open_key.is_some() && (super::details_field_owns_focus(ctx) || super::details_control_owns_focus(ctx)) {+ ctx.memory_mut(|memory| {+ if let Some(id) = memory.focused() {+ memory.surrender_focus(id);+ }+ });+ }+ self.return_pending = false;+ self.card_owner = None;if let Some(id) = self.summary_popup.take() {egui::Popup::close_id(ctx, id);}@@ -56,12 +93,53 @@ impl StatusPresentation {}self.focus_ids.clear();self.open_key = None;+ self.focus_field = None;self.summary_members = members;}}+ /// A higher owner dismisses only this popup, without returning focus to its badge.+ pub(crate) fn suspend_summary(&mut self, ctx: &egui::Context, suspended: bool) {+ if suspended {+ if self.live_details {+ super::dismiss_details_popups(ctx);+ }+ if self.open_key.is_some() && (super::details_field_owns_focus(ctx) || super::details_control_owns_focus(ctx)) {+ ctx.memory_mut(|memory| {+ if let Some(id) = memory.focused() {+ memory.surrender_focus(id);+ }+ });+ }+ self.focus_field = None;+ self.return_pending = false;+ }+ self.summary_suspended = suspended;+ if suspended && !self.summary_members.is_empty() {+ if let Some(id) = self.summary_popup.take() {+ egui::Popup::close_id(ctx, id);+ }+ if self.owns_focus(ctx) {+ ctx.memory_mut(|memory| {+ if let Some(id) = memory.focused() {+ memory.surrender_focus(id);+ }+ });+ }+ self.focus_ids.clear();+ }+ }+pub(crate) fn owns_focus(&self, ctx: &egui::Context) -> bool {ctx.memory(|memory| memory.focused().is_some_and(|id| self.focus_ids.contains(&id)))+ || (self.open_key.is_some() && super::details_control_owns_focus(ctx))+ }++ pub(crate) fn close_details(&mut self) {+ self.open_key = None;+ self.focus_field = None;+ self.return_pending = true;+ self.card_owner = None;}}@@ -150,6 +228,13 @@ pub(crate) fn viewport_status_item(ui: &mut Ui, item: &StatusItem, state: &mut Slet label = crate::i18n::format("ui.viewport_status_key", &[("name", &item.name)]);let response = icon_action(ui, item, "key", "chevron", &label, &label, open);state.focus_ids.push(response.id);+ if open || response.clicked() || matches!(&action, Some(StatusAction::Edit(id)) if id == &item.id) {+ state.return_focus = Some(response.id);+ }+ if state.return_pending && state.return_focus == Some(response.id) && !egui::Popup::is_any_open(ui.ctx()) {+ response.request_focus();+ state.return_pending = false;+ }if response.clicked() {state.open_key = if open { None } else { Some(item.id.clone()) };}@@ -215,18 +300,15 @@ pub(crate) fn viewport_status_row(});scenario::publish_rect("viewport_status:row", row.response.rect);scenario::publish_count("viewport_status:count", items.len() as f64);+ if state.return_pending && state.return_focus.is_none_or(|id| !state.focus_ids.contains(&id)) {+ state.return_pending = false;+ state.return_focus = None;+ }if let Some((anchor, id)) = key_anchor {- let card = Container::new(ctx, Surface::Popup);- // The key belongs to viewport chrome, not to the system-window/popup layer.- let result =- card.area(Id::new("viewport_status_key")).order(egui::Order::Background).movable(false).fixed_pos(anchor + vec2(0.0, t.space_6)).show(- ctx,- |ui| {- let frame = card.frame(ctx, t.overlay, crate::frame::Side::Left).inner_margin(t.space_12);- card.show_frame(ui, frame, free, |ui| key_contents(ui, id));- },- );- scenario::publish_target("viewport_status:card", result.response.rect);+ show_card(ctx, free, anchor, row.response.rect, id, state, &mut key_contents);+ } else {+ state.card_owner = None;+ state.focus_field = None;}actions}@@ -262,6 +344,10 @@ pub(crate) fn viewport_status_summary(};let frame = container.frame(ctx, t.overlay, crate::frame::Side::Left).stroke(t.primary_border(outline)).inner_margin(t.space_4);container.show_frame(ui, frame, free, |ui| {+ // The background badge cannot open a foreground popup above a higher owner.+ if state.summary_suspended {+ ui.disable();+ }let mut button_id = None;let mut summary_popup = None;let menu = super::Menu::button_with(@@ -379,6 +465,13 @@ pub(crate) fn viewport_status_summary();state.summary_popup = summary_popup;state.focus_ids.extend(button_id);+ if state.open_key.is_some() {+ state.return_focus = button_id;+ }+ if state.return_pending && state.return_focus == button_id && !egui::Popup::is_any_open(ctx) {+ menu.response.request_focus();+ state.return_pending = false;+ }if was_open && !summary_popup.is_some_and(|id| egui::Popup::is_id_open(ctx, id)) && actions.is_empty() {menu.response.request_focus();}@@ -389,42 +482,51 @@ pub(crate) fn viewport_status_summary(});scenario::publish_rect("viewport_status:row", row.response.rect);scenario::publish_count("viewport_status:count", items.len() as f64);- if let Some(id) = state.open_key.as_deref() {- let card = Container::new(ctx, Surface::Popup);- let result = card- .area(Id::new("viewport_status_key"))- .order(egui::Order::Background)- .movable(false)- .fixed_pos(row.response.rect.left_bottom() + vec2(0.0, t.space_6))- .show(ctx, |ui| {- let frame = card.frame(ctx, t.overlay, crate::frame::Side::Left).inner_margin(t.space_12);- card.show_frame(ui, frame, free, |ui| key_contents(ui, id));- });- scenario::publish_target("viewport_status:card", result.response.rect);+ if let Some(id) = state.open_key.clone() {+ show_card(ctx, free, row.response.rect.left_bottom(), row.response.rect, &id, state, &mut key_contents);+ } else {+ state.card_owner = None;+ state.focus_field = None;}actions}-/// Shared legend content; the caller supplies the existing analysis-token swatches and text.-pub(crate) fn analysis_key(ui: &mut Ui, title: &str, along: Option<&str>, rows: &[(egui::Color32, String, bool)]) {- let t = Tokens::get();- ui.label(RichText::new(title).semibold().size(t.font_label).color(t.text));- if let Some(along) = along {- ui.label(RichText::new(along).monospace().size(t.font_small).color(t.text_dim));+fn show_card(+ ctx: &egui::Context,+ free: Rect,+ anchor: egui::Pos2,+ owner: Rect,+ id: &str,+ state: &mut StatusPresentation,+ contents: &mut impl FnMut(&mut Ui, &str),+) {+ if state.live_details && state.summary_suspended {+ return;}- for (colour, label, hatched) in rows {- ui.horizontal(|ui| {- let (rect, _) = ui.allocate_exact_size(vec2(t.space_12, t.space_12), egui::Sense::hover());- ui.painter().rect_filled(rect, t.radius_sm, *colour);- if *hatched {- let painter = ui.painter().with_clip_rect(rect);- for offset in [-t.space_8, -t.space_4, 0.0, t.space_4, t.space_8] {- let from = rect.left_bottom() + vec2(offset, 0.0);- painter- .line_segment([from, from + vec2(rect.height(), -rect.height())], egui::Stroke::new(t.primary_border(t.text).width, t.text));- }- }- ui.label(RichText::new(label).size(t.font_label).color(t.text));- });+ if state.card_owner.as_deref() != Some(id) {+ state.card_owner = Some(id.to_owned());+ state.opened_frame = Some(ctx.cumulative_frame_nr());+ }+ let popup_was_open = egui::Popup::is_any_open(ctx);+ let t = Tokens::get();+ let card = Container::new(ctx, Surface::Popup);+ let result =+ card.area(Id::new("viewport_status_key")).order(egui::Order::Background).movable(false).fixed_pos(anchor + vec2(0.0, t.space_6)).show(+ ctx,+ |ui| {+ let frame = card.frame(ctx, t.overlay, crate::frame::Side::Left).inner_margin(t.space_12);+ card.show_frame(ui, frame, free, |ui| contents(ui, id));+ },+ );+ scenario::publish_target("viewport_status:card", result.response.rect);+ if state.opened_frame != Some(ctx.cumulative_frame_nr())+ && !popup_was_open+ && !egui::Popup::is_any_open(ctx)+ && ctx.input(|input| {+ input.pointer.any_pressed()+ && input.pointer.interact_pos().is_some_and(|point| !result.response.rect.contains(point) && !owner.contains(point))+ })+ {+ state.close_details();}}diff --git a/crates/ui-egui/src/viewport.rs b/crates/ui-egui/src/viewport.rsindex f4aeb339b0..1e3179dffd 100644--- a/crates/ui-egui/src/viewport.rs+++ b/crates/ui-egui/src/viewport.rs@@ -1641,7 +1641,10 @@ pub(crate) fn build_scene(app: &SolveApp) -> GpuScene {}// Continuity analysis: each seam `inspect.continuity` measured, drawn over the model in the// colour of its worst verdict.- for seam in &s.continuity {+ for (seam, detail) in s.continuity.iter().zip(s.continuity_details()) {+ if !detail.current {+ continue;+ }let col = sc.color(c4(continuity_color(&tk, seam.verdict)));for w in seam.points.windows(2) {if let (Some(a), Some(b)) = (w.first(), w.get(1)) {@@ -2970,41 +2973,6 @@ pub(crate) fn analysis_legend_data(app: &SolveApp) -> Option<AnalysisLegend> {Some((title, along, rows))}-fn analysis_legend(app: &SolveApp, painter: &egui::Painter, rect: Rect) {- let Some((title, along, rows)) = analysis_legend_data(app) else { return };- let t = Tokens::get();- 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;- // 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;- painter.text(pos2(r.left() + pad, y), Align2::LEFT_TOP, title, FontId::proportional(t.font_button), t.text);- y += 18.0;- if let Some(along) = along {- painter.text(pos2(r.left() + pad, y), Align2::LEFT_TOP, along, FontId::proportional(t.font_caption), t.text_dim);- y += row;- }- for (c, text, hatched) in rows {- let sw = Rect::from_min_size(pos2(r.left() + pad, y + 2.0), vec2(12.0, 12.0));- painter.rect_filled(sw, t.radius_sm / 2, c);- if hatched {- // The stripes the viewport adds to these faces (colour vision modes).- for k in [3.0, 7.0, 11.0] {- painter.line_segment(- [pos2(sw.left() + k - 3.0, sw.bottom()), pos2(sw.left() + k + 1.0, sw.top())],- Stroke::new(1.2, Color32::from_black_alpha(110)),- );- }- }- painter.text(pos2(sw.right() + 8.0, y), Align2::LEFT_TOP, text, FontId::proportional(t.font_body), t.text);- y += row;- }-}-fn section_clip(app: &SolveApp) -> [f32; 4] {match section_plane(app) {Some((o, n)) => [n.x as f32, n.y as f32, n.z as f32, n.dot(o) as f32],@@ -4373,9 +4341,7 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {}}let overlay_rect = crate::shell::bottom_overlay_rect(app, rect);- if !app.preferences.viewport_analysis_status {- analysis_legend(app, &painter, overlay_rect);- }+ crate::viewport_details::legacy_legends(app, ui, overlay_rect);crate::frame_rate::paint(app, ui, &painter, overlay_rect);// ---- interaction ----diff --git a/crates/ui-egui/src/viewport_details.rs b/crates/ui-egui/src/viewport_details.rsnew file mode 100644index 0000000000..e37c508f65--- /dev/null+++ b/crates/ui-egui/src/viewport_details.rs@@ -0,0 +1,327 @@+//! Current effect data -> the one generic details grammar; edits use normal commands.+use crate::{+ SolveApp,+ ui_kit::{DetailEvent, DetailFinding, DetailKey, DetailSetting, DetailValue, Details},+};+use serde_json::{Value, json};+use solidcraft_engine::{+ status_details::ContinuityDetail,+ status_items::{StatusItem, StatusSetting},+};++fn tr(id: &str) -> String {+ crate::i18n::tr(id).to_owned()+}+fn field(id: &str, label: &str, value: DetailValue) -> DetailSetting {+ DetailSetting { id: id.into(), label: tr(label), value, enabled: true }+}+fn length(app: &SolveApp, value: f64) -> DetailValue {+ DetailValue::Length { value, units: app.session.doc.units.clone() }+}+fn number(value: f64, min: f64, max: f64, suffix: &str) -> DetailValue {+ DetailValue::Number { value, min, max, suffix: suffix.into() }+}+fn axis(value: [f64; 3]) -> DetailValue {+ let axes = [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]];+ let current = if axes.iter().any(|axis| *axis == value || axis.map(|v| -v) == value) {+ crate::viewport_status::direction(value)+ } else {+ let [x, y, z] = value;+ format!("({x}, {y}, {z})")+ };+ DetailValue::Axis { value, current }+}+fn record_id(row: &ContinuityDetail) -> String {+ json!([row.body, row.edge]).to_string()+}+fn record_label(row: &ContinuityDetail) -> String {+ crate::i18n::format("ui.details_seam", &[("body", &row.body), ("edge", &row.edge.to_string())])+}+fn selected<'a>(app: &SolveApp, rows: &'a [ContinuityDetail]) -> Option<&'a ContinuityDetail> {+ app.viewport_status.selected_record.as_ref().and_then(|id| rows.iter().find(|row| record_id(row) == *id)).or_else(|| rows.first())+}++pub(crate) fn primary(effect: &StatusItem) -> &'static str {+ match effect.setting {+ StatusSetting::Draft { .. } => "angle",+ StatusSetting::Zebra { .. } => "stripes",+ StatusSetting::Accessibility { .. } => "direction",+ StatusSetting::Curvature { .. } => "radius",+ StatusSetting::Section { .. } => "offset",+ StatusSetting::Continuity { .. } => "record",+ StatusSetting::Environment => "",+ }+}++pub(crate) fn description(app: &SolveApp, effect: &StatusItem) -> Details {+ let mut details = Details::default();+ match effect.setting {+ StatusSetting::Draft { pull, angle_deg } => {+ details.caption = Some(tr("ui.details_draft_caption"));+ details.settings = vec![field("pull", "ui.details_pull", axis(pull)), field("angle", "ui.details_angle", DetailValue::Angle(angle_deg))];+ }+ StatusSetting::Zebra { stripes } => {+ details.caption = Some(tr("ui.details_zebra_caption"));+ details.settings.push(field("stripes", "ui.details_stripes", DetailValue::Slider { value: stripes, min: 1.0, max: 200.0 }));+ }+ StatusSetting::Accessibility { direction } => {+ details.caption = Some(tr("ui.details_access_caption"));+ details.settings.push(field("direction", "ui.details_direction", axis(direction)));+ }+ StatusSetting::Curvature { radius_mm } => {+ details.caption = Some(tr("ui.details_curvature_caption"));+ details.settings.push(field("radius", "ui.details_radius", length(app, radius_mm)));+ }+ StatusSetting::Section { origin_mm, normal, hatch } => {+ if let Some((_, offset, n)) = crate::viewport_status::section_coordinates(origin_mm, normal) {+ let flip = normal.iter().zip(n).map(|(a, b)| a * b).sum::<f64>() < 0.0;+ details.settings = vec![+ field("plane", "ui.details_plane", axis(n)),+ field("offset", "ui.details_offset", length(app, offset)),+ field("flip", "ui.details_flip", DetailValue::Check(flip)),+ field("hatch", "ui.details_hatch", DetailValue::Check(hatch)),+ ];+ }+ }+ StatusSetting::Continuity { .. } => continuity_description(app, &mut details),+ StatusSetting::Environment => {}+ }+ if effect.command != "inspect.continuity"+ && effect.has_key+ && let Some((_, _, rows)) = crate::viewport::analysis_legend_data(app)+ {+ details.key = rows+ .into_iter()+ .enumerate()+ .map(|(index, (colour, label, pattern))| DetailKey {+ colour,+ numeric: label.chars().any(|c| c.is_ascii_digit()),+ label,+ pattern: pattern || (matches!(effect.setting, StatusSetting::Draft { .. }) && index == 2),+ value: String::new(),+ pattern_colour: None,+ })+ .collect();+ }+ details+}++fn continuity_description(app: &SolveApp, details: &mut Details) {+ use solidcraft_engine::status_details::ContinuityVerdict as V;+ let rows = app.session.continuity_details();+ let Some(row) = selected(app, &rows) else { return };+ details.caption = Some(tr("ui.details_continuity_caption"));+ let index = rows.iter().position(|other| record_id(other) == record_id(row)).unwrap_or(0);+ let (scale, unit) = crate::prefs::unit_scale(&app.session.doc.units);+ details.settings = vec![+ field("record", "ui.details_edit_seam", DetailValue::Choice { selected: index, options: rows.iter().map(record_label).collect() }),+ field("gap", "ui.details_gap", length(app, row.gap_tolerance_mm)),+ field("angle", "ui.details_angle", DetailValue::Angle(row.angle_tolerance_deg)),+ field("curvature", "ui.details_curvature", number(row.curvature_tolerance_per_mm / scale, 0.0, 1e9 / scale, &format!(" /{unit}"))),+ field("samples", "ui.details_samples", number(row.samples as f64, 3.0, 257.0, "")),+ ];+ for setting in details.settings.iter_mut().skip(1) {+ setting.enabled = row.current;+ }+ if !row.current {+ details.caption = Some(tr("ui.details_continuity_stale"));+ }+ let t = crate::theme::Tokens::get();+ for (label, colour, count) in [+ ("ui.details_smooth", t.continuity[0], rows.iter().filter(|s| s.verdict == V::Smooth).count()),+ ("ui.details_jump", t.continuity[1], rows.iter().filter(|s| s.verdict == V::CurvatureJump).count()),+ ("ui.details_sharp_gap", t.continuity[2], rows.iter().filter(|s| matches!(s.verdict, V::Sharp | V::Gap)).count()),+ ] {+ details.key.push(DetailKey {+ colour,+ pattern: label == "ui.details_sharp_gap",+ label: tr(label),+ value: count.to_string(),+ numeric: false,+ pattern_colour: (label == "ui.details_sharp_gap").then_some(t.continuity[3]),+ });+ }+ details.findings_title = tr("ui.details_worst_seams");+ details.findings_count = Some(rows.len().to_string());+ let mut findings: Vec<_> = rows.iter().collect();+ findings.sort_by(|a, b| {+ b.verdict.cmp(&a.verdict).then_with(|| b.gap_mm.total_cmp(&a.gap_mm)).then_with(|| b.normal_angle_deg.total_cmp(&a.normal_angle_deg))+ });+ details.findings = findings+ .into_iter()+ .map(|row| {+ let value = match row.verdict {+ V::Gap => format!("G0 {}", crate::prefs::show_mm(app, row.gap_mm, 1)),+ V::Sharp => format!("G1 {}°", row.normal_angle_deg),+ V::CurvatureJump => format!("G2 {} /{unit}", row.curvature_jump_per_mm / scale),+ V::Smooth => format!("G2 {} /{unit}", row.curvature_jump_per_mm / scale),+ };+ DetailFinding { id: record_id(row), label: record_label(row), value, warning: row.verdict != V::Smooth, target: row.current }+ })+ .collect();+ details.actions.push(("copy".into(), tr("ui.details_copy_list")));+}++/// Rebuild a complete command from current Session values for every single-field edit.+/// The value passed by the widget changes exactly one companion of that current command.+pub(crate) fn edit_params(app: &SolveApp, effect: &StatusItem, id: &str, value: &DetailValue) -> Option<Value> {+ match effect.setting {+ StatusSetting::Draft { pull, angle_deg } => {+ Some(json!({"pull":if id=="pull" { axis_value(value)? } else {pull},"angle":if id=="angle"{scalar(value)?}else{angle_deg}}))+ }+ StatusSetting::Zebra { stripes } => Some(json!({"stripes":if id=="stripes"{scalar(value)?}else{stripes}})),+ StatusSetting::Accessibility { direction } => Some(json!({"direction":if id=="direction"{axis_value(value)?}else{direction}})),+ StatusSetting::Curvature { radius_mm } => Some(json!({"radius":if id=="radius"{scalar(value)?}else{radius_mm}})),+ StatusSetting::Section { origin_mm, normal, hatch } => {+ let (_, old_offset, n) = crate::viewport_status::section_coordinates(origin_mm, normal)?;+ let mut base = origin_mm.into_iter().zip(n).map(|(o, n)| o - n * old_offset).collect::<Vec<_>>();+ let new_n = if id == "plane" { axis_value(value)? } else { n };+ if id == "plane" {+ // Project the base onto the new plane, preserving the signed offset companion.+ let projection = base.iter().zip(new_n).map(|(o, n)| o * n).sum::<f64>();+ base = base.into_iter().zip(new_n).map(|(o, n)| o - n * projection).collect();+ }+ let flip = normal.iter().zip(n).map(|(a, b)| a * b).sum::<f64>() < 0.0;+ Some(json!({"plane":{"origin":base,"normal":new_n},"offset":format!("{} mm",if id=="offset"{scalar(value)?}else{old_offset}),+ "flip":if id=="flip"{check(value)?}else{flip},"hatch":if id=="hatch"{check(value)?}else{hatch}}))+ }+ StatusSetting::Continuity { .. } => {+ let rows = app.session.continuity_details();+ let row = selected(app, &rows).filter(|row| row.current)?;+ let scale = crate::prefs::unit_scale(&app.session.doc.units).0;+ let samples = if id == "samples" { scalar(value)? } else { row.samples as f64 };+ Some(json!({"body":row.body,"edges":[{"index":row.edge}],"add":true,"samples":samples,+ "gap_tolerance_mm":if id=="gap"{scalar(value)?}else{row.gap_tolerance_mm},+ "angle_tolerance_deg":if id=="angle"{scalar(value)?}else{row.angle_tolerance_deg},+ "curvature_tolerance_per_mm":if id=="curvature"{scalar(value)?*scale}else{row.curvature_tolerance_per_mm}}))+ }+ StatusSetting::Environment => None,+ }+}+fn scalar(value: &DetailValue) -> Option<f64> {+ match value {+ DetailValue::Number { value, .. } | DetailValue::Length { value, .. } | DetailValue::Slider { value, .. } | DetailValue::Angle(value) => {+ Some(*value)+ }+ _ => None,+ }+}+fn check(value: &DetailValue) -> Option<bool> {+ if let DetailValue::Check(value) = value { Some(*value) } else { None }+}+fn axis_value(value: &DetailValue) -> Option<[f64; 3]> {+ if let DetailValue::Axis { value, .. } = value { Some(*value) } else { None }+}++pub(crate) fn dispatch(app: &mut SolveApp, ctx: &egui::Context, owner: &str, event: DetailEvent) {+ let Some(effect) = app.session.status_items().into_iter().find(|effect| crate::viewport_status::identity(effect) == owner) else { return };+ match event {+ DetailEvent::Change(id, DetailValue::Choice { selected, .. }) if id == "record" && effect.command == "inspect.continuity" => {+ app.viewport_status.selected_record = app.session.continuity_details().get(selected).map(record_id);+ }+ DetailEvent::Change(id, value) => {+ if let Some(params) = edit_params(app, &effect, &id, &value)+ && let Err(error) = app.run(&effect.command, params)+ {+ app.set_status(error, true);+ }+ }+ DetailEvent::Target(id) if effect.command == "inspect.continuity" => {+ let Some((body, edge)) = serde_json::from_str::<(String, usize)>(&id).ok() else { return };+ let Some(points) = app.session.continuity_target_points(&body, edge) else { return };+ let mut bounds = solidcraft_engine::geom::Aabb3::EMPTY;+ for point in points {+ bounds.add(*point);+ }+ if bounds.is_empty() {+ return;+ }+ let mut camera = app.cam;+ camera.fit(&bounds);+ let params = json!({"camera":{"target":camera.target,"yaw":camera.yaw,"pitch":camera.pitch,"distance":camera.distance,"fov":camera.fov,"roll":camera.roll}});+ if let Err(error) = app.run("view.apply", params) {+ app.set_status(error, true);+ }+ }+ DetailEvent::Action(id) if id == "copy" && effect.command == "inspect.continuity" => {+ let rows = app.session.continuity_details();+ if let Ok(text) = serde_json::to_string_pretty(&rows) {+ ctx.copy_text(text.clone());+ app.clipboard_text = Some(text);+ }+ }+ DetailEvent::Action(_) | DetailEvent::Target(_) => {}+ }+}++pub(crate) fn legacy_description(app: &SolveApp) -> Details {+ let mut details = Details::default();+ if let Some((title, along, rows)) = crate::viewport::analysis_legend_data(app) {+ details.caption = Some(along.map_or_else(|| title.to_owned(), |along| format!("{title}\n{along}")));+ details.key = rows+ .into_iter()+ .map(|(colour, label, pattern)| DetailKey {+ colour,+ numeric: label.chars().any(|c| c.is_ascii_digit()),+ label,+ pattern,+ value: String::new(),+ pattern_colour: None,+ })+ .collect();+ }+ details+}++/// Compatibility placement uses the same description and renderer, never a second painter.+pub(crate) fn legacy_legends(app: &SolveApp, ui: &mut egui::Ui, viewport: egui::Rect) {+ let mut descriptions = Vec::new();+ if !app.preferences.viewport_analysis_status {+ descriptions.push(("analysis:legend", legacy_description(app)));+ }+ if (!app.preferences.viewport_analysis_status || !app.preferences.viewport_status_details) && !app.session.continuity.is_empty() {+ let t = crate::theme::Tokens::get();+ let key = ["ui.continuity_g2", "ui.continuity_g1", "ui.continuity_g0", "ui.continuity_gap"]+ .into_iter()+ .zip(t.continuity)+ .enumerate()+ .map(|(index, (label, colour))| DetailKey {+ colour,+ label: tr(label),+ pattern: index == 3,+ value: String::new(),+ numeric: false,+ pattern_colour: None,+ })+ .collect();+ descriptions.push(("continuity_legend", Details { key, ..Default::default() }));+ }+ let mut free = crate::shell::workspace_content(app, viewport);+ for (id, description) in descriptions {+ if let Some(rect) = legacy_legend(app, ui, free, id, &description) {+ free.max.y = (rect.top() - crate::theme::Tokens::get().space_8).max(free.top());+ }+ }+}++fn legacy_legend(_app: &SolveApp, ui: &mut egui::Ui, free: egui::Rect, id: &str, description: &Details) -> Option<egui::Rect> {+ if description.key.is_empty() {+ return None;+ }+ let t = crate::theme::Tokens::get();+ let container = crate::ui_kit::Container::new(ui.ctx(), crate::ui_kit::Surface::ViewportStatus);+ let result = container+ .area(egui::Id::new(id))+ .order(egui::Order::Background)+ .movable(false)+ .pivot(egui::Align2::LEFT_BOTTOM)+ .fixed_pos(free.left_bottom() + egui::vec2(t.space_12, -t.space_12))+ .show(ui.ctx(), |ui| {+ let frame = container.frame(ui.ctx(), t.overlay, crate::frame::Side::Left).inner_margin(t.space_8);+ container.show_frame(ui, frame, free, |ui| {+ crate::ui_kit::details(ui, id, description, free.height() * 0.6, None);+ });+ });+ crate::scenario::publish_target(id, result.response.rect);+ Some(result.response.rect)+}diff --git a/crates/ui-egui/src/viewport_overlays_tests.rs b/crates/ui-egui/src/viewport_overlays_tests.rsindex 7208498967..cdbdc2d91a 100644--- a/crates/ui-egui/src/viewport_overlays_tests.rs+++ b/crates/ui-egui/src/viewport_overlays_tests.rs@@ -1,6 +1,432 @@use super::*;use crate::{scenario::Harness, shell::LayoutMode};+#[test]+fn details_descriptions_are_pure_and_live_edits_preserve_custom_companions() {+ use crate::ui_kit::DetailValue as V;+ let mut h = Harness::new();+ h.app.run("inspect.draft", json!({"pull":[-2,3,-4],"angle":14.5})).unwrap();+ let effect = h.app.session.status_items().remove(0);+ let before = (h.app.session.revision, h.app.session.doc.to_json(), h.app.session.undo.len(), h.app.session.status_items());+ let details = crate::viewport_details::description(&h.app, &effect);+ assert_eq!(details.settings.len(), 2);+ assert_eq!(details.key.len(), 3);+ assert!(details.caption.as_ref().is_some_and(|caption| !caption.contains("Draft")));+ assert!(matches!(details.settings[0].value,V::Axis{value,..} if value[0]<0.0 && value[1]>0.0 && value[2]<0.0));+ assert_eq!((h.app.session.revision, h.app.session.doc.to_json(), h.app.session.undo.len(), h.app.session.status_items()), before);+ let params = crate::viewport_details::edit_params(&h.app, &effect, "angle", &V::Angle(8.25)).unwrap();+ let original = h.app.session.analysis.unwrap();+ h.app.run(&effect.command, params).unwrap();+ match (original, h.app.session.analysis.unwrap()) {+ (solidcraft_engine::SurfaceAnalysis::Draft { pull: a, .. }, solidcraft_engine::SurfaceAnalysis::Draft { pull: b, angle }) => {+ assert_eq!(a, b);+ assert_eq!(angle, 8.25);+ }+ _ => panic!("real Draft command expected"),+ }+ h.app.run("inspect.zebra", json!({"stripes":14.5})).unwrap();+ let effect = h.app.session.status_items().remove(0);+ assert!(matches!(crate::viewport_details::description(&h.app,&effect).settings[0].value,V::Slider{value,..} if value==14.5));+ assert_eq!(+ crate::viewport_details::edit_params(&h.app, &effect, "stripes", &V::Slider { value: 18.75, min: 1.0, max: 200.0 }).unwrap()["stripes"],+ 18.75+ );+ h.app.run("inspect.accessibility", json!({"direction":[1,-2,3]})).unwrap();+ let effect = h.app.session.status_items().remove(0);+ let before = h.app.session.analysis;+ for _ in 0..3 {+ crate::viewport_details::description(&h.app, &effect);+ }+ assert_eq!(h.app.session.analysis, before, "drawing never snaps arbitrary vectors to an axis");+}++#[test]+fn section_details_live_fields_reconstruct_arbitrary_plane_without_losing_companions() {+ use crate::ui_kit::DetailValue as V;+ let mut h = Harness::new();+ h.app.run("inspect.section", json!({"plane":{"origin":[12,-9,7],"normal":[-3,4,-2]},"offset":"-5 mm","flip":true,"hatch":false})).unwrap();+ let original = h.app.session.section.unwrap();+ let effect = h.app.session.status_items().remove(0);+ let params = crate::viewport_details::edit_params(&h.app, &effect, "hatch", &V::Check(true)).unwrap();+ h.app.run("inspect.section", params).unwrap();+ let changed = h.app.session.section.unwrap();+ assert!((original.0 - changed.0).len() < 1e-9 && (original.1 - changed.1).len() < 1e-9);+ assert!(h.app.session.section_hatch);+ let effect = h.app.session.status_items().remove(0);+ let details = crate::viewport_details::description(&h.app, &effect);+ let current_flip = match details.settings.iter().find(|setting| setting.id == "flip").unwrap().value {+ V::Check(value) => value,+ _ => panic!("actual flip checkbox"),+ };+ assert!(!current_flip, "the first-positive canonical normal already agrees with this actual flipped negative input");+ let params = crate::viewport_details::edit_params(&h.app, &effect, "flip", &V::Check(!current_flip)).unwrap();+ assert_eq!(params["hatch"], true);+ h.app.run("inspect.section", params).unwrap();+ let flipped = h.app.session.section.unwrap();+ assert!((original.0 - flipped.0).len() < 1e-9);+ assert!((original.1 + flipped.1).len() < 1e-9);+ h.app.session.doc_mut().units = "in".into();+ let effect = h.app.session.status_items().remove(0);+ let params = crate::viewport_details::edit_params(&h.app, &effect, "offset", &V::Length { value: -25.4, units: "in".into() }).unwrap();+ assert_eq!(params["offset"], "-25.4 mm");+ assert_eq!(params["hatch"], true);+ assert_eq!(params["flip"], !current_flip);+ h.app.run("inspect.section", params).unwrap();+ assert!((h.app.session.section.unwrap().1 - flipped.1).len() < 1e-9);+}++#[test]+fn details_record_scope_preserves_mixed_limits_and_stale_targets_never_move_camera() {+ use crate::ui_kit::{DetailEvent, DetailValue as V};+ let mut h = Harness::new();+ h.app.run("solid.box", json!({"length":10,"width":10,"height":10})).unwrap();+ h.app+ .run(+ "inspect.continuity",+ json!({"edges":[[5,0,0]],"samples":5,"gap_tolerance_mm":0.002,"angle_tolerance_deg":2,"curvature_tolerance_per_mm":0.03}),+ )+ .unwrap();+ h.app+ .run(+ "inspect.continuity",+ json!({"edges":[[0,5,0]],"samples":9,"gap_tolerance_mm":0.008,"angle_tolerance_deg":4,"curvature_tolerance_per_mm":0.06,"add":true}),+ )+ .unwrap();+ let effect = h.app.session.status_items().remove(0);+ let owner = crate::viewport_status::identity(&effect);+ let rows = h.app.session.continuity_details();+ h.app.viewport_status.selected_record = Some(json!([rows[1].body, rows[1].edge]).to_string());+ h.app.session.doc_mut().units = "in".into();+ let description = crate::viewport_details::description(&h.app, &effect);+ assert_eq!(description.findings.len(), 2);+ assert!(matches!(description.settings[3].value,V::Number{value,..} if (value-0.06*25.4).abs()<1e-12));+ let params =+ crate::viewport_details::edit_params(&h.app, &effect, "samples", &V::Number { value: 11.0, min: 3.0, max: 257.0, suffix: String::new() })+ .unwrap();+ assert_eq!(params["edges"][0]["index"], rows[1].edge);+ assert_eq!(params["gap_tolerance_mm"], 0.008);+ assert_eq!(params["angle_tolerance_deg"], 4.0);+ assert_eq!(params["curvature_tolerance_per_mm"], 0.06);+ h.app.run("inspect.continuity", params).unwrap();+ assert_eq!(h.app.session.continuity.iter().find(|row| row.edge == rows[0].edge).unwrap().details, rows[0]);+ crate::viewport_details::dispatch(&mut h.app, &h.ctx, &owner, DetailEvent::Action("copy".into()));+ let copied: serde_json::Value = serde_json::from_str(h.app.clipboard_text.as_deref().unwrap()).unwrap();+ assert_eq!(copied.as_array().unwrap().len(), 2);+ assert!(copied.as_array().unwrap().iter().any(|row| row["samples"] == 11));+ let target = json!([rows[1].body, rows[1].edge]).to_string();+ crate::viewport_details::dispatch(&mut h.app, &h.ctx, &owner, DetailEvent::Target(target.clone()));+ assert!(h.app.session.camera.is_some(), "real view.apply is dispatched");+ h.app.run("body.rename", json!({"body":rows[1].body,"name":"Changed"})).unwrap();+ let before = h.app.session.camera;+ crate::viewport_details::dispatch(&mut h.app, &h.ctx, &owner, DetailEvent::Target(target));+ assert_eq!(h.app.session.camera, before);+ let effect = h.app.session.status_items().remove(0);+ assert!(crate::viewport_details::edit_params(&h.app, &effect, "gap", &V::Length { value: 1.0, units: "in".into() }).is_none());+ assert!(crate::viewport_details::description(&h.app, &effect).findings.iter().all(|row| !row.target));+}++#[test]+fn modern_details_cards_open_focus_suspend_and_close_before_effects() {+ for (command, params, field) in [+ ("inspect.draft", json!({"pull":[-1,2,3],"angle":3}), "angle"),+ ("inspect.zebra", json!({"stripes":14.5}), "stripes"),+ ("inspect.section", json!({"plane":"XY","at":4}), "offset"),+ ] {+ let mut h = Harness::new();+ h.app.run(command, params).unwrap();+ h.frames(3);+ let effect = h.app.session.status_items().remove(0);+ let item = crate::viewport_status::presentation(&h.app, &effect).unwrap();+ assert!(item.has_key && item.editable);+ h.step(&json!({"click":{"handle":format!("viewport_status:{}:setting",item.id)}})).unwrap();+ h.frames(3);+ assert!(h.app.dialog.is_none());+ assert!(crate::scenario::rect_of(&format!("details:field:{field}")).is_some());+ assert!(+ crate::ui_kit::details_field_owns_focus(&h.ctx),+ "{command}: the corresponding visible native value must own focus, actual {:?}",+ h.ctx.memory(|memory| memory.focused())+ );+ h.step(&json!({"key":"Escape"})).unwrap();+ assert!(h.app.viewport_status.open_key.is_some(), "{command}: the focused value owns the first Escape");+ h.step(&json!({"key":"Escape"})).unwrap();+ assert!(h.app.viewport_status.open_key.is_none());+ assert_eq!(h.app.session.status_items().len(), 1);+ h.step(&json!({"click":{"handle":format!("viewport_status:{}:key",item.id)}})).unwrap();+ h.call("ui.prefs", json!({"open":"Interface"}));+ h.frames(3);+ assert!(crate::scenario::rect_of("viewport_status:card").is_none(), "modern card suspended beneath Preferences");+ h.step(&json!({"key":"Escape"})).unwrap();+ assert!(h.app.viewport_status.open_key.is_some());+ assert_eq!(h.app.session.status_items().len(), 1);+ h.frames(3);+ h.step(&json!({"key":"Escape"})).unwrap();+ assert!(h.app.viewport_status.open_key.is_none());+ h.step(&json!({"key":"Escape"})).unwrap();+ assert!(h.app.session.status_items().is_empty());+ }+}++#[test]+fn details_native_value_edits_run_real_commands_without_design_history() {+ for (command, params, field, text, expected) in [+ ("inspect.draft", json!({"pull":[-2,3,-4],"angle":3.5}), "angle", "8.25", 8.25),+ ("inspect.zebra", json!({"stripes":14.5}), "stripes", "17.25", 17.25),+ ("inspect.section", json!({"plane":"XY","at":"25.4 mm","hatch":false}), "offset", "1.5", 38.1),+ ] {+ let mut h = Harness::new();+ h.app.session.doc_mut().units = "in".into();+ h.app.run(command, params).unwrap();+ h.frames(3);+ let before = (h.app.session.doc.to_json(), h.app.session.undo.len());+ let effect = h.app.session.status_items().remove(0);+ let owner = crate::viewport_status::identity(&effect);+ h.step(&json!({"click":{"handle":format!("viewport_status:{owner}:setting")}})).unwrap();+ h.frames(3);+ let rect = crate::scenario::rect_of(&format!("details:field:{field}")).unwrap();+ let at = if field == "stripes" { rect.right_center() - vec2(crate::theme::Tokens::get().space_24, 0.0) } else { rect.center() };+ h.call("ui.click", json!({"x":at.x,"y":at.y,"double":true}));+ h.step(&json!({"key":"A","ctrl":true})).unwrap();+ h.step(&json!({"text":text})).unwrap();+ h.step(&json!({"key":"Enter"})).unwrap();+ h.frames(3);+ let value = match h.app.session.status_items()[0].setting {+ solidcraft_engine::status_items::StatusSetting::Draft { angle_deg, .. } => angle_deg,+ solidcraft_engine::status_items::StatusSetting::Zebra { stripes } => stripes,+ solidcraft_engine::status_items::StatusSetting::Section { origin_mm, .. } => origin_mm[2],+ _ => panic!("real edited setting expected"),+ };+ assert!((value - expected).abs() < 1e-9, "native {field}: {value} instead of {expected}");+ assert_eq!((h.app.session.doc.to_json(), h.app.session.undo.len()), before);+ assert!(h.app.dialog.is_none());+ }+}++#[test]+fn details_owned_dropdown_suspends_without_leaking_above_preferences_or_mode_changes() {+ let mut h = Harness::new();+ h.app.run("solid.box", json!({"length":10,"width":10,"height":10})).unwrap();+ h.app.run("inspect.continuity", json!({})).unwrap();+ h.frames(3);+ let owner = crate::viewport_status::identity(&h.app.session.status_items()[0]);+ h.step(&json!({"click":{"handle":format!("viewport_status:{owner}:key")}})).unwrap();+ h.frames(3);+ h.step(&json!({"click":{"handle":"details:field:record"}})).unwrap();+ h.frames(3);+ assert!(egui::Popup::is_any_open(&h.ctx));+ let before = h.app.session.continuity.clone();+ h.call("ui.prefs", json!({"open":"Interface"}));+ h.frames(3);+ assert!(!egui::Popup::is_any_open(&h.ctx));+ assert!(crate::scenario::rect_of("viewport_status:card").is_none());+ assert!(!h.app.viewport_status.owns_focus(&h.ctx));+ assert_eq!(h.app.session.continuity, before);+ h.step(&json!({"key":"Escape"})).unwrap();+ h.frames(3);+ assert!(h.app.viewport_status.open_key.is_some());+ h.call("ui.prefs", json!({"viewport_status_details":false}));+ h.frames(3);+ assert!(h.app.viewport_status.open_key.is_none());+ assert!(!egui::Popup::is_any_open(&h.ctx));+ assert!(!crate::ui_kit::details_field_owns_focus(&h.ctx));+ assert_eq!(h.app.session.continuity, before);+}++#[test]+fn details_preference_and_analysis_hud_policies_are_independent() {+ for modern in [false, true] {+ for hud in [false, true] {+ let mut h = Harness::new();+ h.call("ui.prefs", json!({"viewport_status_details":modern,"viewport_analysis_status":hud,"viewport_status_summary":false}));+ h.app.run("inspect.draft", json!({"angle":3.5})).unwrap();+ h.frames(3);+ assert_eq!(crate::scenario::rect_of("analysis:legend").is_some(), !hud);+ let effect = h.app.session.status_items().remove(0);+ if hud {+ let description =+ if modern { crate::viewport_details::description(&h.app, &effect) } else { crate::viewport_details::legacy_description(&h.app) };+ assert_eq!(description.settings.is_empty(), !modern);+ assert_eq!(description.key.len(), 3);+ }+ h.app.run("inspect.zebra", json!({"stripes":14.5})).unwrap();+ let effect = h.app.session.status_items().remove(0);+ assert_eq!(crate::viewport_status::presentation(&h.app, &effect).is_some_and(|item| item.has_key), hud && modern);+ h.app.run("inspect.section", json!({"plane":"XY"})).unwrap();+ let section = h.app.session.status_items().into_iter().find(|effect| effect.command == "inspect.section").unwrap();+ let item = crate::viewport_status::presentation(&h.app, §ion).unwrap();+ assert_eq!(item.has_key, modern);+ crate::viewport_status::dispatch(&mut h.app, vec![crate::ui_kit::StatusAction::Edit(item.id)]);+ assert_eq!(h.app.dialog.is_some(), !modern);+ assert_eq!(h.app.viewport_status.open_key.is_some(), modern);+ }+ }+}++#[test]+fn details_findings_and_readout_scroll_inside_with_fixed_caption_and_actions() {+ for theme in ["light", "dark"] {+ for vision in ["off", "protan", "deutan", "tritan"] {+ for (preset, counter) in [("details_findings", "details:findings_visible"), ("details_readout", "details:readout_visible")] {+ let mut h = Harness::new();+ h.call("ui.prefs", json!({"theme":theme,"color_vision":vision}));+ let before = (h.app.session.doc.to_json(), h.app.session.revision, h.app.session.status_items());+ h.call("ui.status_fixture", json!({"preset":preset}));+ h.frames(3);+ h.step(&json!({"click":{"handle":"viewport_status:details:key"}})).unwrap();+ h.frames(3);+ assert_eq!(crate::scenario::count_of(counter), Some(6.0));+ let caption = crate::scenario::rect_of("details:caption").unwrap();+ let actions = crate::scenario::rect_of("details:actions").unwrap();+ let body = crate::scenario::rect_of("details:body").unwrap();+ let card = crate::scenario::rect_of("viewport_status:card").unwrap();+ let viewport = h.app.viewport.layout.as_ref().unwrap().viewport;+ assert!(card.height() <= viewport.height() * 0.6 + 1.0, "{theme}/{vision}/{preset}: {card:?}");+ let camera = h.app.cam;+ h.call("ui.scroll", json!({"x":body.center().x,"y":body.center().y,"delta":-1800}));+ h.frames(3);+ assert_eq!(h.app.cam, camera, "scrolling a card must not zoom the CAD view");+ assert_eq!(crate::scenario::rect_of("details:caption").unwrap(), caption);+ assert_eq!(crate::scenario::rect_of("details:actions").unwrap(), actions);+ h.step(&json!({"click":{"handle":"details:show_all"}})).unwrap();+ h.frames(3);+ assert_eq!(crate::scenario::count_of(counter), Some(9.0), "Show all must expose backed rows");+ assert_eq!(+ (h.app.session.doc.to_json(), h.app.session.revision, h.app.session.status_items()),+ before,+ "clearly separate specimens never create production results"+ );+ }+ }+ }+}++#[test]+fn details_outside_close_returns_live_owner_focus_and_replacement_reconciles() {+ let mut h = Harness::new();+ h.app.run("inspect.draft", json!({"angle":3})).unwrap();+ h.frames(3);+ let owner = crate::viewport_status::identity(&h.app.session.status_items()[0]);+ h.step(&json!({"click":{"handle":format!("viewport_status:{owner}:key")}})).unwrap();+ h.frames(3);+ let viewport = h.app.viewport.layout.as_ref().unwrap().viewport;+ let outside = viewport.right_bottom() - vec2(60.0, 60.0);+ h.call("ui.click", json!({"x":outside.x,"y":outside.y}));+ h.frames(3);+ assert!(h.app.viewport_status.open_key.is_none());+ assert!(h.app.viewport_status.owns_focus(&h.ctx), "focus returns to the still-present arrow");+ h.step(&json!({"click":{"handle":format!("viewport_status:{owner}:key")}})).unwrap();+ h.frames(3);+ h.app.run("inspect.zebra", json!({"stripes":14.5})).unwrap();+ h.frames(3);+ assert!(h.app.viewport_status.open_key.is_none());+ assert!(matches!(h.app.session.analysis,Some(solidcraft_engine::SurfaceAnalysis::Zebra{stripes}) if stripes==14.5));+ assert!(crate::scenario::rect_of("viewport_status:card").is_none());+}++#[test]+fn details_document_identity_releases_equal_slot_owners_and_native_buffers() {+ let mut h = Harness::new();+ h.app.run("solid.box", json!({"length":10,"width":10,"height":10})).unwrap();+ h.app.run("inspect.draft", json!({"angle":3})).unwrap();+ h.frames(3);+ let uid = h.app.session.uid;+ let owner = crate::viewport_status::identity(&h.app.session.status_items()[0]);+ h.step(&json!({"click":{"handle":format!("viewport_status:{owner}:setting")}})).unwrap();+ h.frames(3);+ assert!(crate::ui_kit::details_field_owns_focus(&h.ctx));+ h.call("ui.documents", json!({"action":"new"}));+ h.app.run("solid.box", json!({"length":20,"width":10,"height":10})).unwrap();+ h.app.run("inspect.draft", json!({"angle":7})).unwrap();+ h.frames(3);+ assert_ne!(h.app.session.uid, uid);+ assert_eq!(+ crate::viewport_status::identity(&h.app.session.status_items()[0]),+ owner,+ "equal command/slot identities really exercise document ownership"+ );+ assert!(h.app.viewport_status.open_key.is_none());+ assert!(!crate::ui_kit::details_field_owns_focus(&h.ctx));+ h.step(&json!({"click":{"handle":format!("viewport_status:{owner}:setting")}})).unwrap();+ h.frames(3);+ assert!(crate::ui_kit::details_field_owns_focus(&h.ctx));+ h.call("ui.documents", json!({"action":"switch","index":0}));+ h.frames(3);+ assert_eq!(h.app.session.uid, uid);+ assert!(h.app.viewport_status.open_key.is_none());+ assert!(!egui::Popup::is_any_open(&h.ctx));+ assert!(matches!(h.app.session.analysis,Some(solidcraft_engine::SurfaceAnalysis::Draft{angle,..}) if angle==3.0));+}++#[test]+fn details_grouped_continuity_key_contains_the_actual_sharp_and_gap_tokens() {+ for theme in ["light", "dark"] {+ for vision in ["off", "protan", "deutan", "tritan"] {+ let mut h = Harness::new();+ h.call("ui.prefs", json!({"theme":theme,"color_vision":vision}));+ h.app.run("solid.box", json!({"length":10,"width":10,"height":10})).unwrap();+ h.app.run("inspect.continuity", json!({})).unwrap();+ h.frames(3);+ let effect = h.app.session.status_items().remove(0);+ let details = crate::viewport_details::description(&h.app, &effect);+ let key = &details.key[2];+ let tokens = crate::theme::Tokens::get();+ assert_eq!(key.value, "12");+ assert_eq!(key.colour, tokens.continuity[2], "actual cube creases use the Sharp scene token");+ assert_eq!(key.pattern_colour, Some(tokens.continuity[3]), "the grouped key also carries the actual Gap scene token");+ assert!(key.pattern);+ assert!(h.app.session.continuity_details().iter().all(|row| row.verdict == solidcraft_engine::status_details::ContinuityVerdict::Sharp));+ }+ }+}++#[test]+fn details_tool_and_native_record_menu_each_keep_the_first_escape() {+ let mut h = Harness::new();+ h.app.run("solid.box", json!({"length":10,"width":10,"height":10})).unwrap();+ h.app.start("inspect.continuity");+ h.frames(3);+ let owner = crate::viewport_status::identity(&h.app.session.status_items()[0]);+ h.step(&json!({"click":{"handle":format!("viewport_status:{owner}:key")}})).unwrap();+ h.frames(3);+ assert!(h.app.tool.is_some());+ h.step(&json!({"key":"Escape"})).unwrap();+ assert!(h.app.tool.is_none());+ assert!(h.app.viewport_status.open_key.is_some());+ assert!(!h.app.session.continuity.is_empty());+ h.step(&json!({"click":{"handle":"details:field:record"}})).unwrap();+ h.frames(3);+ assert!(egui::Popup::is_any_open(&h.ctx));+ h.step(&json!({"key":"Escape"})).unwrap();+ assert!(!egui::Popup::is_any_open(&h.ctx));+ assert!(h.app.viewport_status.open_key.is_some());+ assert!(!h.app.session.continuity.is_empty());+}++#[test]+fn details_summary_owner_anchors_and_count_changes_release_stale_cards() {+ let mut h = summary_three_effects();+ h.step(&json!({"click":{"handle":"viewport_status:summary"}})).unwrap();+ h.frames(3);+ let effect = h.app.session.status_items().into_iter().find(|effect| effect.command == "inspect.section").unwrap();+ let owner = crate::viewport_status::identity(&effect);+ h.step(&json!({"click":{"handle":format!("viewport_status:{owner}:key")}})).unwrap();+ h.frames(3);+ let badge = crate::scenario::rect_of("viewport_status:summary").unwrap();+ let outline = crate::scenario::rect_of("viewport_status:row").unwrap();+ let card = crate::scenario::rect_of("viewport_status:card").unwrap();+ assert!(outline.contains_rect(badge), "interactive target {badge:?} inside visible owner outline {outline:?}");+ assert!(+ (outline.left() - card.left()).abs() < 1.0 && card.top() > outline.bottom(),+ "visible owner {outline:?}, target {badge:?}, card {card:?}"+ );+ assert!(!egui::Popup::is_any_open(&h.ctx));+ h.app.run("inspect.continuity", json!({"clear":true})).unwrap();+ h.frames(3);+ assert!(h.app.viewport_status.open_key.is_none());+ assert!(crate::scenario::rect_of("viewport_status:card").is_none());+ assert!(h.app.session.section.is_some() && h.app.session.analysis.is_some());+}+#[test]fn viewport_status_specimens_clear_and_open_keys_without_engine_changes() {let mut h = Harness::new();@@ -721,6 +1147,7 @@ fn bottom_readouts_clear_floating_history_on_the_first_frame() {#[test]fn continuity_legend_clears_floating_history() {let mut h = Harness::new();+ h.app.preferences.viewport_status_details = false;h.app.ui.layout = LayoutMode::Floating;h.app.preferences.timeline_left = false;h.app.ui.show_timeline = true;@@ -1144,6 +1571,7 @@ fn selected_sketch_point_aliases_respect_owner_and_visibility() {#[test]fn live_analysis_status_uses_session_settings_and_declared_clear_without_history() {let mut h = Harness::new();+ h.app.preferences.viewport_status_details = false;h.app.run("solid.box", json!({"length":10,"width":10,"height":10})).unwrap();h.app.session.mark_saved();let before = (h.app.session.doc.to_json(), h.app.session.undo.len());@@ -1282,6 +1710,7 @@ fn analysis_status_ignores_invalid_layout_bounds_without_ending_the_effect() {#[test]fn section_status_formats_actual_geometry_in_design_units_without_flip_sign_changes() {let mut h = Harness::new();+ h.app.preferences.viewport_status_details = false;for (params, metric, imperial) in [(json!({"plane":"XY","at":25.4,"hatch":false}), "Z 25.40 mm", "Z 1.000 in"),(json!({"plane":"XZ","at":-25.4,"flip":true}), "Y -25.40 mm · hatch", "Y -1.000 in · hatch"),@@ -1465,6 +1894,7 @@ fn analysis_status_escape_owner_survives_egui_layout_repasses() {fn analysis_status_row_and_key_stay_below_preferences_and_cannot_steal_its_click() {for window_first in [false, true] {let mut h = Harness::new();+ h.app.preferences.viewport_status_details = false;if window_first {h.call("ui.prefs", json!({"open":"Interface"}));}@@ -1969,6 +2399,85 @@ fn summary_native_menu_escape_is_close_only_then_newest_replacement_clears_and_uassert!(crate::scenario::rect_of("viewport_status:summary").is_none());}+#[test]+fn summary_menu_yields_to_preferences_and_command_dialog_without_resuming_or_stealing_focus() {+ use solidcraft_engine::status_items::StatusId;+ fn contains_text(shape: &Shape, text: &str) -> bool {+ match shape {+ Shape::Text(shape) => shape.galley.text() == text,+ Shape::Vec(shapes) => shapes.iter().any(|shape| contains_text(shape, text)),+ _ => false,+ }+ }+ for owner in ["preferences", "command", "stacked"] {+ let mut h = summary_three_effects();+ let frames = (h.ctx.global_style().animation_time * 60.0).ceil() as usize + 2;+ h.step(&json!({"click":{"handle":"viewport_status:summary"}})).unwrap();+ h.frames(frames);+ assert!(egui::Popup::is_any_open(&h.ctx));+ assert!(crate::scenario::rect_of("menu:viewport_status_clear_all").is_some());+ let effects = h.app.session.status_items();+ let eligible = [StatusId::SurfaceAnalysis, StatusId::Continuity, StatusId::Section];+ let newest = h.app.session.newest_status_item(&eligible);+ let document = serde_json::to_value(&*h.app.session.doc).unwrap();+ if owner != "preferences" {+ h.app.start("solid.fillet");+ assert!(h.app.dialog.is_some());+ }+ if owner != "command" {+ h.call("ui.prefs", json!({"open":"Interface"}));+ }+ h.frames(frames);+ assert!(!egui::Popup::is_any_open(&h.ctx), "{owner} dismisses the lower Summary popup");+ assert!(crate::scenario::rect_of("menu:viewport_status_clear_all").is_none());+ let heading = crate::i18n::tr("ui.viewport_status_summary_heading").to_uppercase();+ assert!(!h.shapes.iter().any(|shape| contains_text(&shape.shape, &heading)), "no Summary list paints over {owner}");+ if owner != "command" {+ h.step(&json!({"click":{"handle":"prefs:search"}})).unwrap();+ let focus = h.ctx.memory(|memory| memory.focused()).expect("native click focuses Preferences search");+ h.frames(frames);+ assert_eq!(h.ctx.memory(|memory| memory.focused()), Some(focus), "Summary must not reclaim focus");+ assert!(!h.app.viewport_status.owns_focus(&h.ctx));+ }+ h.step(&json!({"key":"Escape"})).unwrap();+ assert!(!h.app.prefs_window.open);+ assert_eq!(h.app.dialog.is_some(), owner == "stacked", "one Escape closes only the highest owner");+ assert_eq!(h.app.session.status_items(), effects);+ assert_eq!(h.app.session.newest_status_item(&eligible), newest);+ assert_eq!(serde_json::to_value(&*h.app.session.doc).unwrap(), document);+ assert!(!egui::Popup::is_any_open(&h.ctx), "a dismissed Summary must not reopen after the owner closes");+ if owner == "stacked" {+ h.step(&json!({"key":"Escape"})).unwrap();+ assert!(h.app.dialog.is_none());+ assert_eq!(h.app.session.status_items(), effects);+ }+ h.step(&json!({"click":{"handle":"viewport_status:summary"}})).unwrap();+ h.frames(frames);+ assert!(egui::Popup::is_any_open(&h.ctx), "a distinct native click can reopen Summary");+ assert_eq!(h.app.session.status_items(), effects);+ }+}++#[test]+fn summary_menu_keeps_tool_owned_row_clear_available() {+ let mut h = summary_three_effects();+ h.app.run("inspect.continuity", json!({"clear":true})).unwrap();+ h.app.start("inspect.continuity");+ let frames = (h.ctx.global_style().animation_time * 60.0).ceil() as usize + 2;+ h.frames(frames);+ assert!(h.app.tool.is_some());+ assert_eq!(h.app.session.status_items().len(), 3);+ h.step(&json!({"click":{"handle":"viewport_status:summary"}})).unwrap();+ h.frames(frames);+ assert!(egui::Popup::is_any_open(&h.ctx), "a Tool is not a higher modal owner");+ let section = h.app.session.status_items().into_iter().find(|item| item.id == solidcraft_engine::status_items::StatusId::Section).unwrap();+ let section = crate::viewport_status::presentation(&h.app, §ion).unwrap();+ h.step(&json!({"click":{"handle":format!("viewport_status:{}:close", section.id)}})).unwrap();+ assert!(h.app.session.section.is_none());+ assert!(h.app.tool.is_some(), "row X retains the active Tool");+ assert!(h.app.session.analysis.is_some() && !h.app.session.continuity.is_empty());+}+#[test]fn summary_popup_closes_on_preference_count_and_replacement_transitions() {for transition in ["disable", "count", "replace", "zero"] {diff --git a/crates/ui-egui/src/viewport_status.rs b/crates/ui-egui/src/viewport_status.rsindex e0dcd957b8..45605adb58 100644--- a/crates/ui-egui/src/viewport_status.rs+++ b/crates/ui-egui/src/viewport_status.rs@@ -59,11 +59,11 @@ pub(crate) fn section_setting(app: &SolveApp, origin: [f64; 3], normal: [f64; 3]Some(text)}-fn identity(effect: &Effect) -> String {+pub(crate) fn identity(effect: &Effect) -> String {format!("{:?}:{}", effect.id, effect.command)}-fn direction(value: [f64; 3]) -> String {+pub(crate) fn direction(value: [f64; 3]) -> String {for (axis, vector) in [("X", [1.0, 0.0, 0.0]), ("Y", [0.0, 1.0, 0.0]), ("Z", [0.0, 0.0, 1.0])] {if value.iter().zip(vector).all(|(a, b)| (*a - b).abs() < 1e-8) {return axis.into();@@ -95,8 +95,8 @@ pub(crate) fn presentation(app: &SolveApp, effect: &Effect) -> Option<StatusItemkind: StatusKind::Mode,name: crate::toolbar::persistent_button_name(app, command),setting,- has_key: effect.has_key,- editable: effect.id == StatusId::Section,+ has_key: if app.preferences.viewport_status_details { effect.has_details() } else { effect.has_key },+ editable: if app.preferences.viewport_status_details { effect.has_details() } else { effect.id == StatusId::Section },})}@@ -115,9 +115,10 @@ pub(crate) fn escape(app: &mut SolveApp, repeat: bool) -> bool {if repeat {return app.viewport_status.open_key.is_some() || has_effect(app);}- if let Some(open) = app.viewport_status.open_key.take()- && app.session.status_items().iter().any(|effect| eligible(app).contains(&effect.id) && effect.has_key && identity(effect) == open)+ if let Some(open) = app.viewport_status.open_key.clone()+ && app.session.status_items().iter().any(|effect| presentation(app, effect).is_some_and(|item| item.has_key && item.id == open)){+ app.viewport_status.close_details();return true;}if let Some(effect) = app.session.newest_status_item(&eligible(app)) {@@ -129,10 +130,49 @@ pub(crate) fn escape(app: &mut SolveApp, repeat: bool) -> bool {/// Reconcile before shortcut routing so a vanished native popup cannot own Escape invisibly.pub(crate) fn reconcile(app: &mut SolveApp, ctx: &egui::Context) {+ app.viewport_status.reconcile_session(ctx, app.session.uid);+ // A visible native field must retain focus through a completed input frame before+ // consuming the request; hidden Area measurement is not a focus acknowledgement.+ if ui_kit::details_field_owns_focus(ctx) || ui_kit::details_control_owns_focus(ctx) {+ app.viewport_status.focus_field = None;+ }+ if app.viewport_status.live_details != app.preferences.viewport_status_details && app.viewport_status.open_key.is_some() {+ ui_kit::dismiss_details_popups(ctx);+ if ui_kit::details_field_owns_focus(ctx) || ui_kit::details_control_owns_focus(ctx) {+ ctx.memory_mut(|memory| {+ if let Some(id) = memory.focused() {+ memory.surrender_focus(id);+ }+ });+ }+ app.viewport_status.open_key = None;+ app.viewport_status.focus_field = None;+ }+ app.viewport_status.live_details = app.preferences.viewport_status_details;let items: Vec<_> = app.session.status_items().iter().filter_map(|effect| presentation(app, effect)).collect();+ if app.viewport_status.open_key.as_ref().is_some_and(|open| !items.iter().any(|item| item.has_key && &item.id == open)) {+ ui_kit::dismiss_details_popups(ctx);+ if ui_kit::details_field_owns_focus(ctx) || ui_kit::details_control_owns_focus(ctx) {+ ctx.memory_mut(|memory| {+ if let Some(id) = memory.focused() {+ memory.surrender_focus(id);+ }+ });+ }+ app.viewport_status.open_key = None;+ app.viewport_status.focus_field = None;+ }let members =if app.preferences.viewport_status_summary && items.len() >= 3 { items.into_iter().map(|item| item.id).collect() } else { Vec::new() };app.viewport_status.reconcile_summary(ctx, members);+ // The popup is a separate foreground host: the badge's Background layer cannot+ // shield it. Tools deliberately remain eligible for their existing row actions.+ let higher_owner = app.prefs_window.open+ || app.dialog.is_some()+ || app.keymap.open+ || app.ui.palette_open+ || ctx.memory(|memory| memory.top_modal_layer().is_some());+ app.viewport_status.suspend_summary(ctx, higher_owner);}pub(crate) fn show(app: &mut SolveApp, ctx: &egui::Context, viewport: egui::Rect) {@@ -142,7 +182,7 @@ pub(crate) fn show(app: &mut SolveApp, ctx: &egui::Context, viewport: egui::Rectreturn;}let effects = app.session.status_items();- if !app.preferences.viewport_analysis_status {+ if !app.preferences.viewport_analysis_status && !app.preferences.viewport_section_status {app.viewport_status.open_key = None;}let items: Vec<_> = effects.iter().filter_map(|effect| presentation(app, effect)).collect();@@ -164,10 +204,35 @@ pub(crate) fn show(app: &mut SolveApp, ctx: &egui::Context, viewport: egui::Rectif !free.is_finite() || !free.is_positive() {return;}- let legend = crate::viewport::analysis_legend_data(app);- let key_contents = |ui: &mut egui::Ui, _: &str| {- if let Some((title, along, rows)) = &legend {- ui_kit::analysis_key(ui, title, along.as_deref(), rows);+ let modern = app.preferences.viewport_status_details;+ let descriptions: Vec<_> = effects+ .iter()+ .filter_map(|effect| {+ presentation(app, effect).map(|item| {+ let details =+ if modern { crate::viewport_details::description(app, effect) } else { crate::viewport_details::legacy_description(app) };+ (item.id, details)+ })+ })+ .collect();+ if let Some(field) = app.viewport_status.focus_field.as_deref()+ && !descriptions.iter().any(|(owner, details)| {+ Some(owner.as_str()) == app.viewport_status.open_key.as_deref()+ && details.settings.iter().any(|setting| setting.id == field && setting.enabled)+ })+ {+ app.viewport_status.focus_field = None;+ }+ let focus = app.viewport_status.focus_field.clone();+ let session_uid = app.session.uid;+ let mut edits = Vec::new();+ let key_contents = |ui: &mut egui::Ui, id: &str| {+ if let Some((_, description)) = descriptions.iter().find(|(owner, _)| owner == id) {+ ui.push_id(session_uid, |ui| {+ edits.extend(+ ui_kit::details(ui, id, description, free.height() * 0.6, focus.as_deref()).into_iter().map(|event| (id.to_owned(), event)),+ );+ });}};let newest = app.session.newest_status_item(&eligible(app)).map(|effect| identity(&effect));@@ -177,6 +242,9 @@ pub(crate) fn show(app: &mut SolveApp, ctx: &egui::Context, viewport: egui::Rectui_kit::viewport_status_row(ctx, free, &items, &mut app.viewport_status, key_contents)};dispatch(app, actions);+ for (owner, event) in edits {+ crate::viewport_details::dispatch(app, ctx, &owner, event);+ }}/// Resolve requests against current represented effects, never a menu-open snapshot.@@ -197,7 +265,12 @@ pub(crate) fn dispatch(app: &mut SolveApp, actions: Vec<StatusAction>) {}}StatusAction::Edit(id) => {- if effects.iter().any(|effect| effect.id == StatusId::Section && identity(effect) == id) {+ if app.preferences.viewport_status_details {+ if let Some(effect) = effects.iter().find(|effect| identity(effect) == id) {+ app.viewport_status.focus_field = Some(crate::viewport_details::primary(effect).into());+ app.viewport_status.open_key = Some(id);+ }+ } else if effects.iter().any(|effect| effect.id == StatusId::Section && identity(effect) == id) {crate::dialogs::edit_section(app);}}diff --git a/crates/ui-egui/src/viewport_status_fixture.rs b/crates/ui-egui/src/viewport_status_fixture.rsindex 92132dc4a2..fdf49ad4f9 100644--- a/crates/ui-egui/src/viewport_status_fixture.rs+++ b/crates/ui-egui/src/viewport_status_fixture.rs@@ -6,12 +6,70 @@ use serde_json::{Value, json};pub(crate) struct Fixture {items: Vec<StatusItem>,presentation: StatusPresentation,+ details_readout: bool,}fn item(id: &str, kind: StatusKind, label: &str, setting: String, has_key: bool) -> StatusItem {StatusItem { id: id.into(), kind, name: crate::i18n::tr(label).into(), setting, has_key, editable: false }}+fn specimen(id: &str, readout: bool) -> crate::ui_kit::Details {+ use crate::ui_kit::{DetailFinding, DetailKey, DetailSetting, DetailValue, Details};+ let t = crate::theme::Tokens::get();+ let tr = |id| crate::i18n::tr(id).to_owned();+ let mut description = Details { caption: Some(tr("ui.details_fixture_caption")), ..Default::default() };+ description.key = t+ .analysis+ .draft+ .into_iter()+ .zip(["≥ 1.0°", "−1.0° … 1.0°", "≤ −1.0°"])+ .enumerate()+ .map(|(index, (colour, label))| DetailKey {+ numeric: true,+ pattern_colour: None,+ colour: crate::theme::srgb(colour),+ pattern: index == 2,+ label: label.into(),+ value: String::new(),+ })+ .collect();+ if id != "details" {+ return description;+ }+ description.settings = vec![+ DetailSetting {+ id: "axis".into(),+ label: tr("ui.details_pull"),+ value: DetailValue::Axis { value: [0.0, 0.0, 1.0], current: "Z".into() },+ enabled: true,+ },+ DetailSetting { id: "angle".into(), label: tr("ui.details_angle"), value: DetailValue::Angle(1.0), enabled: true },+ DetailSetting {+ id: "slider".into(),+ label: tr("ui.details_stripes"),+ value: DetailValue::Slider { value: 14.5, min: 1.0, max: 200.0 },+ enabled: true,+ },+ DetailSetting { id: "check".into(), label: tr("ui.details_hatch"), value: DetailValue::Check(true), enabled: true },+ ];+ if readout {+ description.readout = (0..9).map(|index| (tr("ui.details_fixture_readout"), format!("{index}.00 mm"))).collect();+ } else {+ description.findings_title = tr("ui.details_fixture");+ description.findings = (0..9)+ .map(|index| DetailFinding {+ id: format!("specimen_{index}"),+ label: tr("ui.details_fixture_problem"),+ value: format!("{index}.00 mm"),+ warning: true,+ target: true,+ })+ .collect();+ }+ description.actions.push(("copy".into(), tr("ui.details_copy_list")));+ description+}+/// Presets are bounded, named specimens rather than arbitrary user-provided widget state.pub(crate) fn control(app: &mut crate::SolveApp, params: &Value) -> Result<Value, String> {let preset = params.get("preset").and_then(Value::as_str).ok_or("missing `preset`")?;@@ -36,9 +94,11 @@ pub(crate) fn control(app: &mut crate::SolveApp, params: &Value) -> Result<Value"kinds" => vec![zebra(), result(), attention()],"many" => vec![zebra(), section(), result(), attention()],"key" => vec![item("draft", StatusKind::Mode, "ui.draft", "Z · 1°".into(), true)],- _ => return Err("preset must be off, mode, result, attention, row, kinds, many or key".into()),+ "details_findings" | "details_readout" => vec![item("details", StatusKind::Result, "ui.details_fixture", String::new(), true)],+ _ => return Err("unknown viewport status component specimen preset".into()),};app.viewport_status_fixture.items = items;+ app.viewport_status_fixture.details_readout = preset == "details_readout";Ok(json!({"preset": preset, "count": app.viewport_status_fixture.items.len()}))}@@ -65,24 +125,10 @@ pub(crate) fn show(app: &mut crate::SolveApp, ctx: &egui::Context, viewport: egureturn;}let fixture = &mut app.viewport_status_fixture;- let key_contents = |ui: &mut egui::Ui, _: &str| {- let t = crate::theme::Tokens::get();- ui.label(crate::i18n::tr("cmd.inspect_draft"));- ui.label(egui::RichText::new(format!("{} (0.00, 0.00, 1.00)", crate::i18n::tr("ui.pull_direction"))).monospace().color(t.text_dim));- for (index, (colour, label)) in t.analysis.draft.into_iter().zip(["≥ 1.0°", "−1.0° … 1.0°", "≤ −1.0°"]).enumerate() {- ui.horizontal(|ui| {- let (rect, _) = ui.allocate_exact_size(egui::vec2(t.space_12, t.space_12), egui::Sense::hover());- ui.painter().rect_filled(rect, t.radius_sm, crate::theme::srgb(colour));- if index == 2 && t.analysis.hatch {- let painter = ui.painter().with_clip_rect(rect);- for offset in [-t.space_8, -t.space_4, 0.0, t.space_4, t.space_8] {- let from = rect.left_bottom() + egui::vec2(offset, 0.0);- painter.line_segment([from, from + egui::vec2(rect.height(), -rect.height())], ui.visuals().selection.stroke);- }- }- ui.label(label);- });- }+ let readout = fixture.details_readout;+ let key_contents = |ui: &mut egui::Ui, id: &str| {+ let description = specimen(id, readout);+ crate::ui_kit::details(ui, id, &description, free.height() * 0.6, None);};// Deliberately use the oldest specimen as newest to exercise chronology/slot divergence.// This is explicit specimen metadata, never an engine activation claim.diff --git a/crates/ui-egui/tests/scenarios/viewport_status_item.json b/crates/ui-egui/tests/scenarios/viewport_status_item.jsonindex 0c61856121..ef37d7c647 100644--- a/crates/ui-egui/tests/scenarios/viewport_status_item.json+++ b/crates/ui-egui/tests/scenarios/viewport_status_item.json@@ -376,5 +376,281 @@{"frames": 3},{"click": {"handle": "menu:viewport_status_clear_all"}},{"frames": 3},- {"call": "ui.status_fixture","params": {"preset": "off"}}+ {"call": "ui.status_fixture","params": {"preset": "off"}},+ {"note":"Details component specimens are labelled illustrative data; real Draft, Zebra and Section states use their normal engine commands."},+ {"call":"ui.status_fixture","params":{"preset":"off"}},+ {"call":"ui.prefs","params":{"viewport_status_details":true}},+ {"call":"engine.execute","params":{"command":"solid.box","params":{"height":20,"length":30,"width":20}}},+ {"call":"ui.prefs","params":{"color_vision":"off","theme":"light"}},+ {"call":"ui.status_fixture","params":{"preset":"details_findings"}},+ {"frames":4},+ {"click":{"handle":"viewport_status:details:key"}},+ {"frames":4},+ {"expect":{"count":{"name":"details:findings_visible","value":6}}},+ {"shot":"viewport-status-details_findings-light-off"},+ {"click":{"handle":"viewport_status:details:close"}},+ {"call":"ui.status_fixture","params":{"preset":"details_readout"}},+ {"frames":4},+ {"click":{"handle":"viewport_status:details:key"}},+ {"frames":4},+ {"expect":{"count":{"name":"details:readout_visible","value":6}}},+ {"shot":"viewport-status-details_readout-light-off"},+ {"click":{"handle":"viewport_status:details:close"}},+ {"call":"ui.status_fixture","params":{"preset":"off"}},+ {"call":"engine.execute","params":{"command":"inspect.draft","params":{"angle":1,"pull":[0,0,1]}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.draft:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-draft-light-off"},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.draft:close"}},+ {"call":"engine.execute","params":{"command":"inspect.zebra","params":{"stripes":14.5}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.zebra:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-zebra-light-off"},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.zebra:close"}},+ {"call":"engine.execute","params":{"command":"inspect.section","params":{"hatch":true,"plane":"XY","offset":"20 mm"}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:Section:inspect.section:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-section-light-off"},+ {"click":{"handle":"viewport_status:Section:inspect.section:close"}},+ {"call":"ui.prefs","params":{"color_vision":"protan","theme":"light"}},+ {"call":"ui.status_fixture","params":{"preset":"details_findings"}},+ {"frames":4},+ {"click":{"handle":"viewport_status:details:key"}},+ {"frames":4},+ {"expect":{"count":{"name":"details:findings_visible","value":6}}},+ {"shot":"viewport-status-details_findings-light-protan"},+ {"click":{"handle":"viewport_status:details:close"}},+ {"call":"ui.status_fixture","params":{"preset":"details_readout"}},+ {"frames":4},+ {"click":{"handle":"viewport_status:details:key"}},+ {"frames":4},+ {"expect":{"count":{"name":"details:readout_visible","value":6}}},+ {"shot":"viewport-status-details_readout-light-protan"},+ {"click":{"handle":"viewport_status:details:close"}},+ {"call":"ui.status_fixture","params":{"preset":"off"}},+ {"call":"engine.execute","params":{"command":"inspect.draft","params":{"angle":1,"pull":[0,0,1]}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.draft:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-draft-light-protan"},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.draft:close"}},+ {"call":"engine.execute","params":{"command":"inspect.zebra","params":{"stripes":14.5}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.zebra:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-zebra-light-protan"},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.zebra:close"}},+ {"call":"engine.execute","params":{"command":"inspect.section","params":{"hatch":true,"plane":"XY","offset":"20 mm"}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:Section:inspect.section:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-section-light-protan"},+ {"click":{"handle":"viewport_status:Section:inspect.section:close"}},+ {"call":"ui.prefs","params":{"color_vision":"deutan","theme":"light"}},+ {"call":"ui.status_fixture","params":{"preset":"details_findings"}},+ {"frames":4},+ {"click":{"handle":"viewport_status:details:key"}},+ {"frames":4},+ {"expect":{"count":{"name":"details:findings_visible","value":6}}},+ {"shot":"viewport-status-details_findings-light-deutan"},+ {"click":{"handle":"viewport_status:details:close"}},+ {"call":"ui.status_fixture","params":{"preset":"details_readout"}},+ {"frames":4},+ {"click":{"handle":"viewport_status:details:key"}},+ {"frames":4},+ {"expect":{"count":{"name":"details:readout_visible","value":6}}},+ {"shot":"viewport-status-details_readout-light-deutan"},+ {"click":{"handle":"viewport_status:details:close"}},+ {"call":"ui.status_fixture","params":{"preset":"off"}},+ {"call":"engine.execute","params":{"command":"inspect.draft","params":{"angle":1,"pull":[0,0,1]}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.draft:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-draft-light-deutan"},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.draft:close"}},+ {"call":"engine.execute","params":{"command":"inspect.zebra","params":{"stripes":14.5}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.zebra:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-zebra-light-deutan"},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.zebra:close"}},+ {"call":"engine.execute","params":{"command":"inspect.section","params":{"hatch":true,"plane":"XY","offset":"20 mm"}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:Section:inspect.section:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-section-light-deutan"},+ {"click":{"handle":"viewport_status:Section:inspect.section:close"}},+ {"call":"ui.prefs","params":{"color_vision":"tritan","theme":"light"}},+ {"call":"ui.status_fixture","params":{"preset":"details_findings"}},+ {"frames":4},+ {"click":{"handle":"viewport_status:details:key"}},+ {"frames":4},+ {"expect":{"count":{"name":"details:findings_visible","value":6}}},+ {"shot":"viewport-status-details_findings-light-tritan"},+ {"click":{"handle":"viewport_status:details:close"}},+ {"call":"ui.status_fixture","params":{"preset":"details_readout"}},+ {"frames":4},+ {"click":{"handle":"viewport_status:details:key"}},+ {"frames":4},+ {"expect":{"count":{"name":"details:readout_visible","value":6}}},+ {"shot":"viewport-status-details_readout-light-tritan"},+ {"click":{"handle":"viewport_status:details:close"}},+ {"call":"ui.status_fixture","params":{"preset":"off"}},+ {"call":"engine.execute","params":{"command":"inspect.draft","params":{"angle":1,"pull":[0,0,1]}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.draft:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-draft-light-tritan"},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.draft:close"}},+ {"call":"engine.execute","params":{"command":"inspect.zebra","params":{"stripes":14.5}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.zebra:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-zebra-light-tritan"},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.zebra:close"}},+ {"call":"engine.execute","params":{"command":"inspect.section","params":{"hatch":true,"plane":"XY","offset":"20 mm"}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:Section:inspect.section:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-section-light-tritan"},+ {"click":{"handle":"viewport_status:Section:inspect.section:close"}},+ {"call":"ui.prefs","params":{"color_vision":"off","theme":"dark"}},+ {"call":"ui.status_fixture","params":{"preset":"details_findings"}},+ {"frames":4},+ {"click":{"handle":"viewport_status:details:key"}},+ {"frames":4},+ {"expect":{"count":{"name":"details:findings_visible","value":6}}},+ {"shot":"viewport-status-details_findings-dark-off"},+ {"click":{"handle":"viewport_status:details:close"}},+ {"call":"ui.status_fixture","params":{"preset":"details_readout"}},+ {"frames":4},+ {"click":{"handle":"viewport_status:details:key"}},+ {"frames":4},+ {"expect":{"count":{"name":"details:readout_visible","value":6}}},+ {"shot":"viewport-status-details_readout-dark-off"},+ {"click":{"handle":"viewport_status:details:close"}},+ {"call":"ui.status_fixture","params":{"preset":"off"}},+ {"call":"engine.execute","params":{"command":"inspect.draft","params":{"angle":1,"pull":[0,0,1]}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.draft:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-draft-dark-off"},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.draft:close"}},+ {"call":"engine.execute","params":{"command":"inspect.zebra","params":{"stripes":14.5}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.zebra:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-zebra-dark-off"},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.zebra:close"}},+ {"call":"engine.execute","params":{"command":"inspect.section","params":{"hatch":true,"plane":"XY","offset":"20 mm"}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:Section:inspect.section:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-section-dark-off"},+ {"click":{"handle":"viewport_status:Section:inspect.section:close"}},+ {"call":"ui.prefs","params":{"color_vision":"protan","theme":"dark"}},+ {"call":"ui.status_fixture","params":{"preset":"details_findings"}},+ {"frames":4},+ {"click":{"handle":"viewport_status:details:key"}},+ {"frames":4},+ {"expect":{"count":{"name":"details:findings_visible","value":6}}},+ {"shot":"viewport-status-details_findings-dark-protan"},+ {"click":{"handle":"viewport_status:details:close"}},+ {"call":"ui.status_fixture","params":{"preset":"details_readout"}},+ {"frames":4},+ {"click":{"handle":"viewport_status:details:key"}},+ {"frames":4},+ {"expect":{"count":{"name":"details:readout_visible","value":6}}},+ {"shot":"viewport-status-details_readout-dark-protan"},+ {"click":{"handle":"viewport_status:details:close"}},+ {"call":"ui.status_fixture","params":{"preset":"off"}},+ {"call":"engine.execute","params":{"command":"inspect.draft","params":{"angle":1,"pull":[0,0,1]}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.draft:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-draft-dark-protan"},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.draft:close"}},+ {"call":"engine.execute","params":{"command":"inspect.zebra","params":{"stripes":14.5}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.zebra:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-zebra-dark-protan"},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.zebra:close"}},+ {"call":"engine.execute","params":{"command":"inspect.section","params":{"hatch":true,"plane":"XY","offset":"20 mm"}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:Section:inspect.section:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-section-dark-protan"},+ {"click":{"handle":"viewport_status:Section:inspect.section:close"}},+ {"call":"ui.prefs","params":{"color_vision":"deutan","theme":"dark"}},+ {"call":"ui.status_fixture","params":{"preset":"details_findings"}},+ {"frames":4},+ {"click":{"handle":"viewport_status:details:key"}},+ {"frames":4},+ {"expect":{"count":{"name":"details:findings_visible","value":6}}},+ {"shot":"viewport-status-details_findings-dark-deutan"},+ {"click":{"handle":"viewport_status:details:close"}},+ {"call":"ui.status_fixture","params":{"preset":"details_readout"}},+ {"frames":4},+ {"click":{"handle":"viewport_status:details:key"}},+ {"frames":4},+ {"expect":{"count":{"name":"details:readout_visible","value":6}}},+ {"shot":"viewport-status-details_readout-dark-deutan"},+ {"click":{"handle":"viewport_status:details:close"}},+ {"call":"ui.status_fixture","params":{"preset":"off"}},+ {"call":"engine.execute","params":{"command":"inspect.draft","params":{"angle":1,"pull":[0,0,1]}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.draft:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-draft-dark-deutan"},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.draft:close"}},+ {"call":"engine.execute","params":{"command":"inspect.zebra","params":{"stripes":14.5}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.zebra:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-zebra-dark-deutan"},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.zebra:close"}},+ {"call":"engine.execute","params":{"command":"inspect.section","params":{"hatch":true,"plane":"XY","offset":"20 mm"}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:Section:inspect.section:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-section-dark-deutan"},+ {"click":{"handle":"viewport_status:Section:inspect.section:close"}},+ {"call":"ui.prefs","params":{"color_vision":"tritan","theme":"dark"}},+ {"call":"ui.status_fixture","params":{"preset":"details_findings"}},+ {"frames":4},+ {"click":{"handle":"viewport_status:details:key"}},+ {"frames":4},+ {"expect":{"count":{"name":"details:findings_visible","value":6}}},+ {"shot":"viewport-status-details_findings-dark-tritan"},+ {"click":{"handle":"viewport_status:details:close"}},+ {"call":"ui.status_fixture","params":{"preset":"details_readout"}},+ {"frames":4},+ {"click":{"handle":"viewport_status:details:key"}},+ {"frames":4},+ {"expect":{"count":{"name":"details:readout_visible","value":6}}},+ {"shot":"viewport-status-details_readout-dark-tritan"},+ {"click":{"handle":"viewport_status:details:close"}},+ {"call":"ui.status_fixture","params":{"preset":"off"}},+ {"call":"engine.execute","params":{"command":"inspect.draft","params":{"angle":1,"pull":[0,0,1]}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.draft:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-draft-dark-tritan"},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.draft:close"}},+ {"call":"engine.execute","params":{"command":"inspect.zebra","params":{"stripes":14.5}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.zebra:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-zebra-dark-tritan"},+ {"click":{"handle":"viewport_status:SurfaceAnalysis:inspect.zebra:close"}},+ {"call":"engine.execute","params":{"command":"inspect.section","params":{"hatch":true,"plane":"XY","offset":"20 mm"}}},+ {"frames":4},+ {"click":{"handle":"viewport_status:Section:inspect.section:key"}},+ {"frames":4},+ {"shot":"viewport-status-real-inspect-section-dark-tritan"},+ {"click":{"handle":"viewport_status:Section:inspect.section:close"}}]diff --git a/docs/control-protocol.md b/docs/control-protocol.mdindex b5d560ae05..434afbedb5 100644--- a/docs/control-protocol.md+++ b/docs/control-protocol.md@@ -17,6 +17,13 @@ as `toast:<name>:close`: `toast:status:close`, `toast:space_mouse_offer:close` a`toast:stand_up:close` (#7971). Those that go by themselves draw a thin ring around it thatshrinks over their time; the ring is full again while the pointer is on a toast that waits for it.+Live details publish `details:field:<id>`, `details:show_all` and `details:action:copy`+handles. `details_findings` and `details_readout` are explicitly labelled component-only+`ui.status_fixture` presets. Real card settings execute the normal analysis/Section commands;+agents can read the same structured settings and retained Continuity records with the pure+`view.status_details` engine command. Its `current` flag guards geometry targets, and its+per-record limits prevent mixed measurements from being mistaken for one global tolerance.+The control channel is **on by default**. SolidCraft listens on `127.0.0.1` only, for JSON lines,so agents can drive the app without a launch flag. Every connection still needs this launch'stoken (below); nothing else on the machine, and nothing off it, can send a command.diff --git a/docs/ui-kit.md b/docs/ui-kit.mdindex 1a20f971b8..c2601dcd77 100644--- a/docs/ui-kit.md+++ b/docs/ui-kit.md@@ -4,9 +4,25 @@`Surface::ViewportStatus`. Callers supply translated names, formatted settings,kind, stable identity and key availability, and dispatch returned clear/edit actions.The row keeps supplied order and anchors to the top centre of the free viewport.-Its presentation state only remembers which key card is open. The `ui.status_fixture`+Its presentation state remembers only open cards, focus, scroll and the selected diagnostic+record, scoped to the current document. The `ui.status_fixture`control method provides named specimens for UI scenarios and live visual review.+`details` renders a `Details` description in the shared host: optional caption, live settings,+key, findings or readout, then at most two text actions. Tools supply data and handle+`DetailEvent` requests through their normal commands. The caption and actions stay fixed+around a body bounded to 60% of the free viewport height. Findings/readouts preview six rows;+Show all expands the same scrolling body. `patterned_swatch` supports an optional second+semantic colour, so a grouped key can honestly represent both existing scene colours.++`viewport_status_details` defaults to live cards. Its false value restores read-only keys+and the Section dialog independently of the analysis/Section HUD and Summary preferences.+Continuity edits explicitly select one retained body/edge record; its own successful limits+and sample count accompany every live command. Stale geometry disables editing and targets.+`view.status_details` reads current effect settings/capabilities and the retained per-seam+diagnostics without preparing or evaluating geometry. `details_findings` and+`details_readout` fixture presets are labelled component specimens, not production results.+| Component | Use || --- | --- || `method_section` | Section with a GPU/CPU tag; unsupported contents stay faded with a readable reason. |