Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

Floating browser card and history strip (step 3 of #2016, rebased onto step 2)

Nathan Dane845edeba5f99
diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md
index a9a38d33d1..4b936d05ed 100644
--- a/ATTRIBUTION.md
+++ b/ATTRIBUTION.md
@@ -138,6 +138,8 @@ Editable drawing code, native projects and shipped exports are collected under `
| assets/icons/ui/design/svg/flat/bug_report.svg | SolidCraft contributors | single-colour application/navigation icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
| assets/icons/ui/design/svg/flat/chevron.svg | SolidCraft contributors | single-colour application/navigation icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
| assets/icons/ui/design/svg/flat/close.svg | SolidCraft contributors | single-colour application/navigation icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
+| assets/icons/ui/design/svg/flat/disclosure_closed.svg | SolidCraft contributors | single-colour application/navigation icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
+| assets/icons/ui/design/svg/flat/disclosure_open.svg | SolidCraft contributors | single-colour application/navigation icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
| assets/icons/ui/design/svg/flat/fit.svg | SolidCraft contributors | single-colour application/navigation icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
| assets/icons/ui/design/svg/flat/folder.svg | SolidCraft contributors | single-colour application/navigation icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
| assets/icons/ui/design/svg/flat/help.svg | SolidCraft contributors | single-colour application/navigation icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
@@ -232,7 +234,7 @@ Editable drawing code, native projects and shipped exports are collected under `
| assets/icons/ui/design/svg/model/export.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
| assets/icons/ui/design/svg/model/extend.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
| assets/icons/ui/design/svg/model/extrude.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
-| assets/icons/ui/design/svg/model/eye.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
+| assets/icons/ui/design/svg/flat/eye.svg | SolidCraft contributors | single-colour application/navigation icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
| assets/icons/ui/design/svg/model/fastener.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
| assets/icons/ui/design/svg/model/fillet.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
| assets/icons/ui/design/svg/model/filter.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
@@ -336,7 +338,7 @@ Editable drawing code, native projects and shipped exports are collected under `
| assets/icons/ui/design/svg/model/status_error.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
| assets/icons/ui/design/svg/model/status_warning.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
| assets/icons/ui/design/svg/model/stitch.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
-| assets/icons/ui/design/svg/model/suppress.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
+| assets/icons/ui/design/svg/flat/suppress.svg | SolidCraft contributors | single-colour application/navigation icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
| assets/icons/ui/design/svg/model/surface.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
| assets/icons/ui/design/svg/model/svg.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
| assets/icons/ui/design/svg/model/sweep.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
diff --git a/assets/icons/ui/design/review.json b/assets/icons/ui/design/review.json
index d3583be579..784b14c3a6 100644
--- a/assets/icons/ui/design/review.json
+++ b/assets/icons/ui/design/review.json
@@ -99,7 +99,6 @@
"export": "c8c2abf007e43e896479d78798e3976ba9eda809507c820bb38538f77db696ac",
"extend": "28c63df352c77d02feffe44cf09fb0fc1d48f7905aaabbfa6dba601dbb70f8e8",
"extrude": "9cc1538971c5d25467aaed23f739899d9d102fd07f86472ac3197c54ca2e1144",
- "eye": "5d90a25f5d07e6e36a2a8faf5e2ed1425b2a787834ab2291b1b1c521057ec1c2",
"fastener": "fcff4e4be50907f712e527b373771afafd92e50096fc7a4b8aba5d86448e1e42",
"fillet": "11ec232dc111597211e3a4fe61b69616b5d28b4b1b2732052ddcd486cdfc6129",
"filter": "4d456a56416089574bd3732fa44c0c1b27fd2478b369448808a27f0144d15d8a",
@@ -251,7 +250,6 @@
"status_warning": "1ac4f0ccfac2c01f6f66cb42188f9ae053c4aef9c5bbd249f1fb09611eb4d825",
"stitch": "6c3205d64007b771ed78d6f8055867578439fb25d591563b32dbd3343c98732d",
"style": "6c2b04234b82ea4858c80190cc7208c60f549358253005afc35ab4e29506b578",
- "suppress": "6c033a6672a3b6ca926e3d7a75a758c9db7e1144210cd360be043a9fdf999ede",
"surface": "ba0e839ce0ee03e7ff95a2389a5ecb20bd80c713064d9b1bd5f461f4a80d1921",
"surface_blend": "0642f3b4af7d22f379a3c74f54c7b1c9eef0bdda19372ce4df73c0e56bdd7bbc",
"surface_boundary": "fb8501bae192e2416118cc2e88f544e0e29197f6720bccc541c967ca0848d8d3",
diff --git a/assets/icons/ui/design/svg/flat/disclosure_closed.svg b/assets/icons/ui/design/svg/flat/disclosure_closed.svg
new file mode 100644
index 0000000000..33f723348a
--- /dev/null
+++ b/assets/icons/ui/design/svg/flat/disclosure_closed.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
+ <title>Disclosure closed</title>
+ <path d="M24 17L46 32L24 47Z" fill="currentColor" stroke="currentColor" stroke-width="6" stroke-linejoin="round" stroke-linecap="round"/>
+</svg>
diff --git a/assets/icons/ui/design/svg/flat/disclosure_open.svg b/assets/icons/ui/design/svg/flat/disclosure_open.svg
new file mode 100644
index 0000000000..ce48c1db7f
--- /dev/null
+++ b/assets/icons/ui/design/svg/flat/disclosure_open.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
+ <title>Disclosure open</title>
+ <path d="M17 24L47 24L32 46Z" fill="currentColor" stroke="currentColor" stroke-width="6" stroke-linejoin="round" stroke-linecap="round"/>
+</svg>
diff --git a/assets/icons/ui/design/svg/flat/eye.svg b/assets/icons/ui/design/svg/flat/eye.svg
new file mode 100644
index 0000000000..4f6920ad49
--- /dev/null
+++ b/assets/icons/ui/design/svg/flat/eye.svg
@@ -0,0 +1,5 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
+ <title>Eye</title>
+ <path d="M6 32C16 18 48 18 58 32C48 46 16 46 6 32Z" fill="none" stroke="currentColor" stroke-width="5" stroke-linejoin="round" stroke-linecap="round"/>
+ <path d="M24 32A8 8 0 1 0 40 32A8 8 0 1 0 24 32Z" fill="currentColor"/>
+</svg>
diff --git a/assets/icons/ui/design/svg/flat/suppress.svg b/assets/icons/ui/design/svg/flat/suppress.svg
new file mode 100644
index 0000000000..3a7b168577
--- /dev/null
+++ b/assets/icons/ui/design/svg/flat/suppress.svg
@@ -0,0 +1,12 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
+ <title>Suppress</title>
+ <defs>
+ <mask id="suppress-slash" maskUnits="userSpaceOnUse" x="-32" y="-32" width="128" height="128">
+ <path d="M-32 -32L96 -32L96 96L-32 96Z" fill="white"/>
+ <path d="M13 51L51 13" fill="none" stroke="black" stroke-width="13" stroke-linejoin="round" stroke-linecap="round"/>
+ </mask>
+ </defs>
+ <path d="M6 32C16 18 48 18 58 32C48 46 16 46 6 32Z" fill="none" stroke="currentColor" stroke-width="5" stroke-linejoin="round" stroke-linecap="round" mask="url(#suppress-slash)"/>
+ <path d="M24 32A8 8 0 1 0 40 32A8 8 0 1 0 24 32Z" fill="currentColor" mask="url(#suppress-slash)"/>
+ <path d="M13 51L51 13" fill="none" stroke="currentColor" stroke-width="5" stroke-linejoin="round" stroke-linecap="round"/>
+</svg>
diff --git a/assets/icons/ui/design/svg/model/eye.svg b/assets/icons/ui/design/svg/model/eye.svg
deleted file mode 100644
index a7cc82f280..0000000000
--- a/assets/icons/ui/design/svg/model/eye.svg
+++ /dev/null
@@ -1,8 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
- <title>Eye</title>
- <path d="M4 32C16 14 48 14 60 32C48 50 16 50 4 32Z" fill="#e2e8ef"/>
- <path d="M4 32C16 14 48 14 60 32C48 50 16 50 4 32Z" fill="none" stroke="#34465b" stroke-width="2.55" stroke-linejoin="round" stroke-linecap="round"/>
- <path d="M22 32A10 10 0 1 0 42 32A10 10 0 1 0 22 32Z" fill="#328bd3"/>
- <path d="M22 32A10 10 0 1 0 42 32A10 10 0 1 0 22 32Z" fill="none" stroke="#34465b" stroke-width="2.55" stroke-linejoin="round" stroke-linecap="round"/>
- <circle cx="32" cy="32" r="4" fill="#34465b"/>
-</svg>
diff --git a/assets/icons/ui/design/svg/model/suppress.svg b/assets/icons/ui/design/svg/model/suppress.svg
deleted file mode 100644
index 9d369a54c6..0000000000
--- a/assets/icons/ui/design/svg/model/suppress.svg
+++ /dev/null
@@ -1,8 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
- <title>Suppress</title>
- <path d="M4 32C16 14 48 14 60 32C48 50 16 50 4 32Z" fill="#e2e8ef"/>
- <path d="M4 32C16 14 48 14 60 32C48 50 16 50 4 32Z" fill="none" stroke="#6f879c" stroke-width="2.55" stroke-linejoin="round" stroke-linecap="round"/>
- <path d="M23 32A9 9 0 1 0 41 32A9 9 0 1 0 23 32Z" fill="#b8c3cf"/>
- <path d="M23 32A9 9 0 1 0 41 32A9 9 0 1 0 23 32Z" fill="none" stroke="#6f879c" stroke-width="2.55" stroke-linejoin="round" stroke-linecap="round"/>
- <path d="M10 54L54 10" fill="none" stroke="#34465b" stroke-width="4.25" stroke-linejoin="round" stroke-linecap="round"/>
-</svg>
diff --git a/assets/locales/cs.json b/assets/locales/cs.json
index 786444d524..a90c4b2f24 100644
--- a/assets/locales/cs.json
+++ b/assets/locales/cs.json
@@ -1028,6 +1028,11 @@
"ui.bodies": "Tělesa",
"ui.box": "Kvádr",
"ui.break": "Přerušit",
+ "ui.browser_bodies_one": "{count} těleso",
+ "ui.browser_bodies_other": "{count} těles",
+ "ui.browser_collapse": "Sbalit prohlížeč",
+ "ui.browser_expand": "Rozbalit prohlížeč",
+ "ui.browser_title": "Prohlížeč",
"ui.calibrate": "Kalibrovat",
"ui.cancel": "Zrušit",
"ui.canvases": "Plátna",
@@ -1068,7 +1073,6 @@
"ui.combine": "Kombinovat",
"ui.coming_later": "připravujeme",
"ui.command_done": "{command} hotovo",
- "ui.command_palette_hint": "Zadejte příkaz, např. {example} — nebo stiskněte S pro hledání",
"ui.concentric": "Soustřednost",
"ui.configurations": "Konfigurace",
"ui.conic_curve": "Kuželosečka",
@@ -1240,6 +1244,7 @@
"ui.hideOrigin": "Skrýt počátek",
"ui.hidePlanes": "Skrýt roviny",
"ui.hideProfile": "Skrýt profil",
+ "ui.history_title": "Historie",
"ui.hole": "Otvor",
"ui.hole_tap_type": "Typ závitu otvoru",
"ui.hole_type": "Typ otvoru",
diff --git a/assets/locales/de.json b/assets/locales/de.json
index a440878745..0a5d325322 100644
--- a/assets/locales/de.json
+++ b/assets/locales/de.json
@@ -819,6 +819,11 @@
"ui.bodies_all_if_none": "Körper (alle, wenn keine)",
"ui.box": "Block",
"ui.break": "Unterbrechen",
+ "ui.browser_bodies_one": "{count} Körper",
+ "ui.browser_bodies_other": "{count} Körper",
+ "ui.browser_collapse": "Browser einklappen",
+ "ui.browser_expand": "Browser ausklappen",
+ "ui.browser_title": "Browser",
"ui.calibrate": "Kalibrieren",
"ui.cancel": "Abbrechen",
"ui.canvases": "Kanvas",
@@ -856,7 +861,6 @@
"ui.combine": "Kombinieren",
"ui.coming_later": "bald verfügbar",
"ui.command_done": "{command} fertig",
- "ui.command_palette_hint": "Befehl eingeben, z. B. {example} — oder S drücken, um zu suchen",
"ui.concentric": "Konzentrisch",
"ui.configurations": "Konfigurationen",
"ui.conic_curve": "Kegelschnitt",
@@ -1029,6 +1033,7 @@
"ui.hideOrigin": "Ursprung ausblenden",
"ui.hidePlanes": "Ebenen ausblenden",
"ui.hideProfile": "Profil ausblenden",
+ "ui.history_title": "Verlauf",
"ui.hole": "Bohrung",
"ui.hole_tap_type": "Gewindetyp",
"ui.hole_type": "Bohrungstyp",
diff --git a/assets/locales/en.json b/assets/locales/en.json
index c04b52ad38..932f107ed2 100644
--- a/assets/locales/en.json
+++ b/assets/locales/en.json
@@ -1160,6 +1160,11 @@
"ui.bodies_all_if_none": "Bodies (all if none)",
"ui.box": "Box",
"ui.break": "Break",
+ "ui.browser_bodies_one": "{count} body",
+ "ui.browser_bodies_other": "{count} bodies",
+ "ui.browser_collapse": "Collapse the browser",
+ "ui.browser_expand": "Expand the browser",
+ "ui.browser_title": "Browser",
"ui.calibrate": "Calibrate",
"ui.cancel": "Cancel",
"ui.canvases": "Canvases",
@@ -1200,7 +1205,6 @@
"ui.combine": "Combine",
"ui.coming_later": "coming later",
"ui.command_done": "{command} done",
- "ui.command_palette_hint": "Type a command, e.g. {example} — or press S to search",
"ui.concentric": "Concentric",
"ui.configurations": "Configurations",
"ui.conic_curve": "Conic Curve",
@@ -1383,6 +1387,7 @@
"ui.hideOrigin": "Hide Origin",
"ui.hidePlanes": "Hide Planes",
"ui.hideProfile": "Hide Profile",
+ "ui.history_title": "History",
"ui.hole": "Hole",
"ui.hole_tap_type": "Hole Tap Type",
"ui.hole_type": "Hole Type",
diff --git a/assets/locales/es.json b/assets/locales/es.json
index bfe8938f9e..a98c609dc2 100644
--- a/assets/locales/es.json
+++ b/assets/locales/es.json
@@ -1047,6 +1047,11 @@
"ui.bodies": "Cuerpos",
"ui.box": "Caja",
"ui.break": "Romper",
+ "ui.browser_bodies_one": "{count} cuerpo",
+ "ui.browser_bodies_other": "{count} cuerpos",
+ "ui.browser_collapse": "Contraer el navegador",
+ "ui.browser_expand": "Expandir el navegador",
+ "ui.browser_title": "Navegador",
"ui.calibrate": "Calibrar",
"ui.cancel": "Cancelar",
"ui.canvases": "Lienzos",
@@ -1087,7 +1092,6 @@
"ui.combine": "Combinar",
"ui.coming_later": "próximamente",
"ui.command_done": "{command} completado",
- "ui.command_palette_hint": "Escribe un comando, p. ej., {example}, o pulsa S para buscar",
"ui.concentric": "Concéntrico",
"ui.configurations": "Configuraciones",
"ui.conic_curve": "Curva cónica",
@@ -1264,6 +1268,7 @@
"ui.hideOrigin": "Ocultar origen",
"ui.hidePlanes": "Ocultar planos",
"ui.hideProfile": "Ocultar perfil",
+ "ui.history_title": "Historial",
"ui.hole": "Agujero",
"ui.hole_tap_type": "Tipo de roscado del agujero",
"ui.hole_type": "Tipo de agujero",
diff --git a/assets/locales/fr.json b/assets/locales/fr.json
index 9387ef3f9f..2c748ac630 100644
--- a/assets/locales/fr.json
+++ b/assets/locales/fr.json
@@ -1098,6 +1098,11 @@
"ui.bodies_all_if_none": "Corps (tous si aucun)",
"ui.box": "Boîte",
"ui.break": "Fractionner",
+ "ui.browser_bodies_one": "{count} corps",
+ "ui.browser_bodies_other": "{count} corps",
+ "ui.browser_collapse": "Réduire le navigateur",
+ "ui.browser_expand": "Développer le navigateur",
+ "ui.browser_title": "Navigateur",
"ui.calibrate": "Étalonner",
"ui.cancel": "Annuler",
"ui.canvases": "Canevas",
@@ -1138,7 +1143,6 @@
"ui.combine": "Combiner",
"ui.coming_later": "bientôt disponible",
"ui.command_done": "{command} terminé",
- "ui.command_palette_hint": "Tapez une commande, ex. {example} — ou S pour chercher",
"ui.concentric": "Concentricité",
"ui.configurations": "Configurations",
"ui.conic_curve": "Courbe conique",
@@ -1321,6 +1325,7 @@
"ui.hideOrigin": "Masquer l'origine",
"ui.hidePlanes": "Masquer les plans",
"ui.hideProfile": "Masquer le profil",
+ "ui.history_title": "Historique",
"ui.hole": "Perçage",
"ui.hole_tap_type": "Type de taraudage",
"ui.hole_type": "Type de perçage",
diff --git a/assets/locales/gl.json b/assets/locales/gl.json
index fd4ec7c6bc..1f5e26f3b6 100644
--- a/assets/locales/gl.json
+++ b/assets/locales/gl.json
@@ -1019,6 +1019,11 @@
"ui.bodies": "Corpos",
"ui.box": "Caixa",
"ui.break": "Romper",
+ "ui.browser_bodies_one": "{count} corpo",
+ "ui.browser_bodies_other": "{count} corpos",
+ "ui.browser_collapse": "Contraer o navegador",
+ "ui.browser_expand": "Expandir o navegador",
+ "ui.browser_title": "Navegador",
"ui.calibrate": "Calibrar",
"ui.cancel": "Cancelar",
"ui.canvases": "Lenzos",
@@ -1059,7 +1064,6 @@
"ui.combine": "Combinar",
"ui.coming_later": "máis adiante",
"ui.command_done": "{command} feito",
- "ui.command_palette_hint": "Escribe unha orde, p. ex. {example} — ou preme S para buscar",
"ui.concentric": "Concéntrica",
"ui.configurations": "Configuracións",
"ui.conic_curve": "Curva cónica",
@@ -1231,6 +1235,7 @@
"ui.hideOrigin": "Ocultar a orixe",
"ui.hidePlanes": "Ocultar os planos",
"ui.hideProfile": "Ocultar o perfil",
+ "ui.history_title": "Historial",
"ui.hole": "Furado",
"ui.hole_tap_type": "Tipo de roscado do furado",
"ui.hole_type": "Tipo de furado",
diff --git a/assets/locales/it.json b/assets/locales/it.json
index b2e7bfd7e7..62cbd03b16 100644
--- a/assets/locales/it.json
+++ b/assets/locales/it.json
@@ -1030,6 +1030,11 @@
"ui.bodies": "Corpi",
"ui.box": "Parallelepipedo",
"ui.break": "Spezza",
+ "ui.browser_bodies_one": "{count} corpo",
+ "ui.browser_bodies_other": "{count} corpi",
+ "ui.browser_collapse": "Comprimi la struttura",
+ "ui.browser_expand": "Espandi la struttura",
+ "ui.browser_title": "Struttura",
"ui.calibrate": "Calibra",
"ui.cancel": "Annulla",
"ui.canvases": "Immagini di riferimento",
@@ -1070,7 +1075,6 @@
"ui.combine": "Combina",
"ui.coming_later": "in arrivo",
"ui.command_done": "{command} completato",
- "ui.command_palette_hint": "Digita un comando, ad es. {example} — oppure premi S per cercare",
"ui.concentric": "Concentrico",
"ui.configurations": "Configurazioni",
"ui.conic_curve": "Curva conica",
@@ -1247,6 +1251,7 @@
"ui.hideOrigin": "Nascondi origine",
"ui.hidePlanes": "Nascondi piani",
"ui.hideProfile": "Nascondi profilo",
+ "ui.history_title": "Cronologia",
"ui.hole": "Foro",
"ui.hole_tap_type": "Tipo di maschiatura del foro",
"ui.hole_type": "Tipo di foro",
diff --git a/assets/locales/ja.json b/assets/locales/ja.json
index 14bcd45b07..feec1edefd 100644
--- a/assets/locales/ja.json
+++ b/assets/locales/ja.json
@@ -1160,6 +1160,11 @@
"ui.bodies_all_if_none": "ボディ(未選択ならすべて)",
"ui.box": "直方体",
"ui.break": "分割",
+ "ui.browser_bodies_one": "{count} ボディ",
+ "ui.browser_bodies_other": "{count} ボディ",
+ "ui.browser_collapse": "ブラウザを折りたたむ",
+ "ui.browser_expand": "ブラウザを展開",
+ "ui.browser_title": "ブラウザ",
"ui.calibrate": "校正",
"ui.cancel": "キャンセル",
"ui.canvases": "キャンバス",
@@ -1200,7 +1205,6 @@
"ui.combine": "結合",
"ui.coming_later": "準備中",
"ui.command_done": "{command} 完了",
- "ui.command_palette_hint": "コマンドを入力(例: {example})— または S キーで検索",
"ui.concentric": "同心",
"ui.configurations": "構成",
"ui.conic_curve": "円錐曲線",
@@ -1383,6 +1387,7 @@
"ui.hideOrigin": "原点を非表示",
"ui.hidePlanes": "平面を非表示",
"ui.hideProfile": "プロファイルを非表示",
+ "ui.history_title": "履歴",
"ui.hole": "穴",
"ui.hole_tap_type": "ねじ穴タイプ",
"ui.hole_type": "穴タイプ",
diff --git a/assets/locales/ko.json b/assets/locales/ko.json
index 6bcb068c03..a4f225dc32 100644
--- a/assets/locales/ko.json
+++ b/assets/locales/ko.json
@@ -819,6 +819,11 @@
"ui.bodies_all_if_none": "바디 (없으면 전체)",
"ui.box": "박스",
"ui.break": "끊기",
+ "ui.browser_bodies_one": "{count}개 바디",
+ "ui.browser_bodies_other": "{count}개 바디",
+ "ui.browser_collapse": "브라우저 접기",
+ "ui.browser_expand": "브라우저 펼치기",
+ "ui.browser_title": "브라우저",
"ui.calibrate": "캘리브레이션",
"ui.cancel": "취소",
"ui.canvases": "캔버스",
@@ -856,7 +861,6 @@
"ui.combine": "결합",
"ui.coming_later": "추후 지원 예정",
"ui.command_done": "{command} 완료",
- "ui.command_palette_hint": "명령 입력(예: {example}) — 또는 S 키를 눌러 검색",
"ui.concentric": "동심",
"ui.configurations": "구성",
"ui.conic_curve": "원뿔 곡선",
@@ -1029,6 +1033,7 @@
"ui.hideOrigin": "원점 숨기기",
"ui.hidePlanes": "평면 숨기기",
"ui.hideProfile": "윤곽 숨기기",
+ "ui.history_title": "기록",
"ui.hole": "구멍",
"ui.hole_tap_type": "탭 유형",
"ui.hole_type": "구멍 유형",
diff --git a/assets/locales/ms.json b/assets/locales/ms.json
index 11765f89a6..1767deb878 100644
--- a/assets/locales/ms.json
+++ b/assets/locales/ms.json
@@ -1015,6 +1015,11 @@
"ui.bodies": "Jasad",
"ui.box": "Kotak",
"ui.break": "Putuskan",
+ "ui.browser_bodies_one": "{count} jasad",
+ "ui.browser_bodies_other": "{count} jasad",
+ "ui.browser_collapse": "Runtuhkan pelayar",
+ "ui.browser_expand": "Kembangkan pelayar",
+ "ui.browser_title": "Pelayar",
"ui.calibrate": "Tentukur",
"ui.cancel": "Batal",
"ui.canvases": "Kanvas",
@@ -1055,7 +1060,6 @@
"ui.combine": "Gabung",
"ui.coming_later": "akan datang",
"ui.command_done": "{command} selesai",
- "ui.command_palette_hint": "Taip arahan, cth. {example} — atau tekan S untuk mencari",
"ui.concentric": "Sepusat",
"ui.configurations": "Konfigurasi",
"ui.conic_curve": "Lengkung Kon",
@@ -1232,6 +1236,7 @@
"ui.hideOrigin": "Sembunyi Titik Asal",
"ui.hidePlanes": "Sembunyi Satah",
"ui.hideProfile": "Sembunyi Profil",
+ "ui.history_title": "Sejarah",
"ui.hole": "Lubang",
"ui.hole_tap_type": "Jenis Bebenang Lubang",
"ui.hole_type": "Jenis Lubang",
diff --git a/assets/locales/pl.json b/assets/locales/pl.json
index 8507e9f071..a42500712b 100644
--- a/assets/locales/pl.json
+++ b/assets/locales/pl.json
@@ -1018,6 +1018,11 @@
"ui.bodies": "Bryły",
"ui.box": "Prostopadłościan",
"ui.break": "Podziel",
+ "ui.browser_bodies_one": "{count} bryła",
+ "ui.browser_bodies_other": "{count} brył",
+ "ui.browser_collapse": "Zwiń przeglądarkę",
+ "ui.browser_expand": "Rozwiń przeglądarkę",
+ "ui.browser_title": "Przeglądarka",
"ui.calibrate": "Kalibruj",
"ui.cancel": "Anuluj",
"ui.canvases": "Płótna",
@@ -1058,7 +1063,6 @@
"ui.combine": "Kombinacja",
"ui.coming_later": "wkrótce",
"ui.command_done": "Wykonano: {command}",
- "ui.command_palette_hint": "Wpisz polecenie, np. {example} — lub naciśnij S, aby wyszukać",
"ui.concentric": "Współśrodkowość",
"ui.configurations": "Konfiguracje",
"ui.conic_curve": "Krzywa stożkowa",
@@ -1235,6 +1239,7 @@
"ui.hideOrigin": "Ukryj początek układu",
"ui.hidePlanes": "Ukryj płaszczyzny",
"ui.hideProfile": "Ukryj profil",
+ "ui.history_title": "Historia",
"ui.hole": "Otwór",
"ui.hole_tap_type": "Typ gwintu otworu",
"ui.hole_type": "Typ otworu",
diff --git a/assets/locales/pt-BR.json b/assets/locales/pt-BR.json
index 4ad1c0a484..4dae07958f 100644
--- a/assets/locales/pt-BR.json
+++ b/assets/locales/pt-BR.json
@@ -1002,6 +1002,11 @@
"ui.bodies": "Corpos",
"ui.box": "Caixa",
"ui.break": "Quebrar",
+ "ui.browser_bodies_one": "{count} corpo",
+ "ui.browser_bodies_other": "{count} corpos",
+ "ui.browser_collapse": "Recolher o navegador",
+ "ui.browser_expand": "Expandir o navegador",
+ "ui.browser_title": "Navegador",
"ui.calibrate": "Calibrar",
"ui.cancel": "Cancelar",
"ui.canvases": "Telas de referência",
@@ -1042,7 +1047,6 @@
"ui.combine": "Combinar",
"ui.coming_later": "em breve",
"ui.command_done": "{command} concluído",
- "ui.command_palette_hint": "Digite um comando, p. ex. {example} — ou pressione S para pesquisar",
"ui.concentric": "Concêntrico",
"ui.configurations": "Configurações",
"ui.conic_curve": "Curva cônica",
@@ -1214,6 +1218,7 @@
"ui.hideOrigin": "Ocultar origem",
"ui.hidePlanes": "Ocultar planos",
"ui.hideProfile": "Ocultar perfil",
+ "ui.history_title": "Histórico",
"ui.hole": "Furo",
"ui.hole_tap_type": "Tipo de rosca do furo",
"ui.hole_type": "Tipo de furo",
diff --git a/assets/locales/ru.json b/assets/locales/ru.json
index 73cf196674..9e94cd002a 100644
--- a/assets/locales/ru.json
+++ b/assets/locales/ru.json
@@ -811,6 +811,11 @@
"ui.bodies": "Тела",
"ui.box": "Бокс",
"ui.break": "Разорвать",
+ "ui.browser_bodies_one": "{count} тело",
+ "ui.browser_bodies_other": "{count} тел",
+ "ui.browser_collapse": "Свернуть браузер",
+ "ui.browser_expand": "Развернуть браузер",
+ "ui.browser_title": "Браузер",
"ui.calibrate": "Калибровать",
"ui.cancel": "Отмена",
"ui.canvases": "Подложки",
@@ -851,7 +856,6 @@
"ui.combine": "Объединение",
"ui.coming_later": "появится позже",
"ui.command_done": "{command} — готово",
- "ui.command_palette_hint": "Введите команду, напр. {example} — или нажмите S для поиска",
"ui.concentric": "Концентричность",
"ui.configurations": "Конфигурации",
"ui.conic_curve": "Коническая кривая",
@@ -1022,6 +1026,7 @@
"ui.hideOrigin": "Скрыть начало координат",
"ui.hidePlanes": "Скрыть плоскости",
"ui.hideProfile": "Скрыть профиль",
+ "ui.history_title": "История",
"ui.hole": "Отверстие",
"ui.hole_tap_type": "Тип резьбы отверстия",
"ui.hole_type": "Тип отверстия",
diff --git a/assets/locales/tr.json b/assets/locales/tr.json
index 907022a7c9..2747eef9ed 100644
--- a/assets/locales/tr.json
+++ b/assets/locales/tr.json
@@ -949,6 +949,11 @@
"ui.bodies": "Gövdeler",
"ui.box": "Kutu",
"ui.break": "Kır",
+ "ui.browser_bodies_one": "{count} gövde",
+ "ui.browser_bodies_other": "{count} gövde",
+ "ui.browser_collapse": "Tarayıcıyı daralt",
+ "ui.browser_expand": "Tarayıcıyı genişlet",
+ "ui.browser_title": "Tarayıcı",
"ui.calibrate": "Kalibre et",
"ui.cancel": "İptal",
"ui.canvases": "Tuvaller",
@@ -989,7 +994,6 @@
"ui.combine": "Birleştir",
"ui.coming_later": "yakında",
"ui.command_done": "{command} tamamlandı",
- "ui.command_palette_hint": "Bir komut yazın (ör. {example}) — veya aramak için S tuşuna basın",
"ui.concentric": "Eş merkezli",
"ui.configurations": "Konfigürasyonlar",
"ui.conic_curve": "Konik eğri",
@@ -1160,6 +1164,7 @@
"ui.hideOrigin": "Orijini gizle",
"ui.hidePlanes": "Düzlemleri gizle",
"ui.hideProfile": "Profili gizle",
+ "ui.history_title": "Geçmiş",
"ui.hole": "Delik",
"ui.hole_tap_type": "Diş türü",
"ui.hole_type": "Delik türü",
diff --git a/assets/locales/uk.json b/assets/locales/uk.json
index 05a8972d2d..6d7571acdd 100644
--- a/assets/locales/uk.json
+++ b/assets/locales/uk.json
@@ -1098,6 +1098,11 @@
"ui.bodies_all_if_none": "Тіла (усі, якщо не вибрано)",
"ui.box": "Куб",
"ui.break": "Розірвати",
+ "ui.browser_bodies_one": "{count} тіло",
+ "ui.browser_bodies_other": "{count} тіл",
+ "ui.browser_collapse": "Згорнути браузер",
+ "ui.browser_expand": "Розгорнути браузер",
+ "ui.browser_title": "Браузер",
"ui.calibrate": "Калібрувати",
"ui.cancel": "Скасувати",
"ui.canvases": "Полотна",
@@ -1138,7 +1143,6 @@
"ui.combine": "Об'єднати",
"ui.coming_later": "з'явиться пізніше",
"ui.command_done": "{command} виконано",
- "ui.command_palette_hint": "Введіть команду, напр. {example} — або натисніть S для пошуку",
"ui.concentric": "Концентричність",
"ui.configurations": "Конфігурації",
"ui.conic_curve": "Конічна крива",
@@ -1321,6 +1325,7 @@
"ui.hideOrigin": "Приховати початок координат",
"ui.hidePlanes": "Приховати площини",
"ui.hideProfile": "Приховати профіль",
+ "ui.history_title": "Історія",
"ui.hole": "Отвір",
"ui.hole_tap_type": "Тип різьби отвору",
"ui.hole_type": "Тип отвору",
diff --git a/assets/locales/zh.json b/assets/locales/zh.json
index 219f035915..7033e195ae 100644
--- a/assets/locales/zh.json
+++ b/assets/locales/zh.json
@@ -1160,6 +1160,11 @@
"ui.bodies_all_if_none": "实体(未选择则全部)",
"ui.box": "长方体",
"ui.break": "打断",
+ "ui.browser_bodies_one": "{count} 个实体",
+ "ui.browser_bodies_other": "{count} 个实体",
+ "ui.browser_collapse": "折叠浏览器",
+ "ui.browser_expand": "展开浏览器",
+ "ui.browser_title": "浏览器",
"ui.calibrate": "校准",
"ui.cancel": "取消",
"ui.canvases": "画布",
@@ -1200,7 +1205,6 @@
"ui.combine": "组合",
"ui.coming_later": "即将推出",
"ui.command_done": "{command} 完成",
- "ui.command_palette_hint": "输入命令,例如 {example} — 或按 S 搜索",
"ui.concentric": "同心",
"ui.configurations": "配置",
"ui.conic_curve": "圆锥曲线",
@@ -1383,6 +1387,7 @@
"ui.hideOrigin": "隐藏原点",
"ui.hidePlanes": "隐藏平面",
"ui.hideProfile": "隐藏轮廓",
+ "ui.history_title": "历史",
"ui.hole": "孔",
"ui.hole_tap_type": "孔攻丝类型",
"ui.hole_type": "孔类型",
diff --git a/crates/ui-egui/src/browser.rs b/crates/ui-egui/src/browser.rs
index 50b54e0536..d895670271 100644
--- a/crates/ui-egui/src/browser.rs
+++ b/crates/ui-egui/src/browser.rs
@@ -59,6 +59,8 @@ pub fn drawn_occurrences() -> Vec<(Vec<u64>, String, Rect, bool)> {
/// Browser state kept between frames.
#[derive(Default)]
pub struct TreeState {
+ /// The floating browser card is folded to its header.
+ pub panel_collapsed: bool,
/// Geometry and assembly queries, independent of the camera, selection and row visibility.
model: Option<model::Model>,
/// Folders closed by the user (keys like `c0/bodies`).
@@ -274,7 +276,11 @@ pub fn group_action(app: &mut SolveApp, action: &str, p: &Value) {
// Drawing
// ---------------------------------------------------------------------------------------------
-const ROW_H: f32 = 22.0;
+const ROW_H: f32 = 26.0;
+/// The floating card's inner margin: the header highlight sits this far from the card's top, left
+/// and right edges, so its corners are concentric with the card's.
+const CARD_INSET: f32 = 4.0;
+const HEADER_H: f32 = 26.0;
const INDENT: f32 = 14.0;
/// Opacity of a dimmed row's icon (a hidden body, sketch, origin item, …).
const DIM_ICON_OPACITY: f32 = 0.4;
@@ -388,8 +394,8 @@ pub(crate) fn draw_row(ui: &mut egui::Ui, id: egui::Id, row: &Row) -> RowResp {
// Fold arrow.
if let Some(open) = row.fold {
let ar = Rect::from_center_size(pos2(x + 6.0, cy), vec2(12.0, 12.0));
- let ink = if hover_on == 1 { t.text } else { t.text_dim };
- crate::icons::glyphs::disclosure(ui.painter(), ar, open, ink);
+ let strength = if hover_on == 1 { 1.0 } else { 0.7 };
+ icons::paint_icon(ui.painter(), ar, if open { "disclosure_open" } else { "disclosure_closed" }, strength);
out.fold = resp.clicked() && click_on == 1;
crate::scenario::publish_handle(&format!("fold:{}", row.label), fold_r.center());
}
@@ -397,11 +403,8 @@ pub(crate) fn draw_row(ui: &mut egui::Ui, id: egui::Id, row: &Row) -> RowResp {
// Eye.
if let Some(vis) = row.eye {
let er = Rect::from_center_size(pos2(x + 8.0, cy), vec2(15.0, 15.0));
- // A closed eye, or the eye of a faded row, draws faint like the row's icon.
- icons::paint_icon(ui.painter(), er, "eye", if vis && !row.dim { 1.0 } else { DIM_ICON_OPACITY });
- if !vis {
- ui.painter().line_segment([er.left_bottom() + vec2(2.0, -2.0), er.right_top() + vec2(-2.0, 2.0)], Stroke::new(1.4, t.text_dim));
- }
+ // Hidden or faded rows keep main's dimming, with the rounded suppression asset.
+ icons::paint_icon(ui.painter(), er, if vis { "eye" } else { "suppress" }, if vis && !row.dim { 0.85 } else { DIM_ICON_OPACITY });
out.eye = resp.clicked() && click_on == 2;
crate::scenario::publish_handle(&format!("eye:{}", row.label), er.center());
}
@@ -423,7 +426,8 @@ pub(crate) fn draw_row(ui: &mut egui::Ui, id: egui::Id, row: &Row) -> RowResp {
icons::paint_icon(ui.painter(), ir, row.icon, if row.dim { DIM_ICON_OPACITY } else { 1.0 });
x += 21.0;
}
- let col = row.color.unwrap_or(if row.dim { t.text_dim } else { t.text });
+ let col =
+ if row.selected { crate::theme::TabAccent::current(ui.ctx()).color } else { row.color.unwrap_or(if row.dim { t.text_dim } else { t.text }) };
let label_display = if row.name { crate::i18n::tr_name(row.label) } else { crate::i18n::tr_dyn(row.label) };
let galley = ui.painter().layout_no_wrap(label_display, FontId::proportional(t.font_label), col);
let lw = galley.size().x;
@@ -669,8 +673,7 @@ fn browser_panel(app: &mut SolveApp, ui: &mut egui::Ui, timeline_above: bool) {
DRAWN.with(|d| d.borrow_mut().clear());
OCCURRENCES.with(|d| d.borrow_mut().clear());
let mut acts = Actions::default();
- let remembered = app.preferences.browser_width;
- let width = if remembered.is_finite() { remembered.clamp(MIN_BROWSER_WIDTH, MAX_BROWSER_WIDTH) } else { crate::prefs::DEFAULT_BROWSER_WIDTH };
+ let width = browser_width(app);
let panel = egui::Panel::left("sc_browser")
.exact_size(width)
.resizable(false)
@@ -712,64 +715,125 @@ fn browser_panel(app: &mut SolveApp, ui: &mut egui::Ui, timeline_above: bool) {
browser_rows(app, ui, &mut acts);
}
} else {
- browser_contents(app, ui, &mut acts);
+ browser_contents(app, ui, &mut acts, false);
}
});
- // The sidebar's right edge is a drag handle; the width it is dragged to is remembered.
- let rect = panel.response.rect;
- let rail = egui::Rect::from_x_y_ranges(rect.right() - BROWSER_RAIL..=rect.right(), rect.y_range());
- let response = ui.interact(rail, egui::Id::new("sc_browser_rail"), egui::Sense::drag()).on_hover_cursor(egui::CursorIcon::ResizeHorizontal);
+ resize_browser(app, ui, panel.response.rect, width);
+ finish_browser(app, ui, acts);
+}
+
+fn browser_width(app: &SolveApp) -> f32 {
+ let remembered = app.preferences.browser_width;
+ if remembered.is_finite() { remembered.clamp(MIN_BROWSER_WIDTH, MAX_BROWSER_WIDTH) } else { crate::prefs::DEFAULT_BROWSER_WIDTH }
+}
+
+fn resize_browser(app: &mut SolveApp, ui: &egui::Ui, rect: Rect, width: f32) {
+ let rail = Rect::from_x_y_ranges(rect.right() - BROWSER_RAIL..=rect.right(), rect.y_range());
+ let response = ui.interact(rail, egui::Id::new("sc_browser_rail"), Sense::drag()).on_hover_cursor(egui::CursorIcon::ResizeHorizontal);
if response.dragged() {
let delta = ui.input(|input| input.pointer.delta().x);
if delta.is_finite() {
app.preferences.browser_width = (width + delta).clamp(MIN_BROWSER_WIDTH, MAX_BROWSER_WIDTH);
}
}
- crate::scenario::publish_handle("left-browser-rail", egui::pos2(rect.right() - BROWSER_RAIL / 2.0, rect.center().y));
- finish_browser(app, ui, acts);
+ crate::scenario::publish_handle("left-browser-rail", pos2(rect.right() - BROWSER_RAIL / 2.0, rect.center().y));
}
-/// The tree on a translucent card over the workspace, instead of a column that takes width from
-/// it (Preferences: "Float it over the workspace"). The card occupies the content below the
-/// ribbon in either shell layout, leaving the viewport projection unchanged.
-pub fn floating(app: &mut SolveApp, ui: &mut egui::Ui, viewport: egui::Rect) {
+/// One browser card for the floating shell and the docked shell's optional overlay.
+/// The preference keeps its translucent overlay semantics; the floating shell always has a card.
+pub fn floating(app: &mut SolveApp, ui: &mut egui::Ui, available: Rect) {
let t = Tokens::get();
app.tree.order.clear();
DRAWN.with(|d| d.borrow_mut().clear());
OCCURRENCES.with(|d| d.borrow_mut().clear());
let mut acts = Actions::default();
- let remembered = app.preferences.browser_width;
- let width = if remembered.is_finite() { remembered.clamp(MIN_BROWSER_WIDTH, MAX_BROWSER_WIDTH) } else { crate::prefs::DEFAULT_BROWSER_WIDTH };
- // Tall enough for the tree, short enough to leave the view room; the rows scroll inside.
- let height = (viewport.height() * 0.7).clamp(160.0, 560.0);
- let card = crate::frame::area(egui::Id::new("sc_browser_float")).fixed_pos(viewport.min + vec2(8.0, 8.0)).order(egui::Order::Middle).show(
- ui.ctx(),
- |ui| {
- egui::Frame::new()
- .fill(t.panel.gamma_multiply(BROWSER_FLOAT_ALPHA))
- .stroke(egui::Stroke::new(1.0, t.border))
- .corner_radius(6)
- .inner_margin(egui::Margin::symmetric(8, 6))
- .show(ui, |ui| {
- ui.set_width(width - 16.0);
- ui.set_max_height(height);
- ui.label(RichText::new(crate::i18n::tr_label("BROWSER")).size(11.0).strong().color(t.text_dim));
- ui.add_space(4.0);
- // The card hugs the tree, so it hides as little of the view as it can.
- browser_rows_hugging(app, ui, &mut acts);
- });
- },
- );
- app.shell.browser = Some(card.response.rect);
- crate::scenario::publish_rect("browser:float", card.response.rect);
+ let gap = crate::shell::SHELL_GAP;
+ let top_gap = if app.ui.layout == crate::shell::LayoutMode::Docked { gap } else { 0.0 };
+ let min = available.min + vec2(gap, top_gap);
+ let right = (available.right() - gap).max(min.x);
+ let bottom = app.shell.history.map_or(available.bottom() - gap, |r| r.top() - gap).max(min.y);
+ let width = browser_width(app);
+ let bounds = Rect::from_min_max(min, pos2((min.x + width).min(right), bottom));
+ app.shell.browser = None;
+ let min_height = HEADER_H + 2.0 * (CARD_INSET + 1.0);
+ if bounds.is_positive() && bounds.height() >= min_height {
+ let fill = if app.preferences.browser_float { t.panel.gamma_multiply(BROWSER_FLOAT_ALPHA) } else { t.panel };
+ let frame = crate::frame::shell_card(fill).inner_margin(CARD_INSET as i8);
+ let inner_width = (bounds.width() - frame.total_margin().sum().x).max(0.0);
+ let inner_height = (bounds.height() - frame.total_margin().sum().y).max(0.0);
+ let card = crate::frame::area(egui::Id::new("sc_browser_card")).fixed_pos(bounds.min).order(egui::Order::Middle).show(ui.ctx(), |ui| {
+ let response = frame.show(ui, |ui| {
+ ui.set_width(inner_width);
+ ui.set_max_height(inner_height);
+ browser_contents(app, ui, &mut acts, true);
+ });
+ resize_browser(app, ui, response.response.rect, width);
+ });
+ let rect = card.response.rect;
+ app.shell.browser = Some(rect);
+ crate::scenario::publish_rect("browser:card", rect);
+ // Preserve the overlay handle used by main's automation.
+ if app.preferences.browser_float {
+ crate::scenario::publish_rect("browser:float", rect);
+ }
+ }
finish_browser(app, ui, acts);
}
-fn browser_contents(app: &mut SolveApp, ui: &mut egui::Ui, acts: &mut Actions) {
+fn browser_contents(app: &mut SolveApp, ui: &mut egui::Ui, acts: &mut Actions, collapsible: bool) {
let t = Tokens::get();
- ui.label(RichText::new(crate::i18n::tr_label("BROWSER")).size(t.font_small).strong().color(t.text_dim));
- ui.add_space(t.space_4);
- browser_rows(app, ui, acts);
+ // Only the floating card folds; the docked column keeps its full height.
+ browser_header(app, ui, collapsible);
+ if collapsible && app.tree.panel_collapsed {
+ return;
+ }
+ ui.painter().hline(ui.max_rect().x_range(), ui.cursor().top() + 1.0, egui::Stroke::new(1.0, t.toolbar.lerp_to_gamma(t.border, 0.5)));
+ ui.add_space(t.space_3);
+ if collapsible {
+ browser_rows_hugging(app, ui, acts);
+ } else {
+ browser_rows(app, ui, acts);
+ }
+}
+
+/// The header: the title, the body count and (on the floating card) a chevron that folds the
+/// card to just this row. The whole row is the button.
+fn browser_header(app: &mut SolveApp, ui: &mut egui::Ui, collapsible: bool) {
+ let t = Tokens::get();
+ let (rect, _) = ui.allocate_exact_size(vec2(ui.available_width(), HEADER_H), Sense::hover());
+ let response = ui.interact(rect, ui.id().with("browser_header"), if collapsible { Sense::click() } else { Sense::hover() });
+ crate::scenario::publish_handle("browser:header", rect.center());
+ crate::scenario::publish_rect("browser:header", rect);
+ let collapsed = collapsible && app.tree.panel_collapsed;
+ if collapsible && (response.hovered() || response.has_focus()) {
+ ui.painter().rect_filled(rect, t.radius_lg.saturating_sub(CARD_INSET as u8), t.hover);
+ }
+ let title = crate::i18n::tr("ui.browser_title").to_string();
+ let kind = if collapsible { egui::WidgetType::Button } else { egui::WidgetType::Label };
+ response.widget_info(|| egui::WidgetInfo::labeled(kind, true, &title));
+ let galley = ui.painter().layout_no_wrap(title, FontId::proportional(t.font_heading), t.text);
+ ui.painter().galley(pos2(rect.left() + t.space_6, rect.center().y - galley.size().y / 2.0), galley, t.text);
+ let mut right = rect.right() - t.space_6;
+ if collapsible {
+ let chevron = Rect::from_center_size(pos2(right - 5.0, rect.center().y), vec2(12.0, 12.0));
+ if collapsed {
+ crate::icons::paint_ink(ui.painter(), chevron, "chevron", t.text_dim);
+ } else {
+ crate::icons::paint_ink_flipped(ui.painter(), chevron, "chevron", t.text_dim);
+ }
+ right -= 18.0;
+ }
+ let bodies = app.session.model.state().bodies.len();
+ let key = if bodies == 1 { "ui.browser_bodies_one" } else { "ui.browser_bodies_other" };
+ let count = crate::i18n::format(key, &[("count", &bodies.to_string())]);
+ let galley = ui.painter().layout_no_wrap(count, FontId::proportional(t.font_body), t.text_dim);
+ ui.painter().galley(pos2(right - galley.size().x, rect.center().y - galley.size().y / 2.0), galley, t.text_dim);
+ if collapsible {
+ let tip = crate::i18n::tr(if collapsed { "ui.browser_expand" } else { "ui.browser_collapse" });
+ if response.on_hover_text(tip).clicked() {
+ app.tree.panel_collapsed = !app.tree.panel_collapsed;
+ }
+ }
}
fn prepare_model(app: &mut SolveApp) {
@@ -2372,3 +2436,7 @@ pub(crate) fn body_rows(app: &SolveApp) -> Vec<String> {
#[cfg(test)]
#[path = "section_browser_tests.rs"]
mod section_browser_tests;
+
+#[cfg(test)]
+#[path = "browser_card_tests.rs"]
+mod card_tests;
diff --git a/crates/ui-egui/src/browser_card_tests.rs b/crates/ui-egui/src/browser_card_tests.rs
new file mode 100644
index 0000000000..6f3308687a
--- /dev/null
+++ b/crates/ui-egui/src/browser_card_tests.rs
@@ -0,0 +1,169 @@
+use super::*;
+use crate::scenario::{Harness, handle_at, rect_of};
+use crate::shell::{LayoutMode, SHELL_GAP};
+
+#[test]
+fn browser_card_shrinks_and_scrolls_without_covering_history() {
+ let mut h = Harness::new();
+ h.call("ui.resize", json!({"width":1400,"height":900}));
+ h.settle();
+ let short = rect_of("browser:card").unwrap();
+ let history = rect_of("history:card").unwrap();
+ assert_eq!(short.left(), SHELL_GAP);
+ assert_eq!(short.width(), 250.0);
+ assert_eq!(short.top(), rect_of("ribbon:card").unwrap().bottom() + SHELL_GAP);
+ assert!(short.bottom() < history.top() - SHELL_GAP);
+ assert!(drawn_rows().iter().all(|(_, rect, _, _)| rect.height() == 26.0));
+
+ for i in 0..35 {
+ h.app.run("sketch.create", json!({"plane":"XY", "name":format!("Sketch{i}")})).unwrap();
+ h.app.run("sketch.finish", json!({})).unwrap();
+ }
+ h.settle();
+ let tall = rect_of("browser:card").unwrap();
+ assert!(tall.height() > short.height());
+ assert!((tall.bottom() - (history.top() - SHELL_GAP)).abs() < 1.0, "{tall:?} {history:?}");
+ assert!(h.app.viewport.rect.unwrap().contains_rect(tall));
+ assert!(handle_at("row:Sketch34").is_none(), "last row starts below the scroll clip");
+ let camera = h.app.cam;
+ h.call("ui.scroll", json!({"x":tall.center().x,"y":tall.center().y,"delta":-1800}));
+ h.settle();
+ assert!(handle_at("row:Sketch34").is_some(), "scrolling must reveal the last row");
+ assert_eq!(h.app.cam, camera);
+ assert_eq!(rect_of("browser:card").unwrap(), tall);
+
+ h.call("ui.set", json!({"layout":"docked"}));
+ h.settle();
+ assert!(rect_of("browser:card").is_none());
+ assert_eq!(h.app.viewport.rect.unwrap().left(), 250.0);
+ assert!(drawn_rows().iter().all(|(_, rect, _, _)| rect.height() == 26.0));
+ h.call("ui.set", json!({"layout":"floating"}));
+ h.app.tree.collapsed.insert("c0".into());
+ h.settle();
+ assert!(rect_of("browser:card").unwrap().height() < short.height());
+}
+
+#[test]
+fn selected_row_paints_tab_soft_fill_and_accent_text_in_both_layouts() {
+ for mode in [LayoutMode::Floating, LayoutMode::Docked] {
+ for tab in ["MODEL", "SURFACE", "SKETCH"] {
+ let ctx = egui::Context::default();
+ let mut app = SolveApp::new(Default::default(), Default::default());
+ app.ui.layout = mode;
+ app.ui.tab = tab.into();
+ crate::theme::TabAccent::publish(&app, &ctx);
+ let accent = crate::theme::TabAccent::for_tab(&Tokens::get(), tab);
+ let mut row_rect = Rect::NOTHING;
+ let mut out = ctx.run_ui(egui::RawInput::default(), |ui| {
+ let row = Row { selected: true, label: "Selected body", dim: true, color: Some(Tokens::get().error), ..Default::default() };
+ row_rect = draw_row(ui, egui::Id::new("selected-row"), &row).rect.unwrap();
+ });
+ out.textures_delta.clear();
+ assert_eq!(row_rect.height(), 26.0);
+ assert!(out.shapes.iter().any(|s| matches!(&s.shape, egui::Shape::Rect(r) if r.rect == row_rect && r.fill == accent.soft)));
+ assert!(
+ out.shapes
+ .iter()
+ .any(|s| matches!(&s.shape, egui::Shape::Text(t) if t.galley.text() == "Selected body" && t.fallback_color == accent.color))
+ );
+ }
+ }
+}
+
+#[test]
+fn card_and_column_keep_body_eyes_menus_and_group_drops() {
+ for mode in [LayoutMode::Floating, LayoutMode::Docked] {
+ let mut h = Harness::new();
+ h.app.ui.layout = mode;
+ for (name, x) in [("One", 0), ("Two", 20)] {
+ h.app.run("solid.box", json!({"length":10,"width":10,"height":10,"corner":[x,0,0],"operation":"new_body","body_name":name})).unwrap();
+ }
+ let group =
+ h.app.run("browser.group", json!({"component":0,"folder":"bodies","items":["One"],"name":"Group"})).unwrap()["group"].as_u64().unwrap();
+ h.settle();
+ h.step(&json!({"click":{"handle":"eye:Two"}})).unwrap();
+ assert!(h.app.session.visibility.hidden_bodies.iter().any(|name| name == "Two"));
+ h.step(&json!({"click":{"handle":"eye:Two"}})).unwrap();
+ assert!(!h.app.session.visibility.hidden_bodies.iter().any(|name| name == "Two"));
+ h.step(&json!({"click":{"handle":"row:Two"},"button":"right"})).unwrap();
+ assert!(matches!(&h.app.menu.target, crate::context_menu::Target::Body { name } if name == "Two"));
+ h.step(&json!({"key":"Escape"})).unwrap();
+ h.step(&json!({"drag":[{"handle":"row:Two"},{"handle":"row:Group (1)"}]})).unwrap();
+ h.settle();
+ let group = h.app.session.doc.browser_groups.iter().find(|g| g.id == group).unwrap();
+ assert!(group.items.iter().any(|name| name == "Two"), "body drop into the folder failed in {mode:?}");
+ }
+}
+
+#[test]
+fn browser_header_folds_the_floating_card_to_its_header_and_back() {
+ let mut h = Harness::new();
+ h.call("ui.resize", json!({"width":1400,"height":900}));
+ h.settle();
+ let open = rect_of("browser:card").unwrap();
+ assert!(!h.app.tree.panel_collapsed);
+ let at = handle_at("browser:header").unwrap();
+ h.call("ui.click", json!({"x":at.x,"y":at.y}));
+ h.settle();
+ let folded = rect_of("browser:card").unwrap();
+ assert!(h.app.tree.panel_collapsed);
+ assert!(folded.height() < 60.0 && folded.height() < open.height(), "{folded:?} {open:?}");
+ assert_eq!(folded.top(), open.top());
+ assert!(drawn_rows().is_empty() || handle_at("row:Plate").is_none());
+ h.call("ui.click", json!({"x":at.x,"y":at.y}));
+ h.settle();
+ assert!(!h.app.tree.panel_collapsed);
+ assert!((rect_of("browser:card").unwrap().height() - open.height()).abs() < 1.0);
+}
+
+/// Tiny or odd window sizes never panic: the cards leave out what cannot fit.
+#[test]
+fn tiny_floating_windows_never_panic() {
+ for (w, h) in [(100, 60), (240, 90), (320, 140), (700, 150), (700, 300), (1400, 120), (180, 800)] {
+ for scale in [1.0, 2.0] {
+ let mut harness = Harness::new();
+ harness.call("ui.resize", json!({"width": w, "height": h}));
+ harness.call("ui.prefs", json!({"ui_scale": scale}));
+ harness.app.run("sketch.create", json!({"plane": "XY"})).unwrap();
+ harness.settle();
+ for mode in [LayoutMode::Floating, LayoutMode::Docked] {
+ harness.app.ui.layout = mode;
+ harness.settle();
+ }
+ }
+ }
+}
+
+/// Both shell layouts share one tree and one saved width. Docked can switch its card
+/// back into a column; Floating keeps its card when the overlay preference is cleared.
+#[test]
+fn one_browser_keeps_its_resized_width_across_layouts_and_overlay_preferences() {
+ let mut h = Harness::new();
+ h.call("ui.resize", json!({"width":1400,"height":900}));
+ for mode in [LayoutMode::Floating, LayoutMode::Docked] {
+ for overlay in [false, true] {
+ h.app.ui.layout = mode;
+ h.app.preferences.browser_float = overlay;
+ h.app.preferences.browser_width = 310.0;
+ h.settle();
+ let card = mode == LayoutMode::Floating || overlay;
+ assert_eq!(rect_of("browser:card").is_some(), card);
+ assert_eq!(crate::scenario::handles("browser:header").len(), 1, "only one browser header");
+ assert_eq!(drawn_rows().iter().filter(|(name, ..)| name == "Untitled").count(), 1, "only one tree");
+ if card {
+ assert!((rect_of("browser:card").unwrap().width() - 310.0).abs() < 1.0);
+ } else {
+ assert_eq!(h.app.viewport.rect.unwrap().left(), 310.0);
+ }
+ let rail = handle_at("left-browser-rail").unwrap();
+ h.call("ui.drag", json!({"x0":rail.x,"y0":rail.y,"x1":rail.x+60.0,"y1":rail.y,"steps":6}));
+ h.settle();
+ let width = h.app.preferences.browser_width;
+ assert!(width > 340.0 && width <= MAX_BROWSER_WIDTH, "{mode:?}, overlay={overlay}: {width}");
+ h.app.ui.layout = LayoutMode::Docked;
+ h.app.preferences.browser_float = false;
+ h.settle();
+ assert!((h.app.viewport.rect.unwrap().left() - width).abs() < 1.0, "the column uses the card's saved width");
+ }
+ }
+}
diff --git a/crates/ui-egui/src/dialogs_sheet.rs b/crates/ui-egui/src/dialogs_sheet.rs
index 0de88ad6b2..d3eb6cedcd 100644
--- a/crates/ui-egui/src/dialogs_sheet.rs
+++ b/crates/ui-egui/src/dialogs_sheet.rs
@@ -873,7 +873,8 @@ pub fn overlay(app: &mut SolveApp, painter: &egui::Painter, rect: Rect, d: &Dial
.memory(|m| m.area_rect(egui::Id::new(("sc_dialog", "FLAT PATTERN"))))
.map(|panel| panel.left())
.unwrap_or(rect.right() - crate::frame::DIALOG_MAX_W);
- let area = Rect::from_min_max(rect.min + vec2(40.0, 60.0), pos2(panel_left.min(rect.right()) - 20.0, rect.bottom() - 60.0));
+ let content = crate::shell::content_rect(app, rect);
+ let area = Rect::from_min_max(content.min + vec2(40.0, 60.0), pos2(panel_left.min(content.right()) - 20.0, content.bottom() - 60.0));
if area.width() <= 0.0 || area.height() <= 0.0 {
return true;
}
diff --git a/crates/ui-egui/src/dialogs_sheet_tests.rs b/crates/ui-egui/src/dialogs_sheet_tests.rs
index 92646293a4..20fd1d8b1a 100644
--- a/crates/ui-egui/src/dialogs_sheet_tests.rs
+++ b/crates/ui-egui/src/dialogs_sheet_tests.rs
@@ -205,6 +205,12 @@ fn flat_pattern_islands_fit_before_the_actual_command_panel() {
let mut dialog = app.dialog.clone().unwrap();
let Kind::Sheet(Sm::FlatPattern { data, .. }) = &mut dialog.kind else { panic!("flat dialog") };
*data = Some(Ok(flat));
+ let viewport = Rect::from_min_max(pos2(250.0, crate::toolbar::APP_BAR_HEIGHT + crate::toolbar::RIBBON_HEIGHT), pos2(1400.0, 832.0));
+ let browser = Rect::from_min_max(viewport.min, viewport.min + vec2(250.0, 450.0));
+ let history = Rect::from_min_max(pos2(viewport.left(), viewport.bottom() - 40.0), viewport.max);
+ if mode == crate::shell::LayoutMode::Floating {
+ app.shell.content = Some(Rect::from_min_max(pos2(browser.right(), viewport.top()), pos2(viewport.right(), history.top())));
+ }
let ctx = egui::Context::default();
let id = egui::Id::new(("sc_dialog", "FLAT PATTERN"));
let mut output = egui::FullOutput::default();
@@ -241,6 +247,12 @@ fn flat_pattern_islands_fit_before_the_actual_command_panel() {
outlines.iter().flat_map(|p| &p.points).all(|p| p.x <= panel.left() - 19.0),
"both complete islands must remain exposed before the command panel: {panel:?}"
);
+ if mode == crate::shell::LayoutMode::Floating {
+ assert!(
+ outlines.iter().flat_map(|p| &p.points).all(|p| !browser.contains(*p) && !history.contains(*p)),
+ "flat pattern fits clear of the shell cards"
+ );
+ }
}
}
diff --git a/crates/ui-egui/src/edit_clipboard.rs b/crates/ui-egui/src/edit_clipboard.rs
index 312167a4e3..d5a41a8206 100644
--- a/crates/ui-egui/src/edit_clipboard.rs
+++ b/crates/ui-egui/src/edit_clipboard.rs
@@ -126,7 +126,8 @@ pub fn cut(app: &mut SolveApp) -> bool {
fn sketch_point(app: &SolveApp, at: Option<Pos2>) -> Option<[f64; 2]> {
let at = at?;
let rect = app.viewport.rect?;
- if !rect.contains(at) {
+ // Under a card or panel floating over the viewport is not over the sketch.
+ if !rect.contains(at) || crate::shell::covered(app, at) {
return None;
}
let proj = crate::viewport::projection(app, rect);
diff --git a/crates/ui-egui/src/frame.rs b/crates/ui-egui/src/frame.rs
index d80da2b255..dacd1d309c 100644
--- a/crates/ui-egui/src/frame.rs
+++ b/crates/ui-egui/src/frame.rs
@@ -239,6 +239,12 @@ pub fn right_aligned<R>(ui: &mut Ui, total: f32, width: f32, add: impl FnOnce(&m
add(ui)
}
+/// Shared rounded surface for floating shell cards.
+pub(crate) fn shell_card(fill: egui::Color32) -> egui::Frame {
+ let t = crate::theme::Tokens::get();
+ egui::Frame::NONE.fill(fill).stroke(egui::Stroke::new(1.0, t.border)).corner_radius(t.radius_lg).shadow(t.shell_shadow())
+}
+
#[cfg(test)]
mod tests {
#[test]
diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs
index 90dabc876d..e3c630b717 100644
--- a/crates/ui-egui/src/i18n.rs
+++ b/crates/ui-egui/src/i18n.rs
@@ -457,10 +457,13 @@ mod tests {
assert_eq!(it.given_name("Fillet"), "Fillet");
assert_eq!(it.label("solid.extrude"), "solid.extrude");
assert_eq!(it.format("document.save_changes", &[("name", "Staffa {v2}")]), "Salvare le modifiche a Staffa {v2}?");
+ // The bottom command-line hint retired with that surface. A live save prompt
+ // still proves that a substituted value keeps literal JSON braces intact.
assert_eq!(
- it.format("ui.command_palette_hint", &[("example", "solid.extrude {\"distance\": 20}")]),
- "Digita un comando, ad es. solid.extrude {\"distance\": 20} — oppure premi S per cercare"
+ it.format("document.save_changes", &[("name", "solid.extrude {\"distance\": 20}")]),
+ "Salvare le modifiche a solid.extrude {\"distance\": 20}?"
);
+ assert_eq!(it.format("ui.browser_bodies_other", &[("count", "2")]), "2 corpi");
}
/// `label()`'s id fallback (an argument that matches no other entry's English text is
diff --git a/crates/ui-egui/src/i18n_ui_tests.rs b/crates/ui-egui/src/i18n_ui_tests.rs
index 6b07df6ffd..3d1ac2ab05 100644
--- a/crates/ui-egui/src/i18n_ui_tests.rs
+++ b/crates/ui-egui/src/i18n_ui_tests.rs
@@ -81,12 +81,12 @@ fn window_chrome_renders_in_the_active_language() {
for (lang, browser, filter, faces) in [
("zh", "浏览器", "选择筛选", "面"),
("ja", "ブラウザ", "選択フィルター", "面"),
- ("de", "BROWSER", "Auswahlfilter", "Flächen"),
+ ("de", "Browser", "Auswahlfilter", "Flächen"),
("ko", "브라우저", "선택 필터", "면"),
- ("ru", "БРАУЗЕР", "Фильтр выделения", "Грани"),
- ("fr", "NAVIGATEUR", "Filtre de sélection", "Faces"),
- ("it", "STRUTTURA", "Filtro di selezione", "Facce"),
- ("uk", "БРАУЗЕР", "Фільтр виділення", "Грані"),
+ ("ru", "Браузер", "Фильтр выделения", "Грани"),
+ ("fr", "Navigateur", "Filtre de sélection", "Faces"),
+ ("it", "Struttura", "Filtro di selezione", "Facce"),
+ ("uk", "Браузер", "Фільтр виділення", "Грані"),
] {
let mut h = Harness::new();
h.app.preferences.language = lang.into();
@@ -213,19 +213,6 @@ fn home_page_renders_in_the_active_language() {
}
}
-/// The command palette's hint embeds a JSON example, so its braces must not be mistaken for a
-/// placeholder name by the catalog's parser, and the example must survive interpolation whole.
-#[test]
-fn command_palette_hint_keeps_its_json_example_intact() {
- let mut h = Harness::new();
- h.app.preferences.language = "zh".into();
- h.app.home.open = false;
- h.frames(2);
- let hint = crate::i18n::format("ui.command_palette_hint", &[("example", "Extrude {\"distance\": 20}")]);
- assert!(hint.contains("Extrude {\"distance\": 20}"), "the example is inserted literally: {hint:?}");
- assert!(!hint.contains("{example}"), "the placeholder is substituted: {hint:?}");
-}
-
#[test]
fn translated_dialog_buttons_do_not_wrap() {
fn cancel_rows(shape: &egui::Shape) -> Option<usize> {
diff --git a/crates/ui-egui/src/icons.rs b/crates/ui-egui/src/icons.rs
index 4822471b09..5d9cb6ba60 100644
--- a/crates/ui-egui/src/icons.rs
+++ b/crates/ui-egui/src/icons.rs
@@ -39,20 +39,25 @@ pub fn paint_icon(p: &Painter, r: Rect, name: &str, opacity: f32) {
/// Draw the icon `name` for a surface that is always dark (the application bar), whatever the
/// theme: `dark: Some(true)`. `None` follows the theme.
pub fn paint_on(p: &Painter, r: Rect, name: &str, dark: Option<bool>, opacity: f32) {
- paint_with_ink(p, r, name, dark, opacity, None);
+ paint_with_ink(p, r, name, dark, opacity, None, false);
}
/// Monochrome flat controls on the application bar use its text token exactly.
pub(crate) fn paint_app_bar(p: &Painter, r: Rect, name: &str, opacity: f32) {
- paint_with_ink(p, r, name, Some(true), opacity, Some(crate::theme::Tokens::get().app_bar_text));
+ paint_with_ink(p, r, name, Some(true), opacity, Some(crate::theme::Tokens::get().app_bar_text), false);
}
/// Paint a single-colour icon in `ink`.
pub(crate) fn paint_ink(p: &Painter, r: Rect, name: &str, ink: Color32) {
- paint_with_ink(p, r, name, Some(true), 1.0, Some(ink));
+ paint_with_ink(p, r, name, Some(true), 1.0, Some(ink), false);
}
-fn paint_with_ink(p: &Painter, r: Rect, name: &str, dark: Option<bool>, opacity: f32, ink: Option<Color32>) {
+/// Paint a single-colour icon in `ink`, mirrored top to bottom (a chevron pointing up).
+pub(crate) fn paint_ink_flipped(p: &Painter, r: Rect, name: &str, ink: Color32) {
+ paint_with_ink(p, r, name, Some(true), 1.0, Some(ink), true);
+}
+
+fn paint_with_ink(p: &Painter, r: Rect, name: &str, dark: Option<bool>, opacity: f32, ink: Option<Color32>, flip_y: bool) {
let ctx = p.ctx();
let ppp = ctx.pixels_per_point().max(0.5);
let side = r.width().min(r.height());
@@ -78,7 +83,8 @@ fn paint_with_ink(p: &Painter, r: Rect, name: &str, dark: Option<bool>, opacity:
let size = px as f32 / ppp;
let min = pos2(((r.center().x - size / 2.0) * ppp).round() / ppp, ((r.center().y - size / 2.0) * ppp).round() / ppp);
let tint = Color32::from_white_alpha((opacity.clamp(0.0, 1.0) * 255.0).round() as u8);
- p.image(tex.id(), Rect::from_min_size(min, egui::vec2(size, size)), Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), tint);
+ let uv = if flip_y { Rect::from_min_max(pos2(0.0, 1.0), pos2(1.0, 0.0)) } else { Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)) };
+ p.image(tex.id(), Rect::from_min_size(min, egui::vec2(size, size)), uv, tint);
}
#[cfg(test)]
diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs
index 57d861d527..fd995697e0 100644
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@ -136,7 +136,6 @@ mod fillet_spline_handle_tests;
pub mod mouse_gesture;
pub(crate) mod navigation;
pub(crate) mod open_meshing;
-pub mod palette;
pub mod params_dialog;
pub(crate) mod pick_buffer;
pub(crate) mod pick_index;
@@ -354,7 +353,6 @@ pub struct SolveApp {
/// The Bill of Materials window, when open.
pub bom: Option<bom_panel::BomPanel>,
material_card_review: Option<material_card_review::ReviewWindow>,
- pub palette: palette::Palette,
/// Context menus, rename box and Properties window.
pub menu: context_menu::MenuState,
/// Mouse gestures: the ring of tools and its customization window.
@@ -508,7 +506,6 @@ impl SolveApp {
design_properties: None,
bom: None,
material_card_review: None,
- palette: palette::Palette::default(),
menu: context_menu::MenuState::default(),
gesture: mouse_gesture::State::default(),
tree: browser::TreeState::default(),
@@ -1001,7 +998,8 @@ impl SolveApp {
Some(d) => self.dialog = Some(d),
None => {
let _ = dialogs::roll_marker(self, marker);
- self.palette.text = format!("timeline.edit {{\"feature\": {id}, \"set\": {{}}}}");
+ // No dialog for this feature: open the search box with the command to edit it.
+ self.sbox.text = format!("timeline.edit {{\"feature\": {id}, \"set\": {{}}}}");
self.ui.palette_open = true;
}
}
@@ -1500,23 +1498,30 @@ impl SolveApp {
toolbar::toolbar(self, ui);
}
theme::TabAccent::publish(self, ui.ctx());
- if show_timeline && !left_timeline {
+ if !floating && show_timeline && !left_timeline {
timeline::timeline(self, ui);
}
- palette::palette_bar(self, ui);
// A floating browser keeps the workspace the whole width and covers viewport input.
- let browser_float = self.ui.show_browser && self.preferences.browser_float;
+ let browser_float = self.ui.show_browser && (self.preferences.browser_float || (floating && !left_timeline));
if !browser_float {
self.shell.browser = None;
}
+ self.shell.history = None;
let full = ui.available_rect_before_wrap();
if floating {
let cards = shell::Cards::new(full, self.ui.layout);
self.shell.cards = vec![cards.workspace, cards.ribbon];
+ self.shell.history = (show_timeline && !left_timeline).then(|| timeline::floating_rect(full));
// Draw the scene first, then let the unchanged panel layouts cover it. The
// viewport keeps its full projection even underneath the browser and cards.
preview::update(self, ui.ctx());
- let blocked = ui.input(|i| i.pointer.latest_pos()).is_some_and(|p| shell::covered(self, p));
+ // A camera drag that began on the model keeps capture across cards. New
+ // gestures over chrome are blocked, as are selection drags into the ribbon.
+ let continuing_navigation = ui.input(|i| {
+ (i.pointer.middle_down() || i.pointer.secondary_down())
+ && i.pointer.press_origin().is_some_and(|p| full.contains(p) && !shell::covered(self, p))
+ });
+ let blocked = !continuing_navigation && ui.input(|i| i.pointer.latest_pos()).is_some_and(|p| shell::covered(self, p));
let mut viewport_ui = ui.new_child(egui::UiBuilder::new().max_rect(full).id_salt("floating_viewport"));
if blocked {
// Disabled only to shield the scene from input under a card or menu; it must
@@ -1529,6 +1534,9 @@ impl SolveApp {
toolbar::toolbar(self, ui);
theme::TabAccent::publish(self, ui.ctx());
}
+ if floating && show_timeline && !left_timeline {
+ timeline::timeline(self, ui);
+ }
if self.ui.show_browser && !browser_float {
if left_timeline {
browser::browser_below_timeline(self, ui);
@@ -1549,11 +1557,18 @@ impl SolveApp {
}
egui::CentralPanel::default().frame(egui::Frame::NONE).show(ui, |ui| {
if floating {
- let content = ui.max_rect();
+ let panel_content = ui.max_rect();
+ let mut content = panel_content;
+ if let Some(history) = self.shell.history {
+ content.max.y = (history.top() - shell::SHELL_GAP).max(content.top());
+ }
+ if let Some(browser) = self.shell.browser {
+ content.min.x = (browser.right() + shell::SHELL_GAP).min(content.right());
+ }
self.shell.content = Some(content);
self.shell.panels = [
- egui::Rect::from_min_max(egui::pos2(full.left(), content.top()), egui::pos2(content.left(), full.bottom())),
- egui::Rect::from_min_max(egui::pos2(content.right(), content.top()), full.max),
+ egui::Rect::from_min_max(egui::pos2(full.left(), panel_content.top()), egui::pos2(panel_content.left(), full.bottom())),
+ egui::Rect::from_min_max(egui::pos2(panel_content.right(), panel_content.top()), full.max),
]
.into_iter()
.filter(|r| r.is_positive())
diff --git a/crates/ui-egui/src/shell.rs b/crates/ui-egui/src/shell.rs
index 3f4cd186af..56753ceb31 100644
--- a/crates/ui-egui/src/shell.rs
+++ b/crates/ui-egui/src/shell.rs
@@ -78,8 +78,9 @@ impl Cards {
pub(crate) struct State {
pub cards: Vec<Rect>,
pub panels: Vec<Rect>,
- pub content: Option<Rect>,
pub browser: Option<Rect>,
+ pub history: Option<Rect>,
+ pub content: Option<Rect>,
}
/// One source of occlusion for navigation, picking, overlays and fit.
@@ -88,8 +89,9 @@ pub(crate) fn covered_rects(app: &SolveApp) -> Vec<Rect> {
if app.ui.layout == LayoutMode::Floating {
rects.extend(app.shell.cards.iter().copied());
rects.extend(app.shell.panels.iter().copied());
+ rects.extend(app.shell.history);
}
- rects.extend(app.shell.browser.filter(|_| app.ui.show_browser && app.preferences.browser_float));
+ rects.extend(app.shell.browser.filter(|_| app.ui.show_browser));
rects.extend(app.viewport.palette_rect.filter(|_| app.session.active_sketch.is_some()));
rects.extend(app.viewport.dialog_rect.filter(|_| app.dialog.is_some()));
rects.retain(|r| r.is_finite() && r.is_positive());
diff --git a/crates/ui-egui/src/shell_tests.rs b/crates/ui-egui/src/shell_tests.rs
index 870878128c..0705d22299 100644
--- a/crates/ui-egui/src/shell_tests.rs
+++ b/crates/ui-egui/src/shell_tests.rs
@@ -198,7 +198,7 @@ fn floating_browser_clears_cards_shields_input_and_can_dock_again() {
let toolbar = rect_of("toolbar").unwrap();
assert!(browser.top() >= toolbar.bottom(), "{mode:?}: {browser:?} must clear {toolbar:?}");
assert!(crate::scenario::handle_at("row:Untitled").is_some());
- assert!(crate::scenario::handle_at("left-browser-rail").is_none());
+ assert!(crate::scenario::handle_at("left-browser-rail").is_some());
assert!(covered(&h.app, browser.center()));
let viewport = h.app.viewport.rect.unwrap();
// A left-side history still takes a column in Docked mode.
@@ -229,8 +229,10 @@ fn floating_browser_clears_cards_shields_input_and_can_dock_again() {
assert!(crate::browser::drawn_rows().iter().any(|(name, _, _, open)| name == "Origin" && *open == Some(true)));
h.app.preferences.browser_float = false;
h.settle();
- assert!(h.app.shell.browser.is_none());
+ assert_eq!(h.app.shell.browser.is_some(), mode == LayoutMode::Floating && !timeline_left);
assert!(rect_of("browser:float").is_none());
+ assert_eq!(rect_of("browser:card").is_some(), mode == LayoutMode::Floating && !timeline_left);
+ // The saved width follows both the floating card and the docked column.
let rail = crate::scenario::handle_at("left-browser-rail").unwrap();
let width = h.app.preferences.browser_width;
h.call("ui.drag", json!({"x0":rail.x,"y0":rail.y,"x1":rail.x+60.0,"y1":rail.y,"steps":6}));
@@ -238,3 +240,65 @@ fn floating_browser_clears_cards_shields_input_and_can_dock_again() {
}
}
}
+
+#[test]
+fn browser_and_history_cards_block_input_while_their_gaps_and_space_below_browser_do_not() {
+ let mut h = Harness::new();
+ h.call("ui.resize", json!({"width":1400,"height":900}));
+ h.app.run("solid.box", json!({"length":40,"width":30,"height":20})).unwrap();
+ h.settle();
+ let browser = rect_of("browser:card").unwrap();
+ let history = rect_of("history:card").unwrap();
+ let viewport = h.app.viewport.rect.unwrap();
+ assert_eq!(history.left(), viewport.left() + SHELL_GAP);
+ assert_eq!(history.right(), viewport.right() - SHELL_GAP);
+ assert_eq!(history.bottom(), viewport.bottom() - SHELL_GAP);
+ let layout = h.app.viewport.layout.as_ref().unwrap();
+ assert!(layout.navigation.bottom() < history.top());
+ assert!(layout.axis_view.top() >= rect_of("ribbon:card").unwrap().bottom());
+ for r in [browser, history] {
+ assert!(covered(&h.app, r.center()));
+ assert!(!layout.drawable.intersect(r).is_positive());
+ }
+ for at in [pos2(browser.left() + 2.0, browser.top() + 2.0), pos2(history.right() - 30.0, history.center().y)] {
+ let camera = h.app.cam;
+ h.call("ui.move", json!({"x":at.x,"y":at.y}));
+ assert!(h.app.viewport.mouse.is_none());
+ assert!(h.app.viewport.hover.is_none());
+ h.call("ui.scroll", json!({"x":at.x,"y":at.y,"delta":120}));
+ h.call("ui.drag", json!({"x0":at.x,"y0":at.y,"x1":at.x+10.0,"y1":at.y+2.0,"button":"middle","steps":6}));
+ assert_eq!(h.app.cam, camera);
+ }
+ for at in [pos2(3.0, browser.center().y), pos2(browser.center().x, browser.bottom() + SHELL_GAP), pos2(3.0, history.center().y)] {
+ assert!(!covered(&h.app, at));
+ h.call("ui.move", json!({"x":at.x,"y":at.y}));
+ assert_eq!(h.app.viewport.mouse, Some(at));
+ }
+ h.app.ui.show_browser = false;
+ h.app.ui.show_timeline = false;
+ h.settle();
+ assert!(h.app.shell.browser.is_none() && h.app.shell.history.is_none());
+ assert!(!covered(&h.app, browser.center()));
+ assert!(!covered(&h.app, history.center()));
+}
+
+#[test]
+fn left_history_keeps_the_existing_column_in_both_modes() {
+ for mode in [LayoutMode::Floating, LayoutMode::Docked] {
+ let mut h = Harness::new();
+ h.app.ui.layout = mode;
+ h.app.preferences.timeline_left = true;
+ h.app.run("solid.box", json!({"length":10,"width":10,"height":10,"name":"First"})).unwrap();
+ h.settle();
+ assert!(rect_of("history:card").is_none());
+ assert!(rect_of("browser:card").is_none());
+ assert!(crate::scenario::handle_at("timeline:First").is_some());
+ let viewport = h.app.viewport.rect.unwrap();
+ let content = content_rect(&h.app, viewport);
+ assert_eq!(content.left(), 250.0);
+ assert_eq!(content.bottom(), viewport.bottom());
+ if mode == LayoutMode::Floating {
+ assert!(covered(&h.app, pos2(125.0, content.center().y)));
+ }
+ }
+}
diff --git a/crates/ui-egui/src/shortcut_box.rs b/crates/ui-egui/src/shortcut_box.rs
index dbb2ea4b66..8a5763032e 100644
--- a/crates/ui-egui/src/shortcut_box.rs
+++ b/crates/ui-egui/src/shortcut_box.rs
@@ -167,6 +167,28 @@ pub fn open(app: &mut SolveApp, at: Option<Pos2>) {
app.sbox.focus = true;
}
+/// A line typed as `command.id {"param": value}`: the command runs at once with those parameters
+/// (the same entry the bottom command line used to take).
+fn run_typed(app: &mut SolveApp, line: &str) {
+ let line = line.trim();
+ app.ui.palette_open = false;
+ app.sbox.at = None;
+ app.sbox.text.clear();
+ let split = line.find(|c: char| c.is_whitespace() || c == '{').unwrap_or(line.len());
+ let (id, rest) = (line.get(..split).unwrap_or_default(), line.get(split..).unwrap_or_default().trim());
+ let Some(command) = solidcraft_engine::find_command(id) else {
+ app.set_status(format!("no command `{id}`; the text before the JSON must be a command id"), true);
+ return;
+ };
+ match serde_json::from_str::<Value>(rest) {
+ Ok(params) => {
+ app.sbox.used(command.id);
+ let _ = app.run(command.id, params);
+ }
+ Err(e) => app.set_status(format!("parameters must be JSON: {e}"), true),
+ }
+}
+
fn run(app: &mut SolveApp, id: &str) {
app.sbox.used(id);
app.ui.palette_open = false;
@@ -307,6 +329,11 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
crate::context_menu::open_for(app, at, crate::context_menu::Target::ToolbarCommand { id: id.to_string() });
return;
}
+ if enter && picked.is_none() && app.sbox.text.contains('{') {
+ let line = app.sbox.text.clone();
+ run_typed(app, &line);
+ return;
+ }
if enter
&& picked.is_none()
&& let Some((id, ..)) = list.get(app.sbox.index)
@@ -414,4 +441,37 @@ mod tests {
let row = search(&app, "center rect").into_iter().find(|r| r.0 == "sketch.rectangle.center").unwrap();
assert_eq!((row.1, row.3), ("Center Rectangle", Some(("SKETCH", "CREATE"))));
}
+
+ #[test]
+ fn a_line_typed_with_json_parameters_runs_the_command() {
+ let mut app = SolveApp::new(solidcraft_engine::Session::default(), Default::default());
+ let before = app.session.doc.features.len();
+ app.ui.palette_open = true;
+ app.sbox.text = r#"solid.box {"length": 10, "width": 10, "height": 10}"#.into();
+ let line = app.sbox.text.clone();
+ run_typed(&mut app, &line);
+ assert_eq!(app.session.doc.features.len(), before + 1, "{:?}", app.status);
+ assert!(!app.ui.palette_open && app.sbox.text.is_empty(), "the box closes");
+ assert_eq!(app.sbox.recent.first().map(String::as_str), Some("solid.box"));
+ // Bad JSON and an unknown id report instead of running anything.
+ run_typed(&mut app, r#"solid.box {"length": "#);
+ assert!(app.status.as_ref().is_some_and(|(m, _, err)| *err && m.contains("JSON")), "{:?}", app.status);
+ run_typed(&mut app, r#"not.a.command {}"#);
+ assert!(app.status.as_ref().is_some_and(|(m, _, err)| *err && m.contains("no command")), "{:?}", app.status);
+ assert_eq!(app.session.doc.features.len(), before + 1);
+ }
+
+ #[test]
+ fn typing_json_in_the_open_box_and_pressing_enter_runs_it() {
+ let mut h = crate::scenario::Harness::new();
+ h.app.home.open = false;
+ h.frames(2);
+ let before = h.app.session.doc.features.len();
+ h.step(&json!({"key": "S"})).unwrap();
+ h.step(&json!({"text": r#"solid.box {"length": 10, "width": 10, "height": 10}"#})).unwrap();
+ h.step(&json!({"key": "Enter"})).unwrap();
+ h.frames(2);
+ assert_eq!(h.app.session.doc.features.len(), before + 1, "{:?}", h.app.status);
+ assert!(!h.app.ui.palette_open);
+ }
}
diff --git a/crates/ui-egui/src/sketch_guidance_ui_tests.rs b/crates/ui-egui/src/sketch_guidance_ui_tests.rs
index 6b47ec4a36..6512ee6d59 100644
--- a/crates/ui-egui/src/sketch_guidance_ui_tests.rs
+++ b/crates/ui-egui/src/sketch_guidance_ui_tests.rs
@@ -32,6 +32,8 @@ fn preview(h: &mut Harness, curves: usize) {
#[test]
fn sketch_dialog_mirror_toggles_clears_references_previews_and_cancels() {
let mut h = fixture();
+ // Keep the source curves and reference between the floating dialog and Sketch Palette.
+ step(&mut h, json!({"call":"ui.camera","params":{"target":[-40,0,0],"distance":150}}));
let original = h.app.session.doc.to_json();
let undo = h.app.session.undo.len();
let revision = h.app.session.revision;
@@ -93,6 +95,8 @@ fn sketch_dialog_patterns_update_counts_and_place_an_unsnapped_centre() {
#[test]
fn sketch_dialog_offset_precise_distance_flip_and_editable_dimension() {
let mut h = fixture();
+ // The floating browser shifts the dialog over the source curve at the default camera.
+ step(&mut h, json!({"call":"ui.camera","params":{"target":[-40,0,0],"distance":150}}));
step(&mut h, json!({"start":"sketch.offset"}));
pick(&mut h, [-22.5, 10.0], false);
if let crate::dialogs::Kind::SketchModify(Mod::Offset { distance, flip, chain, .. }) = &mut h.app.dialog.as_mut().unwrap().kind {
diff --git a/crates/ui-egui/src/timeline.rs b/crates/ui-egui/src/timeline.rs
index c9fe7edde2..389951a277 100644
--- a/crates/ui-egui/src/timeline.rs
+++ b/crates/ui-egui/src/timeline.rs
@@ -249,271 +249,308 @@ fn toggle_feature(app: &mut SolveApp, id: u64) {
}
pub fn timeline(app: &mut SolveApp, ui: &mut egui::Ui) {
+ let t = Tokens::get();
+ if app.ui.layout == crate::shell::LayoutMode::Floating {
+ let rect = floating_rect(ui.available_rect_before_wrap());
+ // A window too short for the card (the ribbon already fills it) leaves the history out
+ // rather than drawing into a negative-size rectangle.
+ if !rect.is_finite() || rect.width() < 1.0 || rect.height() < 30.0 {
+ app.shell.history = None;
+ return;
+ }
+ app.shell.history = Some(rect);
+ crate::scenario::publish_rect("history:card", rect);
+ let mut child = ui.new_child(UiBuilder::new().id_salt("sc_timeline").max_rect(rect));
+ ui.painter().add(crate::frame::shell_card(t.timeline).paint(rect));
+ child.set_clip_rect(rect);
+ timeline_contents(app, &mut child, true);
+ } else {
+ let response = egui::Panel::bottom("sc_timeline").exact_size(40.0).frame(egui::Frame::NONE.fill(t.timeline)).show(ui, |ui| {
+ timeline_contents(app, ui, false);
+ });
+ crate::scenario::publish_rect("history:strip", response.response.rect);
+ }
+}
+
+pub(crate) fn floating_rect(available: Rect) -> Rect {
+ let gap = crate::shell::SHELL_GAP;
+ let inset = available.shrink(gap);
+ Rect::from_min_max(pos2(inset.left(), (inset.bottom() - 40.0).max(inset.top())), inset.max)
+}
+
+fn timeline_contents(app: &mut SolveApp, ui: &mut egui::Ui, floating: bool) {
let t = Tokens::get();
let accent = crate::theme::TabAccent::for_tab(&t, &app.ui.tab);
- egui::Panel::bottom("sc_timeline").exact_size(40.0).frame(egui::Frame::NONE.fill(t.timeline)).show(ui, |ui| {
- let r = ui.max_rect();
- let p = ui.painter().clone();
+ let r = ui.max_rect();
+ let p = ui.painter().clone();
+ if !floating {
p.line_segment([r.left_top(), r.right_top()], Stroke::new(1.0, t.border));
- let n = app.session.doc.features.len();
- let marker = app.session.doc.marker.unwrap_or(n);
- // Playback controls.
- let mut x = r.left() + 10.0;
- let controls = [("first", Some(0usize)), ("back", Some(marker.saturating_sub(1))), ("forward", Some((marker + 1).min(n))), ("last", None)];
- for (what, target) in controls {
- let br = Rect::from_center_size(pos2(x + 11.0, r.center().y), vec2(22.0, 22.0));
- let resp = ui.interact(br, ui.id().with(("tl", what)), Sense::click());
- if resp.hovered() {
- p.rect_filled(br, 3.0, t.hover);
- }
- transport_glyph(&p, br.center(), what, t.icon);
- if resp
- .on_hover_text(match what {
- "first" => "Roll back to the start",
- "back" => "Step back one feature",
- "forward" => "Step forward one feature",
- _ => "Play to the end",
- })
- .clicked()
- {
- let pos = match target {
- Some(k) if k < n => json!({"position": k}),
- _ => json!({}),
- };
- let _ = app.run_heavy("timeline.roll_to", pos);
- }
- x += 24.0;
+ }
+ let n = app.session.doc.features.len();
+ let marker = app.session.doc.marker.unwrap_or(n);
+ // Playback controls.
+ let mut x = r.left() + t.space_10;
+ if floating {
+ let label = p.layout_no_wrap(crate::i18n::tr("ui.history_title").to_string(), egui::FontId::proportional(t.font_label), t.text);
+ p.galley(pos2(x, r.center().y - label.size().y / 2.0), label.clone(), t.text);
+ x += label.size().x + t.space_12;
+ }
+ let controls = [("first", Some(0usize)), ("back", Some(marker.saturating_sub(1))), ("forward", Some((marker + 1).min(n))), ("last", None)];
+ for (what, target) in controls {
+ let br = Rect::from_center_size(pos2(x + 11.0, r.center().y), vec2(22.0, 22.0));
+ crate::scenario::publish_handle(&format!("history:{what}"), br.center());
+ let resp = ui.interact(br, ui.id().with(("tl", what)), Sense::click());
+ if resp.hovered() {
+ p.rect_filled(br, 3.0, t.hover);
}
- x += 14.0;
- // The features scroll horizontally in the space right of the playback controls.
- let strip = Rect::from_min_max(pos2(x, r.top()), r.right_bottom());
- ui.scope_builder(UiBuilder::new().max_rect(strip), |ui| {
- // A plain mouse wheel scrolls the strip sideways too, not only Shift + wheel (#3356).
- ui.style_mut().always_scroll_the_only_direction = true;
- egui::ScrollArea::horizontal().auto_shrink([false, false]).show(ui, |ui| {
- let p = ui.painter().clone();
- let mut x = ui.max_rect().left();
- let origin = x;
- let feats: Vec<_> = app
- .session
- .doc
- .features
- .iter()
- .map(|f| (f.id, f.name.clone(), icon_of(&f.kind), f.suppressed, f.kind.type_name(), TimelineKind::of(&f.kind)))
- .collect();
- // The feature whose body is under the cursor in the viewport.
- let st = app.session.world_state();
- let from_view = match &app.viewport.hover {
- Some(
- crate::viewport::Hit::Face { body, .. } | crate::viewport::Hit::Edge { body, .. } | crate::viewport::Hit::Vertex { body, .. },
- ) => st.body(body).map(|b| b.feature),
- _ => None,
+ transport_glyph(&p, br.center(), what, t.icon);
+ if resp
+ .on_hover_text(match what {
+ "first" => "Roll back to the start",
+ "back" => "Step back one feature",
+ "forward" => "Step forward one feature",
+ _ => "Play to the end",
+ })
+ .clicked()
+ {
+ let pos = match target {
+ Some(k) if k < n => json!({"position": k}),
+ _ => json!({}),
+ };
+ let _ = app.run_heavy("timeline.roll_to", pos);
+ }
+ x += 24.0;
+ }
+ x += 14.0;
+ // The features scroll horizontally in the space right of the playback controls.
+ let strip = Rect::from_min_max(pos2(x, r.top()), r.right_bottom());
+ ui.scope_builder(UiBuilder::new().max_rect(strip), |ui| {
+ // A plain mouse wheel scrolls the strip sideways too (#3356).
+ ui.style_mut().always_scroll_the_only_direction = true;
+ egui::ScrollArea::horizontal().auto_shrink([false, false]).show(ui, |ui| {
+ let p = ui.painter().clone();
+ let mut x = ui.max_rect().left();
+ let origin = x;
+ let feats: Vec<_> = app
+ .session
+ .doc
+ .features
+ .iter()
+ .map(|f| (f.id, f.name.clone(), icon_of(&f.kind), f.suppressed, f.kind.type_name(), TimelineKind::of(&f.kind)))
+ .collect();
+ // The feature whose body is under the cursor in the viewport.
+ let st = app.session.world_state();
+ let from_view = match &app.viewport.hover {
+ Some(
+ crate::viewport::Hit::Face { body, .. } | crate::viewport::Hit::Edge { body, .. } | crate::viewport::Hit::Vertex { body, .. },
+ ) => st.body(body).map(|b| b.feature),
+ _ => None,
+ };
+ let drag_id = ui.id().with("tl_drag");
+ let mut drag: Option<Drag> = ui.data(|d| d.get_temp(drag_id));
+ let pointer = ui.input(|i| i.pointer.hover_pos());
+ let mut xs: Vec<f32> = Vec::new();
+ let mut hovered: Option<u64> = None;
+ let mut edit: Option<u64> = None;
+ let mut marker_rect: Option<Rect> = None;
+ for (i, (id, name, icon, suppressed, ty, kind)) in feats.iter().enumerate() {
+ if i == marker {
+ marker_rect = Some(Rect::from_min_size(pos2(x, r.top() + 5.0), vec2(6.0, r.height() - 10.0)));
+ x += 10.0;
+ }
+ xs.push(x);
+ let br = Rect::from_min_size(pos2(x, r.top() + 6.0), vec2(28.0, 28.0));
+ crate::scenario::publish_handle(&format!("timeline:{name}"), br.center());
+ let resp = ui.interact(br, ui.id().with(("feat", *id)), Sense::click_and_drag());
+ let res = app.session.model.result(*id);
+ let err = res.and_then(|r| r.error.clone());
+ let warn = res.and_then(|r| r.warning.clone());
+ let rolled = i >= marker;
+ let is_it = |s: &solidcraft_engine::Sel| matches!(s, solidcraft_engine::Sel::Feature { id: f } if f == id);
+ let sel = app.session.selection.iter().any(is_it) || app.dialog.as_ref().is_some_and(|d| d.items().iter().any(is_it));
+ if resp.hovered() {
+ hovered = Some(*id);
+ }
+ let bg = if err.is_some() {
+ t.timeline_item_error
+ } else if sel || (floating && marker > 0 && i == marker - 1) {
+ accent.soft
+ } else if resp.hovered() || from_view == Some(*id) {
+ t.hover
+ } else {
+ t.timeline_item
};
- let drag_id = ui.id().with("tl_drag");
- let mut drag: Option<Drag> = ui.data(|d| d.get_temp(drag_id));
- let pointer = ui.input(|i| i.pointer.hover_pos());
- let mut xs: Vec<f32> = Vec::new();
- let mut hovered: Option<u64> = None;
- let mut edit: Option<u64> = None;
- let mut marker_rect: Option<Rect> = None;
- for (i, (id, name, icon, suppressed, ty, kind)) in feats.iter().enumerate() {
- if i == marker {
- marker_rect = Some(Rect::from_min_size(pos2(x, r.top() + 5.0), vec2(6.0, r.height() - 10.0)));
- x += 10.0;
- }
- xs.push(x);
- let br = Rect::from_min_size(pos2(x, r.top() + 6.0), vec2(28.0, 28.0));
- crate::scenario::publish_handle(&format!("timeline:{name}"), br.center());
- let resp = ui.interact(br, ui.id().with(("feat", *id)), Sense::click_and_drag());
- let res = app.session.model.result(*id);
- let err = res.and_then(|r| r.error.clone());
- let warn = res.and_then(|r| r.warning.clone());
- let rolled = i >= marker;
- let is_it = |s: &solidcraft_engine::Sel| matches!(s, solidcraft_engine::Sel::Feature { id: f } if f == id);
- let sel = app.session.selection.iter().any(is_it) || app.dialog.as_ref().is_some_and(|d| d.items().iter().any(is_it));
- if resp.hovered() {
- hovered = Some(*id);
- }
- let bg = if err.is_some() {
- t.timeline_item_error
- } else if sel {
- accent.soft
- } else if resp.hovered() || from_view == Some(*id) {
- t.hover
- } else {
- t.timeline_item
- };
- let edge = if err.is_some() {
- t.error
- } else if from_view == Some(*id) {
- accent.color
- } else {
- t.border
- };
- p.rect(br, 3.0, bg, Stroke::new(1.0, edge), egui::StrokeKind::Inside);
- let ink = if rolled || *suppressed { t.border } else { t.icon };
+ let edge = if err.is_some() {
+ t.error
+ } else if from_view == Some(*id) || (floating && marker > 0 && i == marker - 1) {
+ accent.color
+ } else {
+ t.border
+ };
+ p.rect(br, 3.0, bg, Stroke::new(1.0, edge), egui::StrokeKind::Inside);
+ let ink = if rolled || *suppressed { t.border } else { t.icon };
+ icons::paint(
+ &p,
+ br.shrink(4.0),
+ icon,
+ ink,
+ if rolled { t.panel_header } else { t.icon_fill },
+ if rolled { t.border } else { t.accent },
+ );
+ if *suppressed {
+ p.line_segment([br.left_bottom() + vec2(4.0, -4.0), br.right_top() + vec2(-4.0, 4.0)], Stroke::new(1.5, t.text_dim));
+ }
+ // A failed feature has a mark of its own, not only its colour (#972).
+ if err.is_some() {
+ icons::paint(&p, Rect::from_min_size(br.right_top() - vec2(10.0, 0.0), vec2(10.0, 10.0)), "error", t.panel, t.error, t.error);
+ }
+ if warn.is_some() && err.is_none() {
icons::paint(
&p,
- br.shrink(4.0),
- icon,
- ink,
- if rolled { t.panel_header } else { t.icon_fill },
- if rolled { t.border } else { t.accent },
+ Rect::from_min_size(br.right_top() - vec2(10.0, 0.0), vec2(10.0, 10.0)),
+ "warning",
+ t.icon,
+ t.warning,
+ t.warning,
);
- if *suppressed {
- p.line_segment([br.left_bottom() + vec2(4.0, -4.0), br.right_top() + vec2(-4.0, 4.0)], Stroke::new(1.5, t.text_dim));
- }
- // A failed feature has a mark of its own, not only its colour (#972).
- if err.is_some() {
- icons::paint(&p, Rect::from_min_size(br.right_top() - vec2(10.0, 0.0), vec2(10.0, 10.0)), "error", t.panel, t.error, t.error);
+ }
+ let mut tip = format!("{name} ({ty})");
+ if let Some(e) = &err {
+ tip += &format!("\nError: {e}");
+ }
+ if let Some(w) = &warn {
+ tip += &format!("\nWarning: {w}");
+ }
+ if let Some(r) = res {
+ tip += &format!("\n{:.1} ms", r.ms);
+ }
+ tip += "\nDouble-click to edit · drag to reorder · right-click for more";
+ if resp.drag_started() {
+ drag = Some(Drag::Feature(*id));
+ }
+ let resp = resp.on_hover_text(tip);
+ if resp.clicked() {
+ // A dialog input that takes features (pattern objects) gets the click.
+ let takes = app.dialog.as_ref().and_then(|d| d.active_input()).is_some_and(|i| i.accept & crate::selection::FEATURES != 0);
+ if takes {
+ if let Some(mut d) = app.dialog.take() {
+ d.pick(&app.session, solidcraft_engine::Sel::Feature { id: *id });
+ app.dialog = Some(d);
+ }
+ } else if ui.input(|i| i.modifiers.command || i.modifiers.ctrl) {
+ toggle_feature(app, *id);
+ } else {
+ app.tree.picked_joints.clear();
+ app.tree.picked_timeline_groups.clear();
+ let _ = app.run("select.set", json!({"items": [{"type": "feature", "id": id}]}));
}
- if warn.is_some() && err.is_none() {
- icons::paint(
- &p,
- Rect::from_min_size(br.right_top() - vec2(10.0, 0.0), vec2(10.0, 10.0)),
- "warning",
- t.icon,
- t.warning,
- t.warning,
- );
+ }
+ if resp.double_clicked() {
+ edit = Some(*id);
+ }
+ let sketch_of = kind.profile_sketch();
+ resp.context_menu(|ui| {
+ if ui.button(crate::i18n::tr_label("Edit Feature")).clicked() {
+ edit = Some(*id);
+ ui.close();
}
- let mut tip = format!("{name} ({ty})");
- if let Some(e) = &err {
- tip += &format!("\nError: {e}");
+ if let Some(sk) = sketch_of
+ && ui.button(crate::i18n::tr_label("Edit Profile Sketch")).clicked()
+ {
+ app.edit_sketch(sk.0);
+ ui.close();
}
- if let Some(w) = &warn {
- tip += &format!("\nWarning: {w}");
+ if ui.button(crate::i18n::tr_label("Rename")).clicked() {
+ app.dialog = Some(crate::dialogs::Dialog::rename(*id, name));
+ ui.close();
}
- if let Some(r) = res {
- tip += &format!("\n{:.1} ms", r.ms);
+ if ui.button(if *suppressed { "Unsuppress Features" } else { "Suppress Features" }).clicked() {
+ let _ = app.run_heavy("timeline.suppress", json!({"feature": id}));
+ ui.close();
}
- tip += "\nDouble-click to edit · drag to reorder · right-click for more";
- if resp.drag_started() {
- drag = Some(Drag::Feature(*id));
+ if ui.button(crate::i18n::tr_label("Roll History Marker Here")).clicked() {
+ let _ = app.run_heavy("timeline.roll_to", json!({ "feature": id }));
+ ui.close();
}
- let resp = resp.on_hover_text(tip);
- if resp.clicked() {
- // A dialog input that takes features (pattern objects) gets the click.
- let takes = app.dialog.as_ref().and_then(|d| d.active_input()).is_some_and(|i| i.accept & crate::selection::FEATURES != 0);
- if takes {
- if let Some(mut d) = app.dialog.take() {
- d.pick(&app.session, solidcraft_engine::Sel::Feature { id: *id });
- app.dialog = Some(d);
- }
- } else if ui.input(|i| i.modifiers.command || i.modifiers.ctrl) {
- toggle_feature(app, *id);
- } else {
- app.tree.picked_joints.clear();
- app.tree.picked_timeline_groups.clear();
- let _ = app.run("select.set", json!({"items": [{"type": "feature", "id": id}]}));
- }
+ if ui.button(crate::i18n::tr_label("Find in Browser")).clicked() {
+ find_in_browser(app, *id);
+ ui.close();
}
- if resp.double_clicked() {
- edit = Some(*id);
+ ui.separator();
+ clipboard_buttons(app, ui, *id);
+ message_button(app, ui, *id);
+ ui.separator();
+ if ui.button("Delete").clicked() {
+ delete_feature(app, *id);
+ ui.close();
}
- let sketch_of = kind.profile_sketch();
- resp.context_menu(|ui| {
- if ui.button(crate::i18n::tr_label("Edit Feature")).clicked() {
- edit = Some(*id);
- ui.close();
- }
- if let Some(sk) = sketch_of
- && ui.button(crate::i18n::tr_label("Edit Profile Sketch")).clicked()
- {
- app.edit_sketch(sk.0);
- ui.close();
- }
- if ui.button(crate::i18n::tr_label("Rename")).clicked() {
- app.dialog = Some(crate::dialogs::Dialog::rename(*id, name));
- ui.close();
- }
- if ui.button(if *suppressed { "Unsuppress Features" } else { "Suppress Features" }).clicked() {
- let _ = app.run_heavy("timeline.suppress", json!({"feature": id}));
- ui.close();
- }
- if ui.button(crate::i18n::tr_label("Roll History Marker Here")).clicked() {
- let _ = app.run_heavy("timeline.roll_to", json!({ "feature": id }));
- ui.close();
- }
- if ui.button(crate::i18n::tr_label("Find in Browser")).clicked() {
- find_in_browser(app, *id);
- ui.close();
- }
- ui.separator();
- clipboard_buttons(app, ui, *id);
- message_button(app, ui, *id);
- ui.separator();
- if ui.button("Delete").clicked() {
- delete_feature(app, *id);
- ui.close();
- }
- });
- x += 32.0;
- }
- let end = x;
- if marker >= feats.len() {
- marker_rect = Some(Rect::from_min_size(pos2(x, r.top() + 5.0), vec2(6.0, r.height() - 10.0)));
+ });
+ x += 32.0;
+ }
+ let end = x;
+ if marker >= feats.len() {
+ marker_rect = Some(Rect::from_min_size(pos2(x, r.top() + 5.0), vec2(6.0, r.height() - 10.0)));
+ }
+ // The history marker: drag it to roll the model back or forward.
+ if let Some(mr) = marker_rect {
+ crate::scenario::publish_rect("history:marker", mr);
+ let resp = ui.interact(mr.expand2(vec2(3.0, 0.0)), ui.id().with("tl_marker"), Sense::drag());
+ if resp.drag_started() {
+ drag = Some(Drag::Marker);
}
- // The history marker: drag it to roll the model back or forward.
- if let Some(mr) = marker_rect {
- let resp = ui.interact(mr.expand2(vec2(3.0, 0.0)), ui.id().with("tl_marker"), Sense::drag());
- if resp.drag_started() {
- drag = Some(Drag::Marker);
+ let col = if resp.hovered() || drag == Some(Drag::Marker) {
+ accent.color
+ } else if !floating && accent.color == t.accent {
+ t.timeline_marker
+ } else {
+ accent.color
+ };
+ p.rect_filled(mr, 1.0, col);
+ resp.on_hover_text("History marker: drag to roll the model back; new features go here");
+ }
+ let content_end = crate::dialogs_assembly::timeline_joints(app, ui, &p, end + 10.0, r);
+ // The scroll range follows the drawn content (the buttons don't take layout space themselves).
+ ui.allocate_exact_size(vec2((content_end - origin).max(0.0), r.height()), Sense::hover());
+ // Drag feedback, and the drop.
+ if let (Some(dg), Some(pp)) = (drag.as_ref(), pointer) {
+ let slot = slot_at(&xs, end, pp.x);
+ let sx = xs.get(slot).copied().unwrap_or(end) - 4.0;
+ p.line_segment(
+ [pos2(sx, r.top() + 3.0), pos2(sx, r.bottom() - 3.0)],
+ Stroke::new(2.0, if matches!(dg, Drag::Marker) { accent.color } else { t.sketch_accent }),
+ );
+ }
+ let released = ui.input(|i| i.pointer.any_released());
+ // (Taking the drag ends it even when the pointer has left the window.)
+ if released
+ && let Some(dg) = drag.take()
+ && let Some(pp) = pointer
+ {
+ let slot = slot_at(&xs, end, pp.x);
+ match dg {
+ Drag::Marker => {
+ let _ = app.run_heavy("timeline.roll_to", if slot >= n { json!({}) } else { json!({ "position": slot }) });
}
- let col = if resp.hovered() || drag == Some(Drag::Marker) {
- accent.color
- } else if accent.color == t.accent {
- t.timeline_marker
- } else {
- accent.color
- };
- p.rect_filled(mr, 1.0, col);
- resp.on_hover_text("History marker: drag to roll the model back; new features go here");
- }
- let content_end = crate::dialogs_assembly::timeline_joints(app, ui, &p, end + 10.0, r);
- // The scroll range follows the drawn content (the buttons don't take layout space themselves).
- ui.allocate_exact_size(vec2((content_end - origin).max(0.0), r.height()), Sense::hover());
- // Drag feedback, and the drop.
- if let (Some(dg), Some(pp)) = (drag.as_ref(), pointer) {
- let slot = slot_at(&xs, end, pp.x);
- let sx = xs.get(slot).copied().unwrap_or(end) - 4.0;
- p.line_segment(
- [pos2(sx, r.top() + 3.0), pos2(sx, r.bottom() - 3.0)],
- Stroke::new(2.0, if matches!(dg, Drag::Marker) { accent.color } else { t.sketch_accent }),
- );
- }
- let released = ui.input(|i| i.pointer.any_released());
- // (Taking the drag ends it even when the pointer has left the window.)
- if released
- && let Some(dg) = drag.take()
- && let Some(pp) = pointer
- {
- let slot = slot_at(&xs, end, pp.x);
- match dg {
- Drag::Marker => {
- let _ = app.run_heavy("timeline.roll_to", if slot >= n { json!({}) } else { json!({ "position": slot }) });
- }
- Drag::Feature(id) => {
- let from = app.session.doc.feature_index(id).unwrap_or(0);
- // Dropping after itself means the slot shifts by one.
- let to = if slot > from { slot - 1 } else { slot };
- if to != from {
- let _ = app.run_heavy("timeline.reorder", json!({ "feature": id, "position": to }));
- }
+ Drag::Feature(id) => {
+ let from = app.session.doc.feature_index(id).unwrap_or(0);
+ // Dropping after itself means the slot shifts by one.
+ let to = if slot > from { slot - 1 } else { slot };
+ if to != from {
+ let _ = app.run_heavy("timeline.reorder", json!({ "feature": id, "position": to }));
}
}
}
- ui.data_mut(|d| match drag {
- Some(dg) => {
- d.insert_temp(drag_id, dg.clone());
- }
- None => d.remove::<Drag>(drag_id),
- });
- app.viewport.hover_feature = hovered;
- if let Some(id) = edit {
- app.edit_feature(id);
+ }
+ ui.data_mut(|d| match drag {
+ Some(dg) => {
+ d.insert_temp(drag_id, dg.clone());
}
+ None => d.remove::<Drag>(drag_id),
});
+ app.viewport.hover_feature = hovered;
+ if let Some(id) = edit {
+ app.edit_feature(id);
+ }
});
});
}
@@ -748,4 +785,74 @@ mod tests {
let first = h.app.session.doc.find_feature("First").map(|f| f.id).unwrap();
assert_eq!(super::selected_feature_ids(&h.app), [first]);
}
+ #[test]
+ fn both_strips_keep_selection_reorder_marker_and_transport() {
+ use crate::scenario::{handle_at, rect_of};
+ for mode in [crate::shell::LayoutMode::Floating, crate::shell::LayoutMode::Docked] {
+ let mut h = two_boxes(false);
+ h.app.ui.layout = mode;
+ h.settle();
+ let viewport = h.app.viewport.rect.unwrap();
+ if mode == crate::shell::LayoutMode::Floating {
+ assert_eq!(rect_of("history:card").unwrap().bottom(), viewport.bottom() - crate::shell::SHELL_GAP);
+ } else {
+ let strip = rect_of("history:strip").unwrap();
+ assert_eq!(strip.top(), viewport.bottom());
+ assert_eq!(strip.bottom(), h.ctx.content_rect().bottom());
+ assert_eq!(strip.left(), 0.0);
+ assert_eq!(strip.height(), 40.0);
+ }
+ h.step(&json!({"click":{"handle":"timeline:First"}})).unwrap();
+ h.step(&json!({"click":{"handle":"timeline:Second"},"ctrl":true})).unwrap();
+ assert_eq!(super::selected_feature_ids(&h.app).len(), 2);
+ let first = handle_at("timeline:First").unwrap();
+ let second = handle_at("timeline:Second").unwrap();
+ h.step(&json!({"drag":[[second.x,second.y],[first.x-12.0,first.y]]})).unwrap();
+ h.settle();
+ assert_eq!(h.app.session.doc.features.first().unwrap().name, "Second");
+ let first = handle_at("timeline:Second").unwrap();
+ let marker = rect_of("history:marker").unwrap().center();
+ h.step(&json!({"drag":[[marker.x,marker.y],[first.x-12.0,first.y]]})).unwrap();
+ h.settle();
+ assert_eq!(h.app.session.doc.marker, Some(0));
+ h.step(&json!({"click":{"handle":"history:forward"}})).unwrap();
+ h.settle();
+ assert_eq!(h.app.session.doc.marker, Some(1));
+ h.step(&json!({"click":{"handle":"history:last"}})).unwrap();
+ h.settle();
+ assert_eq!(h.app.session.doc.marker, None);
+ }
+ }
+ #[test]
+ fn floating_strip_has_only_history_text_and_accents_the_last_done_chip_and_marker() {
+ let mut h = two_boxes(false);
+ h.app.ui.tab = "SURFACE".into();
+ let t = crate::theme::Tokens::get();
+ let accent = crate::theme::TabAccent::for_tab(&t, "SURFACE");
+ let ctx = egui::Context::default();
+ let mut out = ctx.run_ui(egui::RawInput::default(), |ui| super::timeline(&mut h.app, ui));
+ out.textures_delta.clear();
+ let texts: Vec<_> = out
+ .shapes
+ .iter()
+ .filter_map(|s| match &s.shape {
+ egui::Shape::Text(text) => Some(text.galley.text()),
+ _ => None,
+ })
+ .collect();
+ assert_eq!(texts, ["History"]);
+ let chips: Vec<_> = out
+ .shapes
+ .iter()
+ .filter_map(|s| match &s.shape {
+ egui::Shape::Rect(r) if r.rect.size() == egui::vec2(28.0, 28.0) => Some(r),
+ _ => None,
+ })
+ .collect();
+ assert_eq!(chips.len(), 2);
+ assert_eq!(chips.last().unwrap().fill, accent.soft);
+ assert_eq!(chips.last().unwrap().stroke.color, accent.color);
+ let marker = crate::scenario::rect_of("history:marker").unwrap();
+ assert!(out.shapes.iter().any(|s| matches!(&s.shape, egui::Shape::Rect(r) if r.rect == marker && r.fill == accent.color)));
+ }
}
diff --git a/crates/ui-egui/src/timeline_left.rs b/crates/ui-egui/src/timeline_left.rs
index dfd22df38a..c4428dab69 100644
--- a/crates/ui-egui/src/timeline_left.rs
+++ b/crates/ui-egui/src/timeline_left.rs
@@ -979,18 +979,27 @@ mod tests {
#[test]
fn floating_browser_sits_over_the_workspace_and_docks_again() {
- let mut harness = Harness::new();
- harness.app.preferences.browser_float = true;
- harness.frames(4);
- let card = crate::scenario::rect_of("browser:float").expect("the floating browser is drawn");
- assert!(card.min.x < 40.0, "the card sits at the view's left edge: {card:?}");
- assert!(handle_at("left-browser-rail").is_none(), "a floating browser must not take a column of the window");
- assert!(handle_at("row:Untitled").is_some(), "the tree is still drawn and usable");
-
- harness.app.preferences.browser_float = false;
- harness.frames(4);
- assert!(crate::scenario::rect_of("browser:float").is_none(), "docking again removes the card");
- assert!(handle_at("left-browser-rail").is_some(), "the docked sidebar is back");
+ for mode in [crate::shell::LayoutMode::Floating, crate::shell::LayoutMode::Docked] {
+ let mut harness = Harness::new();
+ harness.app.ui.layout = mode;
+ harness.app.preferences.browser_float = true;
+ harness.frames(4);
+ let card = crate::scenario::rect_of("browser:float").expect("the floating browser is drawn");
+ assert!(card.min.x < 40.0, "the card sits at the view's left edge: {card:?}");
+ assert_eq!(harness.app.viewport.rect.unwrap().left(), 0.0, "a floating browser must not take a column");
+ assert!(handle_at("left-browser-rail").is_some(), "the card retains the saved-width drag grip");
+ assert!(handle_at("row:Untitled").is_some(), "the tree is still drawn and usable");
+
+ harness.app.preferences.browser_float = false;
+ harness.frames(4);
+ assert!(crate::scenario::rect_of("browser:float").is_none(), "the explicit overlay is off");
+ assert_eq!(crate::scenario::rect_of("browser:card").is_some(), mode == crate::shell::LayoutMode::Floating);
+ assert_eq!(
+ harness.app.viewport.rect.unwrap().left(),
+ if mode == crate::shell::LayoutMode::Docked { harness.app.preferences.browser_width } else { 0.0 }
+ );
+ assert!(handle_at("left-browser-rail").is_some(), "both card and sidebar resize");
+ }
}
#[test]
diff --git a/crates/ui-egui/src/viewport.rs b/crates/ui-egui/src/viewport.rs
index cf0840a26b..3e04865cff 100644
--- a/crates/ui-egui/src/viewport.rs
+++ b/crates/ui-egui/src/viewport.rs
@@ -2982,7 +2982,7 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {
if let Some(since) = app.computing_since() {
let seconds = ((crate::now_ms() - since) / 1000.0).floor().max(0.0);
let text = crate::i18n::format("dialog.computing", &[("seconds", &format!("{seconds:.0}"))]);
- let pos = pos2(crate::shell::content_rect(app, rect).left() + 12.0, rect.bottom() - 76.0);
+ let pos = pos2(crate::shell::content_rect(app, rect).left() + 12.0, crate::shell::content_rect(app, rect).bottom() - 76.0);
let galley = painter.layout_no_wrap(text, FontId::proportional(t.font_label), t.text);
let r = Rect::from_min_size(pos, galley.size() + vec2(34.0, 8.0));
painter.rect_filled(r, t.radius_sm, t.overlay);
@@ -2993,7 +2993,7 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {
// Status chip.
if let Some((msg, at, err)) = app.status.clone() {
if crate::now_ms() - at < 6000.0 {
- let pos = pos2(crate::shell::content_rect(app, rect).left() + 12.0, rect.bottom() - 46.0);
+ let pos = pos2(crate::shell::content_rect(app, rect).left() + 12.0, crate::shell::content_rect(app, rect).bottom() - 46.0);
let galley = painter.layout_no_wrap(msg, FontId::proportional(t.font_label), if err { t.error } else { t.text });
let r = Rect::from_min_size(pos, galley.size() + vec2(16.0, 8.0));
painter.rect_filled(r, t.radius_sm, t.overlay);
@@ -5945,21 +5945,28 @@ mod tests {
h.call("ui.move", field.clone());
h.call("ui.click", field);
assert!(handle_at(item).is_none(), "the list must close");
- // The full floating viewport extends under the browser; its exposed content
- // edge is the boundary between the panel and navigable model in either layout.
- let content = crate::shell::content_rect(&h.app, vp);
- let (mid, x) = (content.center().y, content.left() + content.width() * 0.25);
+ // Floating cards sit inside the full viewport. Probe their actual edges; the
+ // content anchor also reserves gaps and space below the short browser card.
+ // Docked panels end at the viewport boundary instead.
+ let (browser_edge, mid, history_edge) = if layout == crate::shell::LayoutMode::Floating {
+ let browser = h.app.shell.browser.expect("the floating browser card");
+ let history = h.app.shell.history.expect("the floating history card");
+ (browser.right(), browser.center().y, history.top())
+ } else {
+ (vp.left(), vp.center().y, vp.bottom())
+ };
+ let x = vp.center().x;
for p in [
pos2(dialog.left() + 2.0, dialog.center().y),
pos2(dialog.center().x, dialog.bottom() - 2.0),
- pos2(content.left() - 2.0, mid),
- pos2(x, vp.bottom() + 2.0),
+ pos2(browser_edge - 2.0, mid),
+ pos2(x, history_edge + 2.0),
] {
assert!(!wheel(&mut h, p, 60.0), "smooth {smooth}: the wheel at {p:?} off the model ({vp:?}, dialog {dialog:?}) zoomed it");
assert!(h.app.viewport.mouse.is_none(), "the model must not see the pointer at {p:?}");
}
// The model itself still zooms right next to them.
- for p in [pos2(dialog.left() - 2.0, dialog.center().y), pos2(content.left() + 2.0, mid), pos2(x, vp.bottom() - 2.0)] {
+ for p in [pos2(dialog.left() - 2.0, dialog.center().y), pos2(browser_edge + 2.0, mid), pos2(x, history_edge - 2.0)] {
assert!(wheel(&mut h, p, 60.0), "smooth {smooth}: the wheel at {p:?} on the model ({vp:?}) must zoom it");
assert_eq!(h.app.viewport.mouse, Some(p));
assert!(gestures(&mut h, p), "a pinch and a two-finger scroll at {p:?} on the model must move it");
@@ -6214,6 +6221,8 @@ mod tests {
h.app.ui.perspective = perspective;
h.app.run("solid.box", json!({"length":80,"width":50,"height":20})).unwrap();
h.app.fit_view();
+ // Fit resolves after measuring the floating browser and history cards.
+ h.frames(2);
let rect = h.app.viewport.rect.unwrap();
let at = rect.center() + offset;
let proj = projection(&h.app, rect);
diff --git a/crates/ui-egui/src/viewport_layout_tests.rs b/crates/ui-egui/src/viewport_layout_tests.rs
index 060fcdfb71..7372feffa5 100644
--- a/crates/ui-egui/src/viewport_layout_tests.rs
+++ b/crates/ui-egui/src/viewport_layout_tests.rs
@@ -326,3 +326,29 @@ fn tiny_viewports_never_overlap_navigation_and_axis_view() {
}
}
}
+
+#[test]
+fn floating_fit_uses_the_measured_browser_and_history_cards_at_each_size() {
+ for (width, height) in [(1400, 900), (900, 720), (700, 475)] {
+ let mut h = Harness::new();
+ h.call("ui.resize", json!({"width":width,"height":height}));
+ h.app.run("solid.box", json!({"length":40,"width":30,"height":20})).unwrap();
+ h.settle();
+ h.app.fit_view();
+ h.settle();
+ let layout = h.app.viewport.layout.as_ref().unwrap();
+ for name in ["browser:card", "history:card"] {
+ let card = crate::scenario::rect_of(name).unwrap();
+ assert!(layout.viewport.contains_rect(card), "{name}: {card:?} {layout:?}");
+ assert!(!layout.drawable.intersect(card).is_positive(), "{name}: {card:?} {layout:?}");
+ }
+ let projection = crate::viewport::projection(&h.app, layout.viewport);
+ for x in [0.0, 40.0] {
+ for y in [0.0, 30.0] {
+ for z in [0.0, 20.0] {
+ assert!(layout.drawable.contains(projection.to_screen(Vec3::new(x, y, z)).unwrap()), "{layout:?}");
+ }
+ }
+ }
+ }
+}
diff --git a/crates/ui-egui/src/workspace.rs b/crates/ui-egui/src/workspace.rs
index b6c2ca324f..1b86c6d970 100644
--- a/crates/ui-egui/src/workspace.rs
+++ b/crates/ui-egui/src/workspace.rs
@@ -664,7 +664,7 @@ mod tests {
h.step(&json!({"key":"Enter"})).unwrap();
assert_eq!(h.app.ui.tab, "MANAGE");
h.step(&json!({"key":"Escape"})).unwrap();
- crate::palette::submit(&mut h.app, "parameters.change");
+ h.app.start("parameters.change");
assert_eq!(h.app.ui.tab, "MANAGE");
h.frames(2);
for tab in TABS {
diff --git a/crates/ui-egui/tests/scenarios/s37_browser_chevrons.json b/crates/ui-egui/tests/scenarios/s37_browser_chevrons.json
index cff6376757..c151e7ae9d 100644
--- a/crates/ui-egui/tests/scenarios/s37_browser_chevrons.json
+++ b/crates/ui-egui/tests/scenarios/s37_browser_chevrons.json
@@ -318,6 +318,17 @@
]
}
},
+ {
+ "note": "Expanded rows now scroll within the floating card, above the History strip."
+ },
+ {
+ "call": "ui.scroll",
+ "params": {
+ "x": 150,
+ "y": 500,
+ "delta": -220
+ }
+ },
{
"expect": {
"shown_handles": [
@@ -435,6 +446,14 @@
"handle": "fold:Component2:1"
}
},
+ {
+ "call": "ui.scroll",
+ "params": {
+ "x": 150,
+ "y": 500,
+ "delta": -180
+ }
+ },
{
"expect": {
"shown_handles": [
@@ -473,6 +492,14 @@
]
}
},
+ {
+ "call": "ui.scroll",
+ "params": {
+ "x": 150,
+ "y": 500,
+ "delta": 1200
+ }
+ },
{
"expect": {
"shown_handles": [
diff --git a/crates/ui-egui/tests/scenarios/sketch_mirror_dialog.json b/crates/ui-egui/tests/scenarios/sketch_mirror_dialog.json
index df7b2b6e79..ae729b9f19 100644
--- a/crates/ui-egui/tests/scenarios/sketch_mirror_dialog.json
+++ b/crates/ui-egui/tests/scenarios/sketch_mirror_dialog.json
@@ -7,6 +7,8 @@
{"call":"ui.view","params":{"view":"top"}},
{"start":"sketch.mirror"},
{"expect":{"dialog":"SketchModify(Mirror)","tool":null}},
+ {"note":"Fit after the floating panels are measured so both entity picks remain exposed beside the left dialog."},
+ {"call":"ui.view","params":{"view":"fit"}},
{"click":{"sketch":[-22.5,10]}},
{"click":{"sketch":[-15,17.5]}},
{"click":{"sketch":[-22.5,10]},"ctrl":true},
diff --git a/crates/ui-egui/tests/window_widths.rs b/crates/ui-egui/tests/window_widths.rs
index 2f704929d5..ef624db767 100644
--- a/crates/ui-egui/tests/window_widths.rs
+++ b/crates/ui-egui/tests/window_widths.rs
@@ -5,13 +5,13 @@ use serde_json::json;
use solidcraft_ui_egui::frame::{DIALOG_MAX_W, DIALOG_MIN_W, DIALOG_WIDE_MAX_W, WINDOW_WIDE_MAX_W};
use solidcraft_ui_egui::scenario::Harness;
-/// Widths of the windows on screen (their areas in the middle layer).
+/// Widths of dialogs and windows on screen; the browser card is workspace chrome.
fn window_widths(h: &Harness) -> Vec<(String, f32)> {
h.ctx.memory(|m| {
m.areas()
.visible_layer_ids()
.into_iter()
- .filter(|l| l.order == egui::Order::Middle)
+ .filter(|l| l.order == egui::Order::Middle && l.id != egui::Id::new("sc_browser_card"))
.filter_map(|l| m.area_rect(l.id).map(|r| (format!("{:?}", l.id), r.width())))
.collect()
})
diff --git a/docs/ribbon-layout.md b/docs/ribbon-layout.md
index ed095e2dfc..9dff1b837e 100644
--- a/docs/ribbon-layout.md
+++ b/docs/ribbon-layout.md
@@ -134,7 +134,7 @@ Section labels retain `panel:<tab>:<section>` and collapsed sections retain `col
The ribbon is a full-width surface immediately below the 34 px application bar, with no outer gap or rounding. `toolbar::{TAB_ROW_HEIGHT,GROUP_HEIGHT,RIBBON_HEIGHT}` reserve 30 + 86 + 1 px; browser and viewport placement follows the panel allocation. The workspace column is 88 px wide. Promoted buttons are 54 × 60 px with 3 px gaps (Sketch Create retains wider family selectors). Section labels occupy a 20 px row, inset 3 px, and retain the existing command lists, pin actions and drag targets.
-Tab labels use normal word casing. Selected standard tabs use their soft accent; contextual tabs use their solid accent and add a row-wide line when selected. The existing `TabAccent` helper supplies all selection colours. Search is a 188 × 24 px launcher for the S box, using the existing `zoom` magnifier; it shrinks to 24 px before the tabs scroll horizontally. The selected tab scrolls into view after a context change or resize. Clicking Search or pressing S anchors the existing search popup below the field. The bottom command line remains available.
+Tab labels use normal word casing. Selected standard tabs use their soft accent; contextual tabs use their solid accent and add a row-wide line when selected. The existing `TabAccent` helper supplies all selection colours. Search is a 188 × 24 px launcher for the S box, using the existing `zoom` magnifier; it shrinks to 24 px before the tabs scroll horizontally. The selected tab scrolls into view after a context change or resize. Clicking Search or pressing S anchors the existing search popup below the field. The bottom command line is gone: the S box (and the ribbon search field) runs a command id typed with JSON parameters, e.g. `solid.extrude {"distance": 20}`, when you press Enter.
Sketch's Finish group reserves space at the far right even when other groups collapse. Its unfilled Finish Sketch button uses the existing `finish` icon. The chevron-free Exit row still opens the existing command list, preserving Finish with Auto-Constrain and saved pin customizations.
@@ -147,3 +147,12 @@ The workspace popup is 470 px wide, anchored below the workspace column. Design
Section lists use 30 px command rows, 20 px semantic icons, monospace shortcuts, hover pins and a pinning footer. `workspace::groups` optionally supplies headings and command order. MODEL / MODIFY uses EDGES, FACES, BODIES and SPECIALISE; unlisted commands follow the final heading in their original order. This ordering does not change promoted buttons or saved pins.
Ribbon tooltips show the full command name in bold and its registered shortcut in a key cap. Existing Render catalog descriptions are reused; commands without prose descriptions show the header alone (and their existing disabled reason when applicable). Registry parameter syntax is not presented as a description.
+
+
+The floating shell uses one Browser card with a title, body count and fold button. Its right
+edge resizes the same saved browser width as the Docked sidebar. The Browser preference
+“Float it over the workspace” switches the Docked sidebar to this card; in the Floating shell
+it keeps the card and enables the translucent overlay surface. With the left history enabled,
+the browser stays below that history unless the overlay preference is enabled, in which case
+only the history keeps its column. The bottom History card leaves a gap beneath the browser;
+the full viewport remains available through the gaps and below a short browser.