* Vertical history strip: left of the browser, compact rows, hollow-circle marker, collapsed rail hover * Vertical history strip: seam handle to expand and collapse names, drag to resize with snap * Vertical history strip: no empty gap below the transport * Show the history seam arrow only on hover (#2028) * Extract a shared panel drag grip * Rebuild responsive history sizing and three-way docking * Share browser and History collapse hover styling * Show the History title as soon as its text fits * Animate stacked browser and History expansion and collapse * Make panel folding responsive and independent of frame delays * Let folding panel contents shrink continuously to header height * Use four explicit History transport actions in every layout * Resize the shared Browser and History column from either card
This commit is contained in:
1 parent
9acff62422
commit
63f210b49f
45 files changed
+2232
-380
No files matched your search
+1
-1
@@ -55,7 +55,7 @@ PCB / Package, Render, Animation, Simulation, Manufacture/CAM, Drawings.
|
||||
| M3 | General fillets and chamfers (curved edges, chains, vertex blends); saddle rolling-ball surfaces now use continuous seam sections and arc-length fitting with shared contact boundaries and bounded accuracy checks; tiny rim edges remain selected instead of nearby wall seams when filleting (#2498) | in progress | 30 |
|
||||
| M4 | Files: STEP import (done — [docs/step-import.md](docs/step-import.md)), FreeCAD/Rhino solids through cadmpeg (done, desktop and CLI), 3MF export and 3MF/STL import as mesh bodies (done), 3MF with B-rep face tags ([docs/formats/3mf-face-tags.md](docs/formats/3mf-face-tags.md), done), constant-section parametric mesh reconstruction, DXF sketches, OBJ import | in progress | 6 |
|
||||
| M5 | Persistent naming of faces and edges (docs/book/src/dev/naming.md): faces named from their exact kernel-reported history (sketch curve sides, caps, revolve sections, primitive sides, blends, shell inner walls, pattern/mirror copies; split pieces told apart by the faces around them, lumps of a cut body named after their faces), edges by their faces; fillets/chamfers, sketches on faces, shell/draft/offset/replace faces, hole placements, joint origins and face appearances resolve by name first and warn when the entity split or vanished: done. sheet metal edges by base sketch line and flange side, shell inner faces, sweep and loft roles: done. kernel-reported face history: done (merged faces answer to every name; operations without history yet fall back to geometric names, flagged unverified; format 14 keeps older designs' geometric names). Left: history through sheet metal, plastic, surface and emboss features; FaceSource certificates through history | in progress | 20 |
|
||||
| M6 | UI depth: selection feedback and origin (done), timeline editing (done: hover and selection highlight modifier faces, including fillets and chamfers; edit feature, history marker drag, dependency-checked single and multi-item reorder, suppress, rename, delete with dependents, re-resolved references; redefining selections refreshes persistent edge/face references while retaining feature identity and dimension names; optional compact named left feature history with rollback bar, multi-selection and persistent folders above the parts browser), right-docked dialogs (done), live previews for every feature dialog (done), keyboard-first commands with on-canvas value boxes and sketch inline dimensions (done), drag manipulators with automatic join/cut (done: extrude incl. two sides, fillet, shell, hole depth, move, pattern spacing, revolve rotator, extrude taper), dark theme (done), right-click menu with Repeat (done), measure tool (done), section analysis (done), selection filter (done), drag-solve of sketch points (done); appearance controls now preserve body/face/component targeting, named transparent looks, reuse/search and override removal; preferences | in progress | 6 |
|
||||
| M6 | UI depth: selection feedback and origin (done), timeline editing (done: hover and selection highlight modifier faces, including fillets and chamfers; edit feature, history marker drag, dependency-checked single and multi-item reorder, suppress, rename, delete with dependents, re-resolved references; redefining selections refreshes persistent edge/face references while retaining feature identity and dimension names; responsive feature history with width-driven icons/names/title, snapping width resize, bottom/left/browser-stack docking, shared-column collapse, rollback bar, multi-selection and persistent folders), right-docked dialogs (done), live previews for every feature dialog (done), keyboard-first commands with on-canvas value boxes and sketch inline dimensions (done), drag manipulators with automatic join/cut (done: extrude incl. two sides, fillet, shell, hole depth, move, pattern spacing, revolve rotator, extrude taper), dark theme (done), right-click menu with Repeat (done), measure tool (done), section analysis (done), selection filter (done), drag-solve of sketch points (done); appearance controls now preserve body/face/component targeting, named transparent looks, reuse/search and override removal; preferences | in progress | 6 |
|
||||
| M7 | Thin extrude (walls along open or closed curves: centre, inside, outside or two sides; mitred corners, crossing walls joined; #721), sweep, loft (incl. to a point), rib and web (to next / depth), emboss (planar faces and exact radial emboss/deboss of bounded orthogonal profiles on complete exterior cylinders/sleeves), thread (cosmetic, and modelled M3–M20 outside and inside: the ISO profile screwed in as a faceted cut), coil (smooth B-spline helical walls), pipe, pattern on path, patterns of bodies and components, replace face (parallel), align, remove, feature copy/paste: done. Unique eligible cylindrical targets are inferred for new Emboss features. Left: general curved-face emboss and exact (unfaceted) modelled threads | in progress | 12 |
|
||||
| M8 | Surface workspace (#772). Done: Patch (sketch regions; edge loops filled G0, plus `crown`), Stitch, Thicken (planes and cylinders), Extend (straight edges of planar surfaces), Trim (by a plane, a face or sketch curves swept onto the surface, keeping a side or the picked regions; mutual trim of two surfaces, extended to meet and stitched, #767), Delete Face (healing), Boundary Fill, zebra/draft/curvature-map analysis, Surface Extrude/Revolve/Sweep/Loft from open and closed curves, Offset, Unstitch and Reverse Normal; the continuity-driven core (`kernel/src/bridge.rs`, G0–G3 Hermite rows) with **Blend** (`surface.blend`, #764: edge chains along one or several faces, closed rims paired seam to seam or from picked seams, a dialog), **Match** (`surface.match`), **Boundary** (`surface.boundary`, #763 — two sketch curves exact with G0–G3, three or four as the flat patch of their loop, and curve networks: Coons and Gordon surfaces through sketch, 3D-sketch or edge curves, a point for a three-sided side, G1/G2 against the faces along one direction's edges, joined into their body on request; G1/G2 on two sides that meet at a corner waits for the Gregory-type corner), **Fair** (`surface.fair`, CV fairing), **continuity analysis** (`inspect.continuity`, #770; a toolbar tool with edge markers and a legend, and curvature combs along face isocurves) and a multi-section **loft** with per-end continuity and crown, and guide rails on solid and surface lofts (one or two, scaling or stretching the sections between; #201). Also in the Class-A pass: G1…G4 blend curves in the sketch, chord and variable-radius fillets on curved edges (with honest refusals where the fit cannot hold), and a G2 corner patch where filleted edges meet (kernel; the command refuses until the patch's sections can be sewn to the blends' contacts). Left: bias/form-factor fillet sections (design recorded), a Gregory-type corner, surface Fillet between separate surface bodies (#769), Ruled (#762), Untrim (#761), curved-face Extend (#760), and every remaining #757–#772 item | deferred | — |
|
||||
| M9 | Components and assemblies: New Component / Create Components from Bodies, active component, per-component origin/bodies/sketches/timeline entries, occurrences with transforms, Copy/Paste vs Paste New, nested Browser tree with visibility and isolate; Ground, Move/Copy of occurrences, joints (rigid, revolute, slider, cylindrical, pin-slot, planar, ball) by joint origins with limits and Drive Joints, closed kinematic loops (four-bar, slider-crank: the loop's other joints follow the driven one on its branch, and driving stops where a loop can no longer close), cams (`joint.cam`: a revolute cam drives a slider or revolute follower along a closed sketch profile or the cam's edges, knife, roller or flat followers, worked out again when the profile changes; drives, studies, closed loops, contact sets), As-built Joint, Rigid Group, Contact Sets (driving and motion studies stop where bodies in a set would pass through each other), Motion Study (joint values keyed along a timeline, playback, export of occurrence positions as JSON/CSV), motion analysis (joint values and a point's path charted over a study as value, velocity and acceleration; the parts that collide along a study, with the steps where they do), Exploded views (automatic or by hand, shown without changing placements); interference, per-component physical properties; STEP with assembly structure; URDF export for robot simulators (links with meshes, mass and inertia; joint chains whose values match Drive Joints; docs/urdf.md). Physical properties now measure material-aware component/occurrence placements, descendants and repeated instances, including pending moves and body reassignment offsets; contact geometry and automatic exploded centres respect those offsets. Groundwork done: component tree, occurrences with transforms (instances, Paste New), world placement, active component as authoring frame, ground, Capture/Revert Position, moving bodies and sketches. UI: ASSEMBLE panel dialogs for New Component, Joint (snaps on faces, edges, circles and vertices; animated motion preview; offsets, flip, limits), As-built Joint, Joint Origin, Rigid Group, Drive Joints (live slider), Motion Link, Cam and Interference (overlaps shown red); joints in the timeline and the Browser | in progress | 32 |
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"HISTORY": "HISTORIE",
|
||||
"Height": "Výška",
|
||||
"Hidden edges": "Skryté hrany",
|
||||
"History layout": "Rozložení historie",
|
||||
"Holes": "Otvory",
|
||||
"Holes (edges on them)": "Otvory (jejich hrany)",
|
||||
"Home view": "Výchozí pohled",
|
||||
@@ -1526,6 +1527,11 @@
|
||||
"ui.hideOrigin": "Skrýt počátek",
|
||||
"ui.hidePlanes": "Skrýt roviny",
|
||||
"ui.hideProfile": "Skrýt profil",
|
||||
"ui.history_back": "O krok zpět",
|
||||
"ui.history_below_browser": "Pod prohlížečem",
|
||||
"ui.history_first": "Přejít na začátek",
|
||||
"ui.history_forward": "O krok vpřed",
|
||||
"ui.history_last": "Přejít na konec",
|
||||
"ui.history_title": "Historie",
|
||||
"ui.hole": "Otvor",
|
||||
"ui.hole_tap_type": "Typ závitu otvoru",
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"HISTORY": "HISTORIK",
|
||||
"Height": "Højde",
|
||||
"Hidden edges": "Skjulte kanter",
|
||||
"History layout": "Historiklayout",
|
||||
"Holes": "Huller",
|
||||
"Holes (edges on them)": "Huller (kanterne omkring dem)",
|
||||
"Home view": "Hjemmevisning",
|
||||
@@ -1526,6 +1527,11 @@
|
||||
"ui.hideOrigin": "Skjul nulpunkt",
|
||||
"ui.hidePlanes": "Skjul planer",
|
||||
"ui.hideProfile": "Skjul profil",
|
||||
"ui.history_back": "Gå ét trin tilbage",
|
||||
"ui.history_below_browser": "Under browseren",
|
||||
"ui.history_first": "Gå til begyndelsen",
|
||||
"ui.history_forward": "Gå ét trin frem",
|
||||
"ui.history_last": "Gå til slutningen",
|
||||
"ui.history_title": "Historik",
|
||||
"ui.hole": "Hul",
|
||||
"ui.hole_tap_type": "Hullets gevindtype",
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"HISTORY": "VERLAUF",
|
||||
"Height": "Höhe",
|
||||
"Hidden edges": "Verdeckte Kanten",
|
||||
"History layout": "Verlaufslayout",
|
||||
"Holes": "Löcher",
|
||||
"Holes (edges on them)": "Löcher (ihre Kanten)",
|
||||
"Home view": "Startansicht",
|
||||
@@ -1526,6 +1527,11 @@
|
||||
"ui.hideOrigin": "Ursprung ausblenden",
|
||||
"ui.hidePlanes": "Ebenen ausblenden",
|
||||
"ui.hideProfile": "Profil ausblenden",
|
||||
"ui.history_back": "Einen Schritt zurück",
|
||||
"ui.history_below_browser": "Unter dem Browser",
|
||||
"ui.history_first": "Zum Anfang",
|
||||
"ui.history_forward": "Einen Schritt vor",
|
||||
"ui.history_last": "Zum Ende",
|
||||
"ui.history_title": "Verlauf",
|
||||
"ui.hole": "Bohrung",
|
||||
"ui.hole_tap_type": "Gewindetyp",
|
||||
|
||||
+15
-1
@@ -168,6 +168,8 @@
|
||||
"HISTORY": "HISTORY",
|
||||
"Height": "Height",
|
||||
"Hidden edges": "Hidden edges",
|
||||
"History layout": "History layout",
|
||||
"History names": "History names",
|
||||
"Holes": "Holes",
|
||||
"Holes (edges on them)": "Holes (edges on them)",
|
||||
"Home view": "Home view",
|
||||
@@ -1538,7 +1540,19 @@
|
||||
"ui.hideOrigin": "Hide Origin",
|
||||
"ui.hidePlanes": "Hide Planes",
|
||||
"ui.hideProfile": "Hide Profile",
|
||||
"ui.history_back": "Go back one step",
|
||||
"ui.history_below_browser": "Below browser",
|
||||
"ui.history_edge_hint": "double-click the edge",
|
||||
"ui.history_first": "Go to beginning",
|
||||
"ui.history_forward": "Go forward one step",
|
||||
"ui.history_hide_names": "Hide names",
|
||||
"ui.history_last": "Go to end",
|
||||
"ui.history_marker_tip": "History marker: drag to roll the model back; new features go here",
|
||||
"ui.history_names": "Names",
|
||||
"ui.history_play": "Play to the end",
|
||||
"ui.history_show_names": "Show names",
|
||||
"ui.history_title": "History",
|
||||
"ui.history_toggle_names": "Show or hide feature names",
|
||||
"ui.hole": "Hole",
|
||||
"ui.hole_tap_type": "Hole Tap Type",
|
||||
"ui.hole_type": "Hole Type",
|
||||
@@ -1832,7 +1846,7 @@
|
||||
"ui.tie_ends": "Tie",
|
||||
"ui.tie_ends_tip": "Constrain all untied ends",
|
||||
"ui.timeline_bottom": "Bottom timeline",
|
||||
"ui.timeline_left_note": "The left layout shows the rollback bar above the parts and scene browser.",
|
||||
"ui.timeline_left_note": "The vertical history sits to the left of the browser. Toggle feature names on the strip.",
|
||||
"ui.timeline_left_sidebar": "Left sidebar",
|
||||
"ui.tip_angle": "Tip Angle",
|
||||
"ui.to_object": "To Object",
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"HISTORY": "HISTORIAL",
|
||||
"Height": "Altura",
|
||||
"Hidden edges": "Aristas ocultas",
|
||||
"History layout": "Disposición del historial",
|
||||
"Holes": "Agujeros",
|
||||
"Holes (edges on them)": "Agujeros (aristas que contienen)",
|
||||
"Home view": "Vista de inicio",
|
||||
@@ -1526,6 +1527,11 @@
|
||||
"ui.hideOrigin": "Ocultar origen",
|
||||
"ui.hidePlanes": "Ocultar planos",
|
||||
"ui.hideProfile": "Ocultar perfil",
|
||||
"ui.history_back": "Retroceder un paso",
|
||||
"ui.history_below_browser": "Debajo del explorador",
|
||||
"ui.history_first": "Ir al principio",
|
||||
"ui.history_forward": "Avanzar un paso",
|
||||
"ui.history_last": "Ir al final",
|
||||
"ui.history_title": "Historial",
|
||||
"ui.hole": "Agujero",
|
||||
"ui.hole_tap_type": "Tipo de roscado del agujero",
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"HISTORY": "HISTORIQUE",
|
||||
"Height": "Hauteur",
|
||||
"Hidden edges": "Arêtes cachées",
|
||||
"History layout": "Disposition de l’historique",
|
||||
"Holes": "Trous",
|
||||
"Holes (edges on them)": "Trous (par leurs arêtes)",
|
||||
"Home view": "Vue d'accueil",
|
||||
@@ -1532,6 +1533,11 @@
|
||||
"ui.hideOrigin": "Masquer l'origine",
|
||||
"ui.hidePlanes": "Masquer les plans",
|
||||
"ui.hideProfile": "Masquer le profil",
|
||||
"ui.history_back": "Reculer d’une étape",
|
||||
"ui.history_below_browser": "Sous le navigateur",
|
||||
"ui.history_first": "Aller au début",
|
||||
"ui.history_forward": "Avancer d’une étape",
|
||||
"ui.history_last": "Aller à la fin",
|
||||
"ui.history_title": "Historique",
|
||||
"ui.hole": "Perçage",
|
||||
"ui.hole_tap_type": "Type de taraudage",
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"HISTORY": "HISTORIAL",
|
||||
"Height": "Altura",
|
||||
"Hidden edges": "Arestas ocultas",
|
||||
"History layout": "Disposición do historial",
|
||||
"Holes": "Furados",
|
||||
"Holes (edges on them)": "Furados (arestas sobre eles)",
|
||||
"Home view": "Vista de inicio",
|
||||
@@ -1526,6 +1527,11 @@
|
||||
"ui.hideOrigin": "Ocultar a orixe",
|
||||
"ui.hidePlanes": "Ocultar os planos",
|
||||
"ui.hideProfile": "Ocultar o perfil",
|
||||
"ui.history_back": "Retroceder un paso",
|
||||
"ui.history_below_browser": "Debaixo do explorador",
|
||||
"ui.history_first": "Ir ao comezo",
|
||||
"ui.history_forward": "Avanzar un paso",
|
||||
"ui.history_last": "Ir ao final",
|
||||
"ui.history_title": "Historial",
|
||||
"ui.hole": "Furado",
|
||||
"ui.hole_tap_type": "Tipo de roscado do furado",
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"HISTORY": "ELŐZMÉNYEK",
|
||||
"Height": "Magasság",
|
||||
"Hidden edges": "Rejtett élek",
|
||||
"History layout": "Előzmények elrendezése",
|
||||
"Holes": "Furatok",
|
||||
"Holes (edges on them)": "Furatok (rajtuk lévő élek)",
|
||||
"Home view": "Kezdőnézet",
|
||||
@@ -1526,6 +1527,11 @@
|
||||
"ui.hideOrigin": "Origó elrejtése",
|
||||
"ui.hidePlanes": "Síkok elrejtése",
|
||||
"ui.hideProfile": "Profil elrejtése",
|
||||
"ui.history_back": "Egy lépéssel vissza",
|
||||
"ui.history_below_browser": "Böngésző alatt",
|
||||
"ui.history_first": "Ugrás az elejére",
|
||||
"ui.history_forward": "Egy lépéssel előre",
|
||||
"ui.history_last": "Ugrás a végére",
|
||||
"ui.history_title": "Előzmények",
|
||||
"ui.hole": "Furat",
|
||||
"ui.hole_tap_type": "Furat menettípusa",
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"HISTORY": "RIWAYAT",
|
||||
"Height": "Tinggi",
|
||||
"Hidden edges": "Tepi tersembunyi",
|
||||
"History layout": "Tata letak riwayat",
|
||||
"Holes": "Lubang",
|
||||
"Holes (edges on them)": "Lubang (tepi di atasnya)",
|
||||
"Home view": "Tampilan awal",
|
||||
@@ -1526,6 +1527,11 @@
|
||||
"ui.hideOrigin": "Sembunyikan Origin",
|
||||
"ui.hidePlanes": "Sembunyikan Bidang",
|
||||
"ui.hideProfile": "Sembunyikan Profil",
|
||||
"ui.history_back": "Mundur satu langkah",
|
||||
"ui.history_below_browser": "Di bawah browser",
|
||||
"ui.history_first": "Ke awal",
|
||||
"ui.history_forward": "Maju satu langkah",
|
||||
"ui.history_last": "Ke akhir",
|
||||
"ui.history_title": "Riwayat",
|
||||
"ui.hole": "Lubang",
|
||||
"ui.hole_tap_type": "Tipe Tap Lubang",
|
||||
|
||||
@@ -168,6 +168,7 @@
|
||||
"HISTORY": "CRONOLOGIA",
|
||||
"Height": "Altezza",
|
||||
"Hidden edges": "Spigoli nascosti",
|
||||
"History layout": "Disposizione cronologia",
|
||||
"Holes": "Fori",
|
||||
"Holes (edges on them)": "Fori (spigoli dei fori)",
|
||||
"Home view": "Vista iniziale",
|
||||
@@ -1529,6 +1530,11 @@
|
||||
"ui.hideOrigin": "Nascondi origine",
|
||||
"ui.hidePlanes": "Nascondi piani",
|
||||
"ui.hideProfile": "Nascondi profilo",
|
||||
"ui.history_back": "Indietro di un passaggio",
|
||||
"ui.history_below_browser": "Sotto il browser",
|
||||
"ui.history_first": "Vai all’inizio",
|
||||
"ui.history_forward": "Avanti di un passaggio",
|
||||
"ui.history_last": "Vai alla fine",
|
||||
"ui.history_title": "Cronologia",
|
||||
"ui.hole": "Foro",
|
||||
"ui.hole_tap_type": "Tipo di maschiatura del foro",
|
||||
|
||||
+15
-1
@@ -168,6 +168,8 @@
|
||||
"HISTORY": "履歴",
|
||||
"Height": "高さ",
|
||||
"Hidden edges": "隠線",
|
||||
"History layout": "履歴のレイアウト",
|
||||
"History names": "履歴名",
|
||||
"Holes": "穴",
|
||||
"Holes (edges on them)": "穴(そのエッジ)",
|
||||
"Home view": "ホームビュー",
|
||||
@@ -1538,7 +1540,19 @@
|
||||
"ui.hideOrigin": "原点を非表示",
|
||||
"ui.hidePlanes": "平面を非表示",
|
||||
"ui.hideProfile": "プロファイルを非表示",
|
||||
"ui.history_back": "1ステップ戻る",
|
||||
"ui.history_below_browser": "ブラウザーの下",
|
||||
"ui.history_edge_hint": "端をダブルクリック",
|
||||
"ui.history_first": "先頭に移動",
|
||||
"ui.history_forward": "1ステップ進む",
|
||||
"ui.history_hide_names": "名前を非表示",
|
||||
"ui.history_last": "末尾に移動",
|
||||
"ui.history_marker_tip": "履歴マーカー:ドラッグしてモデルをロールバックします。新しいフィーチャーはここに追加されます",
|
||||
"ui.history_names": "名前",
|
||||
"ui.history_play": "最後まで再生",
|
||||
"ui.history_show_names": "名前を表示",
|
||||
"ui.history_title": "履歴",
|
||||
"ui.history_toggle_names": "フィーチャー名を表示・非表示",
|
||||
"ui.hole": "穴",
|
||||
"ui.hole_tap_type": "ねじ穴タイプ",
|
||||
"ui.hole_type": "穴タイプ",
|
||||
@@ -1832,7 +1846,7 @@
|
||||
"ui.tie_ends": "拘束",
|
||||
"ui.tie_ends_tip": "未拘束をすべて拘束",
|
||||
"ui.timeline_bottom": "下部タイムライン",
|
||||
"ui.timeline_left_note": "左レイアウトでは、ロールバックバーがパーツとシーンブラウザーの上に表示されます。",
|
||||
"ui.timeline_left_note": "縦の履歴はブラウザーの左に表示されます。ストリップでフィーチャー名の表示を切り替えられます。",
|
||||
"ui.timeline_left_sidebar": "左サイドバー",
|
||||
"ui.tip_angle": "先端角度",
|
||||
"ui.to_object": "オブジェクトまで",
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"HISTORY": "이력",
|
||||
"Height": "높이",
|
||||
"Hidden edges": "숨겨진 모서리",
|
||||
"History layout": "기록 레이아웃",
|
||||
"Holes": "구멍",
|
||||
"Holes (edges on them)": "구멍 (구멍의 모서리)",
|
||||
"Home view": "홈 뷰",
|
||||
@@ -1526,6 +1527,11 @@
|
||||
"ui.hideOrigin": "원점 숨기기",
|
||||
"ui.hidePlanes": "평면 숨기기",
|
||||
"ui.hideProfile": "윤곽 숨기기",
|
||||
"ui.history_back": "한 단계 뒤로",
|
||||
"ui.history_below_browser": "브라우저 아래",
|
||||
"ui.history_first": "처음으로 이동",
|
||||
"ui.history_forward": "한 단계 앞으로",
|
||||
"ui.history_last": "끝으로 이동",
|
||||
"ui.history_title": "기록",
|
||||
"ui.hole": "구멍",
|
||||
"ui.hole_tap_type": "탭 유형",
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"HISTORY": "SEJARAH",
|
||||
"Height": "Ketinggian",
|
||||
"Hidden edges": "Tepi tersembunyi",
|
||||
"History layout": "Susun atur sejarah",
|
||||
"Holes": "Lubang",
|
||||
"Holes (edges on them)": "Lubang (tepi lubang)",
|
||||
"Home view": "Pandangan utama",
|
||||
@@ -1526,6 +1527,11 @@
|
||||
"ui.hideOrigin": "Sembunyi Titik Asal",
|
||||
"ui.hidePlanes": "Sembunyi Satah",
|
||||
"ui.hideProfile": "Sembunyi Profil",
|
||||
"ui.history_back": "Undur satu langkah",
|
||||
"ui.history_below_browser": "Di bawah pelayar",
|
||||
"ui.history_first": "Pergi ke permulaan",
|
||||
"ui.history_forward": "Maju satu langkah",
|
||||
"ui.history_last": "Pergi ke penghujung",
|
||||
"ui.history_title": "Sejarah",
|
||||
"ui.hole": "Lubang",
|
||||
"ui.hole_tap_type": "Jenis Bebenang Lubang",
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"HISTORY": "GESCHIEDENIS",
|
||||
"Height": "Hoogte",
|
||||
"Hidden edges": "Verborgen randen",
|
||||
"History layout": "Geschiedenisindeling",
|
||||
"Holes": "Gaten",
|
||||
"Holes (edges on them)": "Gaten (randen erop)",
|
||||
"Home view": "Beginweergave",
|
||||
@@ -1526,6 +1527,11 @@
|
||||
"ui.hideOrigin": "Oorsprong verbergen",
|
||||
"ui.hidePlanes": "Vlakken verbergen",
|
||||
"ui.hideProfile": "Profiel verbergen",
|
||||
"ui.history_back": "Eén stap terug",
|
||||
"ui.history_below_browser": "Onder de browser",
|
||||
"ui.history_first": "Naar het begin",
|
||||
"ui.history_forward": "Eén stap vooruit",
|
||||
"ui.history_last": "Naar het einde",
|
||||
"ui.history_title": "Geschiedenis",
|
||||
"ui.hole": "Gat",
|
||||
"ui.hole_tap_type": "Type tapgat",
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"HISTORY": "HISTORIA",
|
||||
"Height": "Wysokość",
|
||||
"Hidden edges": "Krawędzie niewidoczne",
|
||||
"History layout": "Układ historii",
|
||||
"Holes": "Otwory",
|
||||
"Holes (edges on them)": "Otwory (krawędzie na nich)",
|
||||
"Home view": "Widok główny",
|
||||
@@ -1526,6 +1527,11 @@
|
||||
"ui.hideOrigin": "Ukryj początek układu",
|
||||
"ui.hidePlanes": "Ukryj płaszczyzny",
|
||||
"ui.hideProfile": "Ukryj profil",
|
||||
"ui.history_back": "Cofnij o jeden krok",
|
||||
"ui.history_below_browser": "Pod przeglądarką",
|
||||
"ui.history_first": "Przejdź do początku",
|
||||
"ui.history_forward": "Przejdź o jeden krok do przodu",
|
||||
"ui.history_last": "Przejdź do końca",
|
||||
"ui.history_title": "Historia",
|
||||
"ui.hole": "Otwór",
|
||||
"ui.hole_tap_type": "Typ gwintu otworu",
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"HISTORY": "HISTÓRICO",
|
||||
"Height": "Altura",
|
||||
"Hidden edges": "Arestas ocultas",
|
||||
"History layout": "Layout do histórico",
|
||||
"Holes": "Furos",
|
||||
"Holes (edges on them)": "Furos (arestas neles)",
|
||||
"Home view": "Vista inicial",
|
||||
@@ -1526,6 +1527,11 @@
|
||||
"ui.hideOrigin": "Ocultar origem",
|
||||
"ui.hidePlanes": "Ocultar planos",
|
||||
"ui.hideProfile": "Ocultar perfil",
|
||||
"ui.history_back": "Voltar uma etapa",
|
||||
"ui.history_below_browser": "Abaixo do navegador",
|
||||
"ui.history_first": "Ir para o início",
|
||||
"ui.history_forward": "Avançar uma etapa",
|
||||
"ui.history_last": "Ir para o fim",
|
||||
"ui.history_title": "Histórico",
|
||||
"ui.hole": "Furo",
|
||||
"ui.hole_tap_type": "Tipo de rosca do furo",
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"HISTORY": "ISTORIC",
|
||||
"Height": "Înălțime",
|
||||
"Hidden edges": "Muchii ascunse",
|
||||
"History layout": "Aspectul istoricului",
|
||||
"Holes": "Găuri",
|
||||
"Holes (edges on them)": "Găuri (muchiile lor)",
|
||||
"Home view": "Vizualizare de start",
|
||||
@@ -1526,6 +1527,11 @@
|
||||
"ui.hideOrigin": "Ascunde originea",
|
||||
"ui.hidePlanes": "Ascunde planele",
|
||||
"ui.hideProfile": "Ascunde profilul",
|
||||
"ui.history_back": "Un pas înapoi",
|
||||
"ui.history_below_browser": "Sub navigator",
|
||||
"ui.history_first": "Mergi la început",
|
||||
"ui.history_forward": "Un pas înainte",
|
||||
"ui.history_last": "Mergi la sfârșit",
|
||||
"ui.history_title": "Istoric",
|
||||
"ui.hole": "Gaură",
|
||||
"ui.hole_tap_type": "Tip de filetare gaură",
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"HISTORY": "ИСТОРИЯ",
|
||||
"Height": "Высота",
|
||||
"Hidden edges": "Скрытые рёбра",
|
||||
"History layout": "Расположение истории",
|
||||
"Holes": "Отверстия",
|
||||
"Holes (edges on them)": "Отверстия (рёбра на них)",
|
||||
"Home view": "Главный вид",
|
||||
@@ -1526,6 +1527,11 @@
|
||||
"ui.hideOrigin": "Скрыть начало координат",
|
||||
"ui.hidePlanes": "Скрыть плоскости",
|
||||
"ui.hideProfile": "Скрыть профиль",
|
||||
"ui.history_back": "На один шаг назад",
|
||||
"ui.history_below_browser": "Под браузером",
|
||||
"ui.history_first": "Перейти в начало",
|
||||
"ui.history_forward": "На один шаг вперёд",
|
||||
"ui.history_last": "Перейти в конец",
|
||||
"ui.history_title": "История",
|
||||
"ui.hole": "Отверстие",
|
||||
"ui.hole_tap_type": "Тип резьбы отверстия",
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"HISTORY": "HISTORIK",
|
||||
"Height": "Höjd",
|
||||
"Hidden edges": "Dolda kanter",
|
||||
"History layout": "Historiklayout",
|
||||
"Holes": "Hål",
|
||||
"Holes (edges on them)": "Hål (kanter på dem)",
|
||||
"Home view": "Hemvy",
|
||||
@@ -1526,6 +1527,11 @@
|
||||
"ui.hideOrigin": "Dölj origo",
|
||||
"ui.hidePlanes": "Dölj plan",
|
||||
"ui.hideProfile": "Dölj profil",
|
||||
"ui.history_back": "Gå ett steg bakåt",
|
||||
"ui.history_below_browser": "Under webbläsaren",
|
||||
"ui.history_first": "Gå till början",
|
||||
"ui.history_forward": "Gå ett steg framåt",
|
||||
"ui.history_last": "Gå till slutet",
|
||||
"ui.history_title": "Historik",
|
||||
"ui.hole": "Hål",
|
||||
"ui.hole_tap_type": "Typ av gängning för hål",
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"HISTORY": "GEÇMİŞ",
|
||||
"Height": "Yükseklik",
|
||||
"Hidden edges": "Gizli kenarlar",
|
||||
"History layout": "Geçmiş düzeni",
|
||||
"Holes": "Delikler",
|
||||
"Holes (edges on them)": "Delikler (kenarları)",
|
||||
"Home view": "Başlangıç görünümü",
|
||||
@@ -1526,6 +1527,11 @@
|
||||
"ui.hideOrigin": "Orijini gizle",
|
||||
"ui.hidePlanes": "Düzlemleri gizle",
|
||||
"ui.hideProfile": "Profili gizle",
|
||||
"ui.history_back": "Bir adım geri git",
|
||||
"ui.history_below_browser": "Tarayıcının altında",
|
||||
"ui.history_first": "Başlangıca git",
|
||||
"ui.history_forward": "Bir adım ileri git",
|
||||
"ui.history_last": "Sona git",
|
||||
"ui.history_title": "Geçmiş",
|
||||
"ui.hole": "Delik",
|
||||
"ui.hole_tap_type": "Diş türü",
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"HISTORY": "ІСТОРІЯ",
|
||||
"Height": "Висота",
|
||||
"Hidden edges": "Приховані ребра",
|
||||
"History layout": "Розташування історії",
|
||||
"Holes": "Отвори",
|
||||
"Holes (edges on them)": "Отвори (ребра на них)",
|
||||
"Home view": "Головний вид",
|
||||
@@ -1526,6 +1527,11 @@
|
||||
"ui.hideOrigin": "Приховати початок координат",
|
||||
"ui.hidePlanes": "Приховати площини",
|
||||
"ui.hideProfile": "Приховати профіль",
|
||||
"ui.history_back": "На один крок назад",
|
||||
"ui.history_below_browser": "Під браузером",
|
||||
"ui.history_first": "Перейти на початок",
|
||||
"ui.history_forward": "На один крок уперед",
|
||||
"ui.history_last": "Перейти в кінець",
|
||||
"ui.history_title": "Історія",
|
||||
"ui.hole": "Отвір",
|
||||
"ui.hole_tap_type": "Тип різьби отвору",
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"HISTORY": "LỊCH SỬ",
|
||||
"Height": "Chiều cao",
|
||||
"Hidden edges": "Nét khuất",
|
||||
"History layout": "Bố cục lịch sử",
|
||||
"Holes": "Lỗ",
|
||||
"Holes (edges on them)": "Lỗ (các cạnh trên lỗ)",
|
||||
"Home view": "Góc nhìn chuẩn (Home)",
|
||||
@@ -1526,6 +1527,11 @@
|
||||
"ui.hideOrigin": "Ẩn Gốc tọa độ",
|
||||
"ui.hidePlanes": "Ẩn các mặt phẳng",
|
||||
"ui.hideProfile": "Ẩn biên dạng",
|
||||
"ui.history_back": "Lùi một bước",
|
||||
"ui.history_below_browser": "Bên dưới trình duyệt",
|
||||
"ui.history_first": "Về đầu",
|
||||
"ui.history_forward": "Tiến một bước",
|
||||
"ui.history_last": "Đến cuối",
|
||||
"ui.history_title": "Lịch sử",
|
||||
"ui.hole": "Tạo lỗ",
|
||||
"ui.hole_tap_type": "Kiểu ta-rô ren lỗ",
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"HISTORY": "歷程記錄",
|
||||
"Height": "高度",
|
||||
"Hidden edges": "隱藏線",
|
||||
"History layout": "歷程配置",
|
||||
"Holes": "孔",
|
||||
"Holes (edges on them)": "孔(孔上的邊)",
|
||||
"Home view": "主檢視",
|
||||
@@ -1526,6 +1527,11 @@
|
||||
"ui.hideOrigin": "隱藏原點",
|
||||
"ui.hidePlanes": "隱藏平面",
|
||||
"ui.hideProfile": "隱藏輪廓",
|
||||
"ui.history_back": "後退一步",
|
||||
"ui.history_below_browser": "瀏覽器下方",
|
||||
"ui.history_first": "移至開頭",
|
||||
"ui.history_forward": "前進一步",
|
||||
"ui.history_last": "移至結尾",
|
||||
"ui.history_title": "歷程記錄",
|
||||
"ui.hole": "孔",
|
||||
"ui.hole_tap_type": "攻牙類型",
|
||||
|
||||
+15
-1
@@ -168,6 +168,8 @@
|
||||
"HISTORY": "历史",
|
||||
"Height": "高度",
|
||||
"Hidden edges": "隐藏线",
|
||||
"History layout": "历史布局",
|
||||
"History names": "历史名称",
|
||||
"Holes": "孔",
|
||||
"Holes (edges on them)": "孔(孔上的边)",
|
||||
"Home view": "主视图",
|
||||
@@ -1538,7 +1540,19 @@
|
||||
"ui.hideOrigin": "隐藏原点",
|
||||
"ui.hidePlanes": "隐藏平面",
|
||||
"ui.hideProfile": "隐藏轮廓",
|
||||
"ui.history_back": "后退一步",
|
||||
"ui.history_below_browser": "浏览器下方",
|
||||
"ui.history_edge_hint": "双击边缘",
|
||||
"ui.history_first": "转到开头",
|
||||
"ui.history_forward": "前进一步",
|
||||
"ui.history_hide_names": "隐藏名称",
|
||||
"ui.history_last": "转到末尾",
|
||||
"ui.history_marker_tip": "历史标记:拖动以回退模型;新特征将在此处添加",
|
||||
"ui.history_names": "名称",
|
||||
"ui.history_play": "播放至末尾",
|
||||
"ui.history_show_names": "显示名称",
|
||||
"ui.history_title": "历史",
|
||||
"ui.history_toggle_names": "显示或隐藏特征名称",
|
||||
"ui.hole": "孔",
|
||||
"ui.hole_tap_type": "孔攻丝类型",
|
||||
"ui.hole_type": "孔类型",
|
||||
@@ -1832,7 +1846,7 @@
|
||||
"ui.tie_ends": "约束",
|
||||
"ui.tie_ends_tip": "约束全部未约束端点",
|
||||
"ui.timeline_bottom": "底部时间轴",
|
||||
"ui.timeline_left_note": "左侧布局下,回退条显示在零件和场景浏览器的上方。",
|
||||
"ui.timeline_left_note": "垂直历史位于浏览器左侧。可在历史条上切换特征名称的显示。",
|
||||
"ui.timeline_left_sidebar": "左侧边栏",
|
||||
"ui.tip_angle": "尖端角度",
|
||||
"ui.to_object": "到对象",
|
||||
|
||||
@@ -7,6 +7,8 @@ use crate::params::{bad, num, req_vec2, req_vec3, vec3};
|
||||
use crate::{Result, Session};
|
||||
|
||||
pub static COMMANDS: &[CommandSpec] = &[
|
||||
CommandSpec::new("view.history_layout", "History layout", history_layout)
|
||||
.icon("settings").noundo().doc_only().params("width?: 1..1000000; dock?: bottom|left|under_browser; collapsed?: bool → validated layout request; display only, never opens a dialog"),
|
||||
CommandSpec::new("view.graphics_preset", "Graphics Preset", graphics_preset)
|
||||
.icon("settings").noundo().doc_only().params("preset: performance|quality → preset, enabled, display_quality, supersampling, supersampling_adaptive; Quality: AO, Fine, adaptive 2x SSAA; Performance: no AO, Normal, no SSAA"),
|
||||
CommandSpec::new("view.ambient_occlusion", "Ambient Occlusion", ambient_occlusion)
|
||||
@@ -17,6 +19,30 @@ CommandSpec::new("view.navigate", "Navigate View", navigate)
|
||||
.doc_only()
|
||||
.params("camera: Camera; direction?: [x,y,z] in the camera's up-axis frame; or action: left|right|up|down|clockwise|counterclockwise|home|fit, degrees?: 0..180 (how far left|right|up|down turn; default 90); or motion: pan|orbit|zoom, delta?: [dx,dy] (pixels, each ±10000), viewport?: [width,height] (1..1000000, required for pan or pivot), pivot?: [x,y,z], factor?: 0.05..20 (required for zoom), anchor?: [x,y,z] → camera, fit, continuous?")];
|
||||
|
||||
fn history_layout(_s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let cmd = "view.history_layout";
|
||||
let mut result = serde_json::Map::new();
|
||||
if let Some(value) = p.get("width") {
|
||||
let width = value
|
||||
.as_f64()
|
||||
.filter(|v| v.is_finite() && (1.0..=1_000_000.0).contains(v))
|
||||
.ok_or_else(|| bad(cmd, "width must be finite and within 1..1000000"))?;
|
||||
result.insert("width".into(), json!(width));
|
||||
}
|
||||
if let Some(value) = p.get("dock") {
|
||||
let dock = value
|
||||
.as_str()
|
||||
.filter(|v| matches!(*v, "bottom" | "left" | "under_browser"))
|
||||
.ok_or_else(|| bad(cmd, "dock must be bottom, left or under_browser"))?;
|
||||
result.insert("dock".into(), json!(dock));
|
||||
}
|
||||
if let Some(value) = p.get("collapsed") {
|
||||
let collapsed = value.as_bool().ok_or_else(|| bad(cmd, "collapsed must be a boolean"))?;
|
||||
result.insert("collapsed".into(), json!(collapsed));
|
||||
}
|
||||
Ok(Value::Object(result))
|
||||
}
|
||||
|
||||
fn navigate(_s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let cmd = "view.navigate";
|
||||
let mut cam: Camera =
|
||||
@@ -349,3 +375,17 @@ mod graphics_preset_tests {
|
||||
assert!(s.undo.is_empty());
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[test]
|
||||
fn history_layout_validates_geometry_without_changing_the_design() {
|
||||
let mut s = Session::default();
|
||||
let doc = s.doc.clone();
|
||||
let request = json!({"width":240.0,"dock":"under_browser","collapsed":true});
|
||||
assert_eq!(s.execute("view.history_layout", &request).unwrap(), request);
|
||||
for p in [json!({"width":-1}), json!({"width":1e20}), json!({"width":"wide"}), json!({"dock":"nowhere"}), json!({"collapsed":42})] {
|
||||
assert!(s.execute("view.history_layout", &p).is_err());
|
||||
}
|
||||
assert_eq!(s.doc, doc);
|
||||
assert!(s.undo.is_empty());
|
||||
}
|
||||
@@ -445,19 +445,11 @@ fn strip(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
/// Pop out (or Dock, in its own window), Minimise and Close. In its own window the system moves
|
||||
/// and minimises it, so there is no grip and no Minimise.
|
||||
fn header(app: &mut SolveApp, ui: &mut egui::Ui, left: bool) {
|
||||
let t = Tokens::get();
|
||||
let state = app.agent_chat.state();
|
||||
let popped = app.preferences.agent_chat_popped;
|
||||
ui.horizontal(|ui| {
|
||||
let title = {
|
||||
let (grip, _) = ui.allocate_exact_size(vec2(if popped { 0.0 } else { 10.0 }, 18.0), Sense::hover());
|
||||
if !popped {
|
||||
for row in 0..3 {
|
||||
for col in 0..2 {
|
||||
ui.painter().circle_filled(grip.left_top() + vec2(2.5 + col as f32 * 5.0, 4.0 + row as f32 * 5.0), 1.1, t.text_dim);
|
||||
}
|
||||
}
|
||||
}
|
||||
let grip = if popped { ui.allocate_exact_size(vec2(0.0, 18.0), Sense::hover()).0 } else { ui_kit::panel_grip(ui).rect };
|
||||
let l = ui.label(
|
||||
RichText::new(tr("ui.agent_chat")).semibold().color(crate::theme::Tokens::get().text).size(crate::theme::Tokens::get().font_heading),
|
||||
);
|
||||
|
||||
@@ -278,7 +278,7 @@ pub fn group_action(app: &mut SolveApp, action: &str, p: &Value) {
|
||||
// Drawing
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
||||
const ROW_H: f32 = 26.0;
|
||||
const ROW_H: f32 = crate::ui_kit::TREE_ROW_HEIGHT;
|
||||
/// 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;
|
||||
@@ -663,12 +663,7 @@ fn lit_row((selected, hovered): (bool, bool)) -> (bool, Mark) {
|
||||
}
|
||||
|
||||
pub fn browser(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
browser_panel(app, ui, false);
|
||||
}
|
||||
|
||||
/// The left-sidebar layout: feature history first, parts and scene browser below it.
|
||||
pub fn browser_below_timeline(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
browser_panel(app, ui, true);
|
||||
browser_panel(app, ui);
|
||||
}
|
||||
|
||||
/// How narrow the browser sidebar may be dragged, and how wide (the viewport keeps the rest).
|
||||
@@ -679,7 +674,7 @@ const BROWSER_RAIL: f32 = 6.0;
|
||||
/// How opaque the floating browser's card is; the workspace shows through the rest.
|
||||
const BROWSER_FLOAT_ALPHA: f32 = 0.4;
|
||||
|
||||
fn browser_panel(app: &mut SolveApp, ui: &mut egui::Ui, timeline_above: bool) {
|
||||
fn browser_panel(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
let t = Tokens::get();
|
||||
app.tree.order.clear();
|
||||
DRAWN.with(|d| d.borrow_mut().clear());
|
||||
@@ -691,76 +686,28 @@ fn browser_panel(app: &mut SolveApp, ui: &mut egui::Ui, timeline_above: bool) {
|
||||
.resizable(false)
|
||||
.frame(egui::Frame::NONE.fill(t.panel).inner_margin(egui::Margin::symmetric(t.space_6 as i8, t.space_6 as i8)))
|
||||
.show(ui, |ui| {
|
||||
if timeline_above {
|
||||
let available = ui.available_height();
|
||||
let browser_collapsed = app.preferences.timeline_left_browser_collapsed;
|
||||
let max_timeline_height = (available - if browser_collapsed { 30.0 } else { 130.0 }).max(150.0);
|
||||
let remembered = app.preferences.timeline_left_height;
|
||||
let timeline_height =
|
||||
if remembered.is_finite() { remembered.clamp(150.0, max_timeline_height) } else { 360.0_f32.clamp(150.0, max_timeline_height) };
|
||||
ui.allocate_ui_with_layout(vec2(ui.available_width(), timeline_height), egui::Layout::top_down(egui::Align::Min), |ui| {
|
||||
crate::timeline_left::left_timeline(app, ui)
|
||||
});
|
||||
if !browser_collapsed {
|
||||
let (rect, _) = ui.allocate_exact_size(vec2(ui.available_width(), 8.0), egui::Sense::hover());
|
||||
let response = ui
|
||||
.interact(rect, egui::Id::new("left_history_divider"), egui::Sense::drag())
|
||||
.on_hover_cursor(egui::CursorIcon::ResizeVertical);
|
||||
if response.dragged() {
|
||||
let delta = ui.input(|input| input.pointer.delta().y);
|
||||
if delta.is_finite() {
|
||||
app.preferences.timeline_left_height = (timeline_height + delta).clamp(150.0, max_timeline_height);
|
||||
}
|
||||
}
|
||||
ui.painter().hline(rect.x_range(), rect.center().y, egui::Stroke::new(1.0, t.border));
|
||||
crate::scenario::publish_handle("left-history-divider", rect.center());
|
||||
}
|
||||
let (rect, response) = ui.allocate_exact_size(vec2(ui.available_width(), crate::ui_kit::row_height()), Sense::click());
|
||||
crate::ui_kit::disclosure(
|
||||
ui.painter(),
|
||||
pos2(rect.left() + t.form_section_icon_size / 2.0, rect.center().y),
|
||||
!browser_collapsed,
|
||||
t.text_dim,
|
||||
);
|
||||
ui.painter().text(
|
||||
pos2(rect.left() + t.form_section_icon_size + t.space_8, rect.center().y),
|
||||
egui::Align2::LEFT_CENTER,
|
||||
"BROWSER",
|
||||
crate::fonts::semibold(t.font_small),
|
||||
t.text_dim,
|
||||
);
|
||||
response
|
||||
.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::CollapsingHeader, ui.is_enabled(), !browser_collapsed, "BROWSER"));
|
||||
crate::scenario::publish_handle("left-browser-toggle", response.rect.center());
|
||||
if response.clicked() {
|
||||
app.preferences.timeline_left_browser_collapsed = !browser_collapsed;
|
||||
}
|
||||
if !browser_collapsed {
|
||||
ui.add_space(t.space_4);
|
||||
browser_rows(app, ui, &mut acts);
|
||||
}
|
||||
} else {
|
||||
browser_contents(app, ui, &mut acts, false);
|
||||
}
|
||||
browser_contents(app, ui, &mut acts, false);
|
||||
});
|
||||
resize_browser(app, ui, panel.response.rect, width);
|
||||
resize_column(app, ui, panel.response.rect, width, "left-browser-rail");
|
||||
finish_browser(app, ui, acts);
|
||||
}
|
||||
|
||||
fn browser_width(remembered: f32) -> f32 {
|
||||
pub(crate) fn browser_width(remembered: f32) -> f32 {
|
||||
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) {
|
||||
/// Either card in a stacked column changes the same remembered width.
|
||||
pub(crate) fn resize_column(app: &mut SolveApp, ui: &egui::Ui, rect: Rect, width: f32, handle: &'static str) {
|
||||
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);
|
||||
let response =
|
||||
ui.interact(rail, egui::Id::new(("sc_shared_column_rail", handle)), 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", pos2(rect.right() - BROWSER_RAIL / 2.0, rect.center().y));
|
||||
crate::scenario::publish_handle(handle, pos2(rect.right() - BROWSER_RAIL / 2.0, rect.center().y));
|
||||
}
|
||||
|
||||
/// One browser card for the floating shell and the docked shell's optional overlay.
|
||||
@@ -774,7 +721,21 @@ pub fn floating(app: &mut SolveApp, ui: &mut egui::Ui, available: Rect) {
|
||||
let gap = crate::shell::SHELL_GAP;
|
||||
let top_gap = if app.ui.layout == crate::shell::LayoutMode::Docked { gap } else { 0.0 };
|
||||
let width = browser_width(app.preferences.browser_width);
|
||||
let bounds = floating_bounds(available, app.shell.history, width, top_gap);
|
||||
let vertical = app.ui.show_timeline && app.preferences.timeline_left;
|
||||
let mut available = available;
|
||||
let stacked = crate::timeline_left::stacked(app);
|
||||
if vertical
|
||||
&& !stacked
|
||||
&& let Some(history) = app.shell.history
|
||||
{
|
||||
available.min.x = (history.right() + gap).min(available.right()) - gap;
|
||||
}
|
||||
let collapsed = vertical && !stacked && app.preferences.timeline_left_browser_collapsed;
|
||||
let bounds = if stacked {
|
||||
crate::timeline_left::stacked_rects(app, available).0
|
||||
} else {
|
||||
floating_bounds(available, if vertical { None } else { app.shell.history }, if collapsed { t.space_24 + t.space_10 } else { width }, top_gap)
|
||||
};
|
||||
app.shell.browser = None;
|
||||
let min_height = HEADER_H + 2.0 * (CARD_INSET + 1.0);
|
||||
if bounds.is_positive() && bounds.height() >= min_height {
|
||||
@@ -786,9 +747,19 @@ pub fn floating(app: &mut SolveApp, ui: &mut egui::Ui, available: Rect) {
|
||||
let response = frame.show(ui, |ui| {
|
||||
ui.set_width(inner_width);
|
||||
ui.set_max_height(inner_height);
|
||||
browser_contents(app, ui, &mut acts, true);
|
||||
if stacked {
|
||||
ui.set_min_height(inner_height);
|
||||
ui.set_clip_rect(ui.clip_rect().intersect(Rect::from_min_size(ui.max_rect().min, vec2(inner_width, inner_height))));
|
||||
}
|
||||
if collapsed {
|
||||
browser_collapsed_rail(app, ui);
|
||||
} else {
|
||||
browser_contents(app, ui, &mut acts, true);
|
||||
}
|
||||
});
|
||||
resize_browser(app, ui, response.response.rect, width);
|
||||
if !collapsed {
|
||||
resize_column(app, ui, response.response.rect, width, "left-browser-rail");
|
||||
}
|
||||
});
|
||||
let rect = card.response.rect;
|
||||
app.shell.browser = Some(rect);
|
||||
@@ -801,7 +772,34 @@ pub fn floating(app: &mut SolveApp, ui: &mut egui::Ui, available: Rect) {
|
||||
finish_browser(app, ui, acts);
|
||||
}
|
||||
|
||||
fn floating_bounds(available: Rect, history: Option<Rect>, width: f32, top_gap: f32) -> Rect {
|
||||
fn browser_collapsed_rail(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
let t = Tokens::get();
|
||||
let title_top = t.space_24 + ui.spacing().item_spacing.y;
|
||||
let height = title_top + t.space_24 * 4.0 + t.space_8;
|
||||
let (rect, _) = ui.allocate_exact_size(vec2(ui.available_width(), height), Sense::hover());
|
||||
// Include the card margin in the hit target; keep the tint inside that margin.
|
||||
let response =
|
||||
ui.interact(rect.expand(CARD_INSET + 1.0), ui.id().with("browser_header"), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
|
||||
if response.hovered() || response.has_focus() {
|
||||
crate::ui_kit::panel_header_hover(ui.painter(), rect);
|
||||
}
|
||||
let disclosure = Rect::from_min_size(rect.min, vec2(rect.width(), t.space_24));
|
||||
crate::ui_kit::disclosure(ui.painter(), disclosure.center(), false, t.text_dim);
|
||||
crate::scenario::publish_handle("left-browser-toggle", disclosure.center());
|
||||
crate::scenario::publish_target("browser:header", disclosure);
|
||||
response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, ui.is_enabled(), crate::i18n::tr("ui.browser_title")));
|
||||
if response.on_hover_text(crate::i18n::tr("ui.browser_expand")).clicked() {
|
||||
app.preferences.timeline_left_browser_collapsed = false;
|
||||
}
|
||||
let galley = ui.painter().layout_no_wrap(crate::i18n::tr("ui.browser_title").to_owned(), crate::fonts::semibold(t.font_body), t.text);
|
||||
let title = Rect::from_min_max(rect.min + vec2(0.0, title_top), rect.max);
|
||||
ui.painter().add(
|
||||
egui::epaint::TextShape::new(title.center() - galley.size() / 2.0, galley, t.text)
|
||||
.with_angle_and_anchor(std::f32::consts::FRAC_PI_2, egui::Align2::CENTER_CENTER),
|
||||
);
|
||||
}
|
||||
|
||||
pub(crate) fn floating_bounds(available: Rect, history: Option<Rect>, width: f32, top_gap: f32) -> Rect {
|
||||
let gap = crate::shell::SHELL_GAP;
|
||||
let min = available.min + vec2(gap, top_gap);
|
||||
let right = (available.right() - gap).max(min.x);
|
||||
@@ -813,12 +811,20 @@ fn browser_contents(app: &mut SolveApp, ui: &mut egui::Ui, acts: &mut Actions, c
|
||||
let t = Tokens::get();
|
||||
// Only the floating card folds; the docked column keeps its full height.
|
||||
browser_header(app, ui, collapsible);
|
||||
if collapsible && app.tree.panel_collapsed {
|
||||
let stacked = crate::timeline_left::stacked(app);
|
||||
if collapsible
|
||||
&& (if stacked {
|
||||
(app.preferences.timeline_left_browser_collapsed && app.shell.history_folding.is_none_or(|p| p[0] >= 1.0))
|
||||
|| ui.available_height() <= t.space_3
|
||||
} else {
|
||||
app.tree.panel_collapsed && !(app.ui.show_timeline && app.preferences.timeline_left)
|
||||
})
|
||||
{
|
||||
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 {
|
||||
if collapsible && !stacked {
|
||||
browser_rows_hugging(app, ui, acts);
|
||||
} else {
|
||||
browser_rows(app, ui, acts);
|
||||
@@ -832,9 +838,14 @@ fn browser_header(app: &mut SolveApp, ui: &mut egui::Ui, collapsible: bool) {
|
||||
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_target("browser:header", rect);
|
||||
let collapsed = collapsible && app.tree.panel_collapsed;
|
||||
let vertical = app.ui.show_timeline && app.preferences.timeline_left;
|
||||
let stacked = crate::timeline_left::stacked(app);
|
||||
let collapsed = collapsible && if stacked { app.preferences.timeline_left_browser_collapsed } else { !vertical && app.tree.panel_collapsed };
|
||||
if vertical {
|
||||
crate::scenario::publish_handle("left-browser-toggle", rect.center());
|
||||
}
|
||||
if collapsible && (response.hovered() || response.has_focus()) {
|
||||
ui.painter().rect_filled(rect, t.radius_lg.saturating_sub(CARD_INSET as u8), t.hover);
|
||||
crate::ui_kit::panel_header_hover(ui.painter(), rect);
|
||||
}
|
||||
let title = crate::i18n::tr("ui.browser_title").to_string();
|
||||
let kind = if collapsible { egui::WidgetType::Button } else { egui::WidgetType::Label };
|
||||
@@ -853,8 +864,14 @@ fn browser_header(app: &mut SolveApp, ui: &mut egui::Ui, collapsible: bool) {
|
||||
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;
|
||||
if response.on_hover_cursor(egui::CursorIcon::PointingHand).on_hover_text(tip).clicked() {
|
||||
if stacked {
|
||||
app.preferences.timeline_left_browser_collapsed = !app.preferences.timeline_left_browser_collapsed;
|
||||
} else if vertical {
|
||||
app.preferences.timeline_left_browser_collapsed = true;
|
||||
} else {
|
||||
app.tree.panel_collapsed = !app.tree.panel_collapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -925,6 +942,8 @@ fn rows_scrolling(app: &mut SolveApp, ui: &mut egui::Ui, acts: &mut Actions, shr
|
||||
prepare_model(app);
|
||||
acts.lit = Lit::of(app);
|
||||
egui::ScrollArea::vertical()
|
||||
// The card may animate all the way down to its header.
|
||||
.min_scrolled_height(0.0)
|
||||
.auto_shrink([false, shrink_height])
|
||||
.scroll_source(egui::scroll_area::ScrollSource { scroll_bar: true, mouse_wheel: true, ..egui::scroll_area::ScrollSource::NONE })
|
||||
.show(ui, |ui| {
|
||||
|
||||
@@ -252,3 +252,60 @@ fn a_long_body_name_stays_inside_the_card_and_ends_in_an_ellipsis() {
|
||||
assert!(label.right() <= card.right(), "{label:?} spills out of {card:?}");
|
||||
assert!(label.width() > 100.0, "the name keeps the room it has: {label:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn collapsed_rail_shares_header_hover_inset_and_expands_from_its_whole_card() {
|
||||
let previous = crate::theme::is_dark();
|
||||
for dark in [false, true] {
|
||||
crate::theme::set_dark(dark);
|
||||
for collapsed in [false, true] {
|
||||
let ctx = crate::fonts::test_context();
|
||||
ctx.global_style_mut(|style| style.animation_time = 0.0);
|
||||
let mut app = SolveApp::new(Default::default(), Default::default());
|
||||
app.ui.tab = "SURFACE".into();
|
||||
app.preferences.timeline_left = true;
|
||||
app.preferences.timeline_left_browser_collapsed = collapsed;
|
||||
crate::theme::TabAccent::publish(&app, &ctx);
|
||||
let bounds = Rect::from_min_size(Pos2::ZERO, vec2(600.0, 700.0));
|
||||
let draw = |app: &mut SolveApp, events| {
|
||||
crate::test_support::frame(&ctx, egui::RawInput { screen_rect: Some(bounds), events, ..Default::default() }, |ui| {
|
||||
floating(app, ui, bounds);
|
||||
})
|
||||
};
|
||||
for _ in 0..3 {
|
||||
draw(&mut app, vec![]);
|
||||
}
|
||||
let card = rect_of("browser:card").unwrap();
|
||||
let header = rect_of("browser:header").unwrap();
|
||||
// Hover at the bottom margin, far away from the disclosure and rotated title.
|
||||
let at = if collapsed { card.center_bottom() - vec2(0.0, 2.0) } else { header.center() };
|
||||
draw(&mut app, vec![egui::Event::PointerMoved(at)]);
|
||||
let output = draw(&mut app, vec![egui::Event::PointerMoved(at)]);
|
||||
assert_eq!(output.platform_output.cursor_icon, egui::CursorIcon::PointingHand);
|
||||
let accent = crate::theme::TabAccent::current(&ctx);
|
||||
let mut hover = None;
|
||||
for shape in &output.shapes {
|
||||
crate::test_support::each_shape(&shape.shape, &mut |shape| {
|
||||
if let egui::Shape::Rect(rect) = shape
|
||||
&& rect.fill == accent.soft
|
||||
{
|
||||
hover = Some(rect.clone());
|
||||
}
|
||||
});
|
||||
}
|
||||
let hover =
|
||||
hover.unwrap_or_else(|| panic!("dark={dark}, collapsed={collapsed}, at={at:?}, accent={accent:?}, shapes={:?}", output.shapes));
|
||||
let inset = CARD_INSET + 1.0; // shared frame's inner margin and border
|
||||
assert_eq!(hover.rect, if collapsed { card.shrink(inset) } else { header });
|
||||
assert_eq!(hover.rect.left() - card.left(), inset);
|
||||
assert_eq!(card.right() - hover.rect.right(), inset);
|
||||
assert_eq!(hover.corner_radius, egui::CornerRadius::same(Tokens::get().radius_lg.saturating_sub(CARD_INSET as u8)));
|
||||
if collapsed {
|
||||
draw(&mut app, crate::test_support::pointer(at, true));
|
||||
draw(&mut app, crate::test_support::pointer(at, false));
|
||||
assert!(!app.preferences.timeline_left_browser_collapsed, "the bottom margin expands the rail");
|
||||
}
|
||||
}
|
||||
}
|
||||
crate::theme::set_dark(previous);
|
||||
}
|
||||
@@ -101,7 +101,7 @@ fn key_from(name: &str) -> Option<egui::Key> {
|
||||
fn execute(app: &mut SolveApp, id: &str, params: Value) -> Result<Value, String> {
|
||||
let r = app.run(id, params);
|
||||
if r.is_ok()
|
||||
&& !matches!(id, "view.navigate" | "view.ambient_occlusion" | "view.graphics_preset")
|
||||
&& !matches!(id, "view.navigate" | "view.ambient_occlusion" | "view.graphics_preset" | "view.history_layout")
|
||||
&& app.session.active_sketch.is_none()
|
||||
&& app.session.world_state().bodies.len() == 1
|
||||
&& app.session.undo.len() <= 2
|
||||
|
||||
+41
-11
@@ -743,6 +743,20 @@ impl SolveApp {
|
||||
let r = self.session.execute(id, ¶ms).map_err(|e| e.to_string());
|
||||
self.big_operation |= now_ms() - t0 >= recovery_ui::BIG_OPERATION_MS;
|
||||
if let Ok(v) = &r {
|
||||
if id == "view.history_layout" {
|
||||
if let Some(width) = v.get("width").and_then(Value::as_f64) {
|
||||
self.preferences.timeline_left_width = ui_kit::history_snap_width(width as f32);
|
||||
}
|
||||
if let Some(dock) = v.get("dock").and_then(Value::as_str) {
|
||||
self.preferences.timeline_left = dock != "bottom";
|
||||
self.preferences.timeline_under_browser = dock == "under_browser";
|
||||
self.preferences.timeline_collapsed = false;
|
||||
self.preferences.timeline_left_browser_collapsed = false;
|
||||
}
|
||||
if let Some(collapsed) = v.get("collapsed").and_then(Value::as_bool) {
|
||||
self.preferences.timeline_collapsed = collapsed;
|
||||
}
|
||||
}
|
||||
if matches!(id, "view.ambient_occlusion" | "view.graphics_preset") {
|
||||
self.preferences.ambient_occlusion = v.get("enabled").and_then(Value::as_bool).unwrap_or(false);
|
||||
if id == "view.graphics_preset" {
|
||||
@@ -872,6 +886,10 @@ impl SolveApp {
|
||||
return;
|
||||
}
|
||||
// A display toggle leaves the current modelling tool and camera in place.
|
||||
if id == "view.history_layout" {
|
||||
let _ = self.run(id, json!({}));
|
||||
return;
|
||||
}
|
||||
if id == "view.ambient_occlusion" {
|
||||
let _ = self.run(id, json!({"enabled": !self.preferences.ambient_occlusion}));
|
||||
return;
|
||||
@@ -1529,6 +1547,7 @@ impl SolveApp {
|
||||
let floating = self.ui.layout == shell::LayoutMode::Floating;
|
||||
let show_timeline = self.ui.show_timeline && !render_workspace::active(self);
|
||||
let left_timeline = show_timeline && self.preferences.timeline_left;
|
||||
timeline_left::animate_folds(self, ui.ctx());
|
||||
if !floating {
|
||||
toolbar::toolbar(self, ui);
|
||||
}
|
||||
@@ -1537,16 +1556,23 @@ impl SolveApp {
|
||||
timeline::timeline(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 || (floating && !left_timeline));
|
||||
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;
|
||||
if floating || left_timeline || !show_timeline {
|
||||
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));
|
||||
self.shell.history = if left_timeline {
|
||||
let below_ribbon = egui::Rect::from_min_max(egui::pos2(full.left(), cards.bottom), full.max);
|
||||
Some(timeline_left::floating_rect(self, below_ribbon))
|
||||
} else {
|
||||
show_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());
|
||||
@@ -1572,15 +1598,12 @@ impl SolveApp {
|
||||
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);
|
||||
} else {
|
||||
browser::browser(self, ui);
|
||||
}
|
||||
} else if left_timeline {
|
||||
if left_timeline {
|
||||
timeline_left::left_panel(self, ui);
|
||||
}
|
||||
if self.ui.show_browser && !browser_float {
|
||||
browser::browser(self, ui);
|
||||
}
|
||||
if render_workspace::active(self) {
|
||||
render_workspace::panel(self, ui);
|
||||
}
|
||||
@@ -1590,13 +1613,20 @@ impl SolveApp {
|
||||
let viewport = ui.available_rect_before_wrap();
|
||||
browser::floating(self, ui, viewport);
|
||||
}
|
||||
if !floating && timeline_left::stacked(self) {
|
||||
let width = browser::browser_width(self.preferences.browser_width) + shell::SHELL_GAP * 2.0;
|
||||
egui::Panel::left("sc_history_browser_column").exact_size(width).resizable(false).frame(egui::Frame::NONE).show(ui, |_| {});
|
||||
}
|
||||
egui::CentralPanel::default().frame(egui::Frame::NONE).show(ui, |ui| {
|
||||
if floating {
|
||||
let panel_content = ui.max_rect();
|
||||
let mut content = panel_content;
|
||||
if let Some(history) = self.shell.history {
|
||||
if let Some(history) = self.shell.history.filter(|_| !left_timeline) {
|
||||
content.max.y = (history.top() - shell::SHELL_GAP).max(content.top());
|
||||
}
|
||||
if left_timeline && let Some(history) = self.shell.history {
|
||||
content.min.x = (history.right() + shell::SHELL_GAP).min(content.right());
|
||||
}
|
||||
if let Some(browser) = self.shell.browser {
|
||||
content.min.x = (browser.right() + shell::SHELL_GAP).min(content.right());
|
||||
}
|
||||
|
||||
@@ -444,14 +444,19 @@ preference_settings! {
|
||||
/// Interface font: an installed font family (or a font file), or empty for the built-in one
|
||||
/// (#1290). Menus, dialogs and labels use it; glyphs it lacks fall back as before.
|
||||
ui_font: String = String::new(), 0;
|
||||
/// Put the feature history above the parts browser in the left sidebar instead of along the
|
||||
/// bottom of the viewport.
|
||||
/// Put the feature history to the left of the browser instead of below the viewport.
|
||||
timeline_left: bool = false, 0;
|
||||
/// Height of the feature-history section when it shares the left sidebar with the browser.
|
||||
/// Measured outer width; the contents react to this width without a names mode.
|
||||
timeline_left_width: f32 = 130.0, 0;
|
||||
/// Share the browser column, vertically, instead of a separate left column.
|
||||
timeline_under_browser: bool = false, 0;
|
||||
/// Fold the shared-column history to its header.
|
||||
timeline_collapsed: bool = false, 0;
|
||||
/// Legacy shared-column height, retained for preference compatibility.
|
||||
timeline_left_height: f32 = 360.0, 0;
|
||||
/// Whether the browser below the left feature history is collapsed.
|
||||
/// Whether the browser beside the vertical history is collapsed to its rail.
|
||||
timeline_left_browser_collapsed: bool = false, 0;
|
||||
/// Width of the left sidebar holding the browser (and the feature history above it), which
|
||||
/// Width of the browser sidebar, which
|
||||
/// the user drags wider or narrower at its right edge.
|
||||
browser_width: f32 = DEFAULT_BROWSER_WIDTH, 0;
|
||||
/// Draw the parts browser on a translucent card over the 3D view instead of a column of its
|
||||
@@ -1138,14 +1143,18 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
|
||||
ui_kit::row(ui, app.tr_label("Interface font"), |ui| ui_font_row(app, ui));
|
||||
}
|
||||
ui_kit::row(ui, app.tr("ui.feature_history"), |ui| {
|
||||
let mut selected = usize::from(app.preferences.timeline_left);
|
||||
let mut selected = if app.preferences.timeline_left { if app.preferences.timeline_under_browser { 2 } else { 1 } } else { 0 };
|
||||
if ui_kit::segmented(
|
||||
ui,
|
||||
&mut selected,
|
||||
&[crate::i18n::tr("ui.timeline_bottom"), crate::i18n::tr("ui.timeline_left_sidebar")],
|
||||
&[
|
||||
crate::i18n::tr("ui.timeline_bottom"),
|
||||
crate::i18n::tr("ui.timeline_left_sidebar"),
|
||||
crate::i18n::tr("ui.history_below_browser"),
|
||||
],
|
||||
Default::default(),
|
||||
) {
|
||||
app.preferences.timeline_left = selected == 1;
|
||||
let _ = app.run("view.history_layout", json!({"dock": match selected { 1=>"left",2=>"under_browser",_=>"bottom" }}));
|
||||
}
|
||||
});
|
||||
ui_kit::text(ui, app.tr("ui.timeline_left_note"), ui_kit::Text::Note("timeline"));
|
||||
|
||||
@@ -80,6 +80,13 @@ pub(crate) struct State {
|
||||
pub panels: Vec<Rect>,
|
||||
pub browser: Option<Rect>,
|
||||
pub history: Option<Rect>,
|
||||
/// In-memory seam drag width, never serialized as a preference.
|
||||
pub history_drag_width: Option<f32>,
|
||||
/// Unreserved canvas bounds used by History docking targets.
|
||||
pub history_dock_space: Option<Rect>,
|
||||
/// Browser/history collapse progress shared by both cards for this frame.
|
||||
pub history_folding: Option<[f32; 2]>,
|
||||
pub history_fold_motion: Option<[crate::timeline_left::FoldMotion; 2]>,
|
||||
pub content: Option<Rect>,
|
||||
}
|
||||
|
||||
@@ -91,6 +98,9 @@ pub(crate) fn covered_rects(app: &SolveApp) -> Vec<Rect> {
|
||||
rects.extend(app.shell.panels.iter().copied());
|
||||
rects.extend(app.shell.history);
|
||||
}
|
||||
if app.ui.show_timeline && app.preferences.timeline_left {
|
||||
rects.extend(app.shell.history.map(|card| crate::ui_kit::HistorySeam::new(card).pill));
|
||||
}
|
||||
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() || app.tree.redefine.is_some()));
|
||||
|
||||
@@ -230,9 +230,9 @@ 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_eq!(h.app.shell.browser.is_some(), mode == LayoutMode::Floating && !timeline_left);
|
||||
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);
|
||||
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;
|
||||
@@ -284,7 +284,7 @@ fn browser_and_history_cards_block_input_while_their_gaps_and_space_below_browse
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn left_history_keeps_the_existing_column_in_both_modes() {
|
||||
fn left_history_and_browser_share_the_left_edge_without_moving_right_controls() {
|
||||
for mode in [LayoutMode::Floating, LayoutMode::Docked] {
|
||||
let mut h = Harness::new();
|
||||
h.app.ui.layout = mode;
|
||||
@@ -292,14 +292,21 @@ fn left_history_keeps_the_existing_column_in_both_modes() {
|
||||
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());
|
||||
let history = rect_of("history:vertical").unwrap();
|
||||
let browser = rect_of("browser:card").unwrap();
|
||||
assert!(history.right() < browser.left());
|
||||
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!(viewport.left(), if mode == LayoutMode::Floating { 0.0 } else { crate::ui_kit::history_width(true) });
|
||||
assert_eq!(content.left(), if mode == LayoutMode::Floating { browser.right() + SHELL_GAP } else { viewport.left() });
|
||||
assert_eq!(content.bottom(), viewport.bottom());
|
||||
if mode == LayoutMode::Floating {
|
||||
assert!(covered(&h.app, pos2(125.0, content.center().y)));
|
||||
assert!(covered(&h.app, history.center()));
|
||||
assert!(covered(&h.app, browser.center()));
|
||||
let gap_x = (history.right() + browser.left()) / 2.0;
|
||||
assert!(covered(&h.app, pos2(gap_x, history.center().y)), "the seam pill shields viewport input");
|
||||
assert!(!covered(&h.app, pos2(gap_x, history.top() + 4.0)), "the rest of the shell gap remains available");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
//! The timeline (bottom): features in order, the rollback marker, errors and warnings.
|
||||
|
||||
pub(crate) use crate::icons::glyphs::transport_glyph;
|
||||
use egui::{Rect, Sense, Stroke, UiBuilder, pos2, vec2};
|
||||
use serde_json::{Value, json};
|
||||
use solidcraft_engine::doc::{
|
||||
@@ -8,8 +7,23 @@ use solidcraft_engine::doc::{
|
||||
construct::{AxisDef, PointDef},
|
||||
};
|
||||
|
||||
use crate::SolveApp;
|
||||
use crate::theme::Tokens;
|
||||
use crate::{SolveApp, icons};
|
||||
|
||||
/// Apply transport actions from the current marker; endpoints stay bounded, including an
|
||||
/// empty design. All orientations reach the same rollback command.
|
||||
pub(crate) fn run_transport(app: &mut SolveApp, control: crate::ui_kit::HistoryTransport) {
|
||||
let n = app.session.doc.features.len();
|
||||
let marker = app.session.doc.marker.unwrap_or(n);
|
||||
let position = match control {
|
||||
crate::ui_kit::HistoryTransport::First => 0,
|
||||
crate::ui_kit::HistoryTransport::Back => marker.saturating_sub(1),
|
||||
crate::ui_kit::HistoryTransport::Forward => marker.saturating_add(1).min(n),
|
||||
crate::ui_kit::HistoryTransport::Last => n,
|
||||
};
|
||||
let params = if position < n { json!({"position":position}) } else { json!({}) };
|
||||
let _ = app.run_heavy("timeline.roll_to", params);
|
||||
}
|
||||
|
||||
// Snapshot only the data used by timeline interactions. Cloning FeatureKind here would
|
||||
// also copy imported mesh vertices and triangles on every frame.
|
||||
@@ -255,6 +269,7 @@ fn toggle_feature(app: &mut SolveApp, id: u64) {
|
||||
|
||||
pub fn timeline(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
let t = Tokens::get();
|
||||
app.shell.history_dock_space = Some(ui.available_rect_before_wrap());
|
||||
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
|
||||
@@ -273,6 +288,7 @@ pub fn timeline(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
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);
|
||||
});
|
||||
app.shell.history = Some(response.response.rect);
|
||||
crate::scenario::publish_rect("history:strip", response.response.rect);
|
||||
}
|
||||
}
|
||||
@@ -295,36 +311,27 @@ fn timeline_contents(app: &mut SolveApp, ui: &mut egui::Ui, floating: bool) {
|
||||
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);
|
||||
let grip_rect = Rect::from_center_size(pos2(x + t.space_10 / 2.0, r.center().y), vec2(t.space_10, t.space_16 + t.space_2));
|
||||
let mut grip_ui = ui.new_child(UiBuilder::new().max_rect(grip_rect).layout(egui::Layout::left_to_right(egui::Align::Center)));
|
||||
let grip = crate::ui_kit::panel_grip(&mut grip_ui).rect;
|
||||
x += t.space_10 + t.space_8;
|
||||
let mut drag_rect = grip;
|
||||
let label = p.layout_no_wrap(crate::i18n::tr("ui.history_title").to_string(), crate::fonts::semibold(t.font_heading), t.text);
|
||||
if x + label.size().x + t.space_12 + crate::ui_kit::history_transport_width() <= r.right() {
|
||||
let title_rect = Rect::from_min_size(pos2(x, r.center().y - label.size().y / 2.0), label.size());
|
||||
p.galley(title_rect.min, label.clone(), t.text);
|
||||
drag_rect = drag_rect.union(title_rect);
|
||||
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);
|
||||
let response = ui.interact(drag_rect, egui::Id::new("sc_history_dock_grip"), Sense::drag());
|
||||
crate::scenario::publish_handle("history:grip", drag_rect.center());
|
||||
crate::timeline_left::dock_drag(app, ui, &response);
|
||||
for control in crate::ui_kit::HistoryTransport::ALL {
|
||||
let br = Rect::from_center_size(pos2(x + t.space_24 / 2.0, r.center().y), vec2(t.space_24, t.space_24));
|
||||
if control.show(ui, br).clicked() {
|
||||
run_transport(app, control);
|
||||
}
|
||||
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 += t.space_24 + t.space_2;
|
||||
}
|
||||
x += 14.0;
|
||||
// The features scroll horizontally in the space right of the playback controls.
|
||||
@@ -360,8 +367,8 @@ fn timeline_contents(app: &mut SolveApp, ui: &mut egui::Ui, floating: bool) {
|
||||
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;
|
||||
marker_rect = Some(Rect::from_min_size(pos2(x, r.top() + 5.0), vec2(t.space_12, r.height() - 10.0)));
|
||||
x += t.space_16;
|
||||
}
|
||||
xs.push(x);
|
||||
let br = Rect::from_min_size(pos2(x, r.top() + 6.0), vec2(28.0, 28.0));
|
||||
@@ -376,49 +383,19 @@ fn timeline_contents(app: &mut SolveApp, ui: &mut egui::Ui, floating: bool) {
|
||||
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 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),
|
||||
crate::ui_kit::HistoryChip {
|
||||
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,
|
||||
Rect::from_min_size(br.right_top() - vec2(10.0, 0.0), vec2(10.0, 10.0)),
|
||||
"warning",
|
||||
t.icon,
|
||||
t.warning,
|
||||
t.warning,
|
||||
);
|
||||
name,
|
||||
kind: ty,
|
||||
selected: sel || (floating && marker > 0 && i == marker - 1),
|
||||
hovered: resp.hovered() || from_view == Some(*id),
|
||||
dim: rolled,
|
||||
suppressed: *suppressed,
|
||||
error: err.is_some(),
|
||||
warning: warn.is_some(),
|
||||
accent,
|
||||
}
|
||||
.paint(&p, br, crate::ui_kit::HistoryStyle::Bottom);
|
||||
let mut tip = status_text(name, ty, err.as_deref(), warn.as_deref());
|
||||
if let Some(r) = res {
|
||||
tip += &format!("\n{:.1} ms", r.ms);
|
||||
@@ -488,7 +465,7 @@ fn timeline_contents(app: &mut SolveApp, ui: &mut egui::Ui, floating: bool) {
|
||||
}
|
||||
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)));
|
||||
marker_rect = Some(Rect::from_min_size(pos2(x, r.top() + 5.0), vec2(t.space_12, r.height() - 10.0)));
|
||||
}
|
||||
// The history marker: drag it to roll the model back or forward.
|
||||
if let Some(mr) = marker_rect {
|
||||
@@ -497,14 +474,7 @@ fn timeline_contents(app: &mut SolveApp, ui: &mut egui::Ui, floating: bool) {
|
||||
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);
|
||||
crate::ui_kit::history_marker(&p, mr, false, accent);
|
||||
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);
|
||||
@@ -514,9 +484,11 @@ fn timeline_contents(app: &mut SolveApp, ui: &mut egui::Ui, floating: bool) {
|
||||
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 }),
|
||||
crate::ui_kit::history_drop_bar(
|
||||
&p,
|
||||
Rect::from_min_max(pos2(sx, r.top() + 3.0), pos2(sx, r.bottom() - 3.0)),
|
||||
false,
|
||||
if matches!(dg, Drag::Marker) { accent.color } else { t.sketch_accent },
|
||||
);
|
||||
}
|
||||
let released = ui.input(|i| i.pointer.any_released());
|
||||
@@ -852,6 +824,7 @@ mod tests {
|
||||
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)));
|
||||
assert!(out.shapes.iter().any(|s| matches!(&s.shape, egui::Shape::Circle(c)
|
||||
if marker.contains(c.center) && c.fill == t.timeline && c.stroke == egui::Stroke::new(t.space_2, accent.color))));
|
||||
}
|
||||
}
|
||||
+782
-160
File diff suppressed because it is too large.
Load diff
@@ -13,13 +13,26 @@ pub(crate) fn disclosure(painter: &Painter, center: Pos2, open: bool, ink: Color
|
||||
/// Fold action in existing chrome. Stable identity across state changes, with the caller's
|
||||
/// translated tooltip and scenario handles. Tokens: control_radius, hover, form_ink/dim.
|
||||
pub(crate) fn disclosure_button_at(ui: &mut Ui, rect: Rect, open: bool, label: &str) -> Response {
|
||||
disclosure_button_with_hover(ui, rect, open, label, false)
|
||||
}
|
||||
|
||||
/// Panel fold action with the browser's shared blue hover tint.
|
||||
pub(crate) fn panel_disclosure_button_at(ui: &mut Ui, rect: Rect, open: bool, label: &str) -> Response {
|
||||
disclosure_button_with_hover(ui, rect, open, label, true)
|
||||
}
|
||||
|
||||
fn disclosure_button_with_hover(ui: &mut Ui, rect: Rect, open: bool, label: &str, panel: bool) -> Response {
|
||||
let t = Tokens::get();
|
||||
let response = ui.interact(rect, ui.make_persistent_id("disclosure_button"), egui::Sense::click());
|
||||
if response.clicked() {
|
||||
response.request_focus();
|
||||
}
|
||||
if response.hovered() {
|
||||
ui.painter().rect_filled(rect, t.control_radius, t.hover);
|
||||
if panel {
|
||||
super::panel_header_hover(ui.painter(), rect);
|
||||
} else {
|
||||
ui.painter().rect_filled(rect, t.control_radius, t.hover);
|
||||
}
|
||||
}
|
||||
disclosure(ui.painter(), rect.center(), open, if response.hovered() || response.has_focus() { t.form_ink } else { t.form_dim });
|
||||
response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::CollapsingHeader, ui.is_enabled(), open, label));
|
||||
|
||||
@@ -28,6 +28,32 @@ macro_rules! element {
|
||||
|
||||
// One entry per element/variant: names, rendering and geometry expectations stay together.
|
||||
const ELEMENTS: &[Element] = &[
|
||||
element!("history_transport", |ui, _| {
|
||||
ui.horizontal(|ui| {
|
||||
let side = Tokens::get().space_24;
|
||||
for control in HistoryTransport::ALL {
|
||||
let (rect, _) = ui.allocate_exact_size(vec2(side, side), egui::Sense::hover());
|
||||
control.show(ui, rect);
|
||||
}
|
||||
});
|
||||
}),
|
||||
element!("history_marker", |ui, _| {
|
||||
let t = Tokens::get();
|
||||
let accent = crate::theme::TabAccent::for_tab(&t, "SURFACE");
|
||||
ui.horizontal(|ui| {
|
||||
let (rect, _) = ui.allocate_exact_size(vec2(t.space_24 * 7.0, t.space_12), egui::Sense::hover());
|
||||
ui.painter().rect_filled(rect, 0.0, t.panel);
|
||||
history_marker(ui.painter(), rect, true, accent);
|
||||
let (rect, _) = ui.allocate_exact_size(vec2(t.space_12, t.control_height), egui::Sense::hover());
|
||||
ui.painter().rect_filled(rect, 0.0, t.timeline);
|
||||
history_marker(ui.painter(), rect, false, accent);
|
||||
});
|
||||
}),
|
||||
element!("history_seam_rest", |ui, _| history_seam_example(ui, HistoryHandleState::Rest)),
|
||||
element!("history_seam_hover", |ui, _| history_seam_example(ui, HistoryHandleState::Hover)),
|
||||
element!("history_seam_drag", |ui, _| history_seam_example(ui, HistoryHandleState::Drag)),
|
||||
element!("history_icons", |ui, _| history_example(ui, false)),
|
||||
element!("history_names", |ui, _| history_example(ui, true)),
|
||||
element!("command_search", |ui, _| {
|
||||
let mut query = "fillet".to_owned();
|
||||
CommandSearch::field(
|
||||
@@ -441,6 +467,13 @@ const ELEMENTS: &[Element] = &[
|
||||
ui.push_id(open, |ui| disclosure_button_at(ui, rect, open, crate::i18n::tr_label(if open { "Collapse" } else { "Expand" })));
|
||||
}
|
||||
}),
|
||||
element!("panel_disclosure_button_at", |ui, _| {
|
||||
let t = Tokens::get();
|
||||
for open in [true, false] {
|
||||
let (rect, _) = ui.allocate_exact_size(vec2(t.form_close_size, t.form_close_size), egui::Sense::hover());
|
||||
ui.push_id(open, |ui| panel_disclosure_button_at(ui, rect, open, crate::i18n::tr_label(if open { "Collapse" } else { "Expand" })));
|
||||
}
|
||||
}),
|
||||
element!("dropdown_indicator", |ui, _| {
|
||||
let t = Tokens::get();
|
||||
let (rect, _) = ui.allocate_exact_size(vec2(t.form_section_icon_size, t.form_section_icon_size), egui::Sense::hover());
|
||||
@@ -713,7 +746,7 @@ const ELEMENTS: &[Element] = &[
|
||||
fn example(ui: &mut Ui, element: &Element) -> (&'static str, Option<&'static str>) {
|
||||
let mut sample = Sample { value: "12 mm".into(), second: "25 mm".into(), selected: 0, checked: true };
|
||||
let rect = ui.scope(|ui| (element.draw)(ui, &mut sample)).response.rect;
|
||||
if matches!(element.name, "menu" | "menu_submenu" | "rename_menu" | "workspace_menu" | "command_search") {
|
||||
if matches!(element.name, "menu" | "menu_submenu" | "rename_menu" | "workspace_menu" | "command_search" | "history_icons" | "history_names") {
|
||||
// A popup's elevation is painted outside its layout rectangle. Reserve those
|
||||
// actual shadow bounds as part of the gallery sample, keeping the paint guard strict.
|
||||
ui.expand_to_include_rect(rect + Menu::frame().shadow.margin());
|
||||
@@ -1070,6 +1103,112 @@ fn gallery_covers_every_inline_element() {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn history_seam_example(ui: &mut Ui, state: HistoryHandleState) {
|
||||
let t = Tokens::get();
|
||||
let allocation = ui.allocate_space(vec2(280.0, 250.0)).1;
|
||||
for (names, offset) in [(false, 0.0), (true, 125.0)] {
|
||||
let width = if state == HistoryHandleState::Drag { 112.0 } else { history_width(names) };
|
||||
// Separate samples vertically so the guide/chip fits within the gallery allocation.
|
||||
let card = egui::Rect::from_min_size(allocation.min + vec2(t.space_8, offset + t.space_8), vec2(width, 104.0));
|
||||
ui.painter().rect(card, t.radius_lg, t.panel, egui::Stroke::new(1.0, t.border), egui::StrokeKind::Inside);
|
||||
HistorySeam::new(card).paint(ui.painter(), card, names, state);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn history_example(ui: &mut Ui, names: bool) {
|
||||
let mut app = crate::test_support::sample_app();
|
||||
app.preferences.timeline_left = true;
|
||||
app.preferences.timeline_left_width = crate::ui_kit::history_width(names);
|
||||
app.run("timeline.roll_to", serde_json::json!({"position":3})).unwrap();
|
||||
let feature = app.session.doc.features.get(2).unwrap().id;
|
||||
app.run("select.set", serde_json::json!({"items":[{"type":"feature","id":feature}]})).unwrap();
|
||||
let width = crate::timeline_left::strip_width(&app);
|
||||
let rect = ui.allocate_space(vec2(width, 650.0)).1;
|
||||
ui.scope_builder(egui::UiBuilder::new().max_rect(rect.shrink(5.0)), |ui| {
|
||||
ui.painter().add(crate::frame::shell_card(Tokens::get().panel).paint(rect));
|
||||
crate::timeline_left::left_timeline(&mut app, ui);
|
||||
});
|
||||
}
|
||||
|
||||
/// CPU captures of the actual vertical strip and browser, in both themes and widths.
|
||||
#[test]
|
||||
fn history_board_in_both_themes_and_widths() {
|
||||
use super::checks::tests::{raster, textures_update};
|
||||
use std::collections::HashMap;
|
||||
let previous = crate::theme::is_dark();
|
||||
for dark in [false, true] {
|
||||
for names in [false, true] {
|
||||
for collapsed in [false, true] {
|
||||
for state in [HistoryHandleState::Rest, HistoryHandleState::Hover, HistoryHandleState::Drag] {
|
||||
crate::theme::set_dark(dark);
|
||||
let ctx = crate::fonts::test_context();
|
||||
ctx.set_visuals(if dark { egui::Visuals::dark() } else { egui::Visuals::light() });
|
||||
ctx.global_style_mut(|style| style.animation_time = 0.0);
|
||||
let mut app = crate::test_support::sample_app();
|
||||
app.preferences.timeline_left = true;
|
||||
app.preferences.timeline_left_width = crate::ui_kit::history_width(names);
|
||||
app.preferences.timeline_left_browser_collapsed = collapsed;
|
||||
app.run("timeline.roll_to", serde_json::json!({"position":3})).unwrap();
|
||||
let feature = app.session.doc.features.get(2).unwrap().id;
|
||||
app.run("select.set", serde_json::json!({"items":[{"type":"feature","id":feature}]})).unwrap();
|
||||
let bounds = egui::Rect::from_min_size(egui::Pos2::ZERO, vec2(560.0, 680.0));
|
||||
let mut textures = HashMap::new();
|
||||
let mut image = None;
|
||||
let mut drag_start = None;
|
||||
for pass in 0..9 {
|
||||
let mut events = vec![];
|
||||
if pass >= 2 {
|
||||
let card = app.shell.history.unwrap();
|
||||
if state == HistoryHandleState::Hover {
|
||||
events.push(egui::Event::PointerMoved(card.right_center()));
|
||||
} else if state == HistoryHandleState::Drag {
|
||||
let start = *drag_start.get_or_insert(egui::pos2(card.right() - 4.0, card.top() + 12.0));
|
||||
if pass == 2 {
|
||||
events = crate::test_support::pointer(start, true);
|
||||
} else if pass == 3 {
|
||||
events.push(egui::Event::PointerMoved(start + vec2(112.0 - history_width(names), 0.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut output = ctx.run_ui(
|
||||
egui::RawInput { screen_rect: Some(bounds), time: Some(pass as f64 * 0.2), focused: true, events, ..Default::default() },
|
||||
|ui| {
|
||||
ui.painter().rect_filled(bounds, 0.0, Tokens::get().viewport_top);
|
||||
crate::timeline_left::left_panel(&mut app, ui);
|
||||
crate::browser::floating(&mut app, ui, bounds);
|
||||
},
|
||||
);
|
||||
textures_update(&mut textures, &output.textures_delta);
|
||||
output.textures_delta.clear();
|
||||
image = Some(raster(&ctx, output.shapes, output.pixels_per_point, bounds, &textures));
|
||||
}
|
||||
if state == HistoryHandleState::Drag {
|
||||
assert_eq!(app.shell.history_drag_width, Some(112.0));
|
||||
assert_eq!(app.shell.history.unwrap().width(), 112.0);
|
||||
}
|
||||
assert!(app.shell.history.unwrap().right() < app.shell.browser.unwrap().left());
|
||||
if let Ok(dir) = std::env::var("SOLIDCRAFT_HISTORY_EVIDENCE") {
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
image
|
||||
.unwrap()
|
||||
.save(std::path::Path::new(&dir).join(format!(
|
||||
"history-{}-{}-{}-{:?}.png",
|
||||
if names { "names" } else { "icons" },
|
||||
if collapsed { "rail" } else { "browser" },
|
||||
if dark { "dark" } else { "light" },
|
||||
state
|
||||
)))
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
crate::theme::set_dark(previous);
|
||||
}
|
||||
|
||||
/// Render actual egui geometry without a desktop window. Opt-in PNGs are reviewer evidence.
|
||||
#[test]
|
||||
fn menu_board_in_both_themes() {
|
||||
@@ -1186,20 +1325,20 @@ fn command_search_board_in_both_themes() {
|
||||
}
|
||||
|
||||
/// Exercise the actual surface painters, including deliberately shared artwork whose
|
||||
/// own accent differs from its tone or tab.
|
||||
/// own accent differs from its tone, tab or feature kind.
|
||||
#[test]
|
||||
fn confirm_radial_and_menu_danger_keep_multitone_artwork() {
|
||||
fn confirm_radial_and_history_rows_keep_multitone_artwork() {
|
||||
let previous = crate::theme::is_dark();
|
||||
for dark in [false, true] {
|
||||
crate::theme::set_dark(dark);
|
||||
let mut cases = vec![
|
||||
("warning", "extrude", "MODEL", Some("construction"), 20),
|
||||
("danger", "extrude", "MODEL", Some("constraint"), 20),
|
||||
("info", "extrude", "MODEL", None, 20),
|
||||
("warning", "status_warning", "MODEL", Some("construction"), 20),
|
||||
("danger", "delete", "MODEL", Some("constraint"), 20),
|
||||
("danger_menu", "delete", "MODEL", Some("constraint"), 16),
|
||||
("info", "surface_extrude", "MODEL", None, 20),
|
||||
("warning", "extrude", "", "MODEL", Some("construction"), 20),
|
||||
("danger", "extrude", "", "MODEL", Some("constraint"), 20),
|
||||
("info", "extrude", "", "MODEL", None, 20),
|
||||
("warning", "status_warning", "", "MODEL", Some("construction"), 20),
|
||||
("danger", "delete", "", "MODEL", Some("constraint"), 20),
|
||||
("danger_menu", "delete", "", "MODEL", Some("constraint"), 16),
|
||||
("info", "surface_extrude", "", "MODEL", None, 20),
|
||||
];
|
||||
for (tab, ramp) in [
|
||||
("SKETCH", Some("sketch")),
|
||||
@@ -1212,11 +1351,26 @@ fn confirm_radial_and_menu_danger_keep_multitone_artwork() {
|
||||
("unknown", None),
|
||||
] {
|
||||
for surface in ["radial", "radial_hover"] {
|
||||
cases.push((surface, "extrude", tab, ramp, 24));
|
||||
cases.push((surface, "extrude", "", tab, ramp, 24));
|
||||
}
|
||||
}
|
||||
for (kind, ramp) in [
|
||||
("Sketch", Some("sketch")),
|
||||
("SurfaceExtrudeFeature", Some("surface")),
|
||||
("MeshFeature", Some("mesh")),
|
||||
("FormFeature", Some("form")),
|
||||
("ExtrudeFeature", None),
|
||||
] {
|
||||
for (surface, side) in [("history_names", 15), ("history_icons", 19)] {
|
||||
cases.push((surface, "extrude", kind, "MODEL", ramp, side));
|
||||
}
|
||||
}
|
||||
// Surface feature names without the Surface prefix use the same alias rule
|
||||
// as the browser's timeline::icon_of assignments.
|
||||
cases.push(("history_names", "surface_extrude", "ExtrudeFeature", "MODEL", Some("surface"), 15));
|
||||
cases.push(("history_names", "continuity", "MatchFeature", "MODEL", Some("surface"), 15));
|
||||
let mut dominant_accents: std::collections::HashMap<&str, std::collections::HashSet<egui::Color32>> = std::collections::HashMap::new();
|
||||
for (surface, icon, tab, ramp, side) in cases {
|
||||
for (surface, icon, kind, tab, ramp, side) in cases {
|
||||
let ctx = crate::fonts::test_context();
|
||||
ctx.set_visuals(if dark { egui::Visuals::dark() } else { egui::Visuals::light() });
|
||||
let mut app = crate::SolveApp::new(Default::default(), Default::default());
|
||||
@@ -1239,6 +1393,26 @@ fn confirm_radial_and_menu_danger_keep_multitone_artwork() {
|
||||
item.danger = true;
|
||||
item.show(ui);
|
||||
}
|
||||
"history_names" | "history_icons" => {
|
||||
let style = if surface == "history_names" { HistoryStyle::Names } else { HistoryStyle::Icons };
|
||||
HistoryChip {
|
||||
icon,
|
||||
name: "Extrude1",
|
||||
kind,
|
||||
selected: false,
|
||||
hovered: false,
|
||||
dim: false,
|
||||
suppressed: false,
|
||||
error: false,
|
||||
warning: false,
|
||||
accent: crate::theme::TabAccent::for_tab(&Tokens::get(), "MODEL"),
|
||||
}
|
||||
.paint(
|
||||
ui.painter(),
|
||||
egui::Rect::from_min_size(egui::pos2(20.0, 20.0), vec2(158.0, style.height())),
|
||||
style,
|
||||
);
|
||||
}
|
||||
_ => {
|
||||
let tone = match surface {
|
||||
"warning" => Tone::Warning,
|
||||
@@ -1260,7 +1434,7 @@ fn confirm_radial_and_menu_danger_keep_multitone_artwork() {
|
||||
})
|
||||
.expect("the surface must upload its icon texture");
|
||||
let colours: std::collections::HashSet<_> = image.pixels.iter().filter(|pixel| pixel.a() == 255).copied().collect();
|
||||
assert!(colours.len() >= 2, "{surface}/{icon}/{tab}, dark={dark}: opaque artwork is a silhouette");
|
||||
assert!(colours.len() >= 2, "{surface}/{icon}/{kind}/{tab}, dark={dark}: opaque artwork is a silhouette");
|
||||
let resolved = crate::icon_svg::resolve(icon);
|
||||
assert!(!resolved.placeholder, "{icon} needs a master");
|
||||
let look = crate::icon_svg::Look { dark, accent: ramp.and_then(crate::icon_svg::accent_index), vision: crate::theme::vision() };
|
||||
@@ -1282,7 +1456,7 @@ fn confirm_radial_and_menu_danger_keep_multitone_artwork() {
|
||||
assert_eq!(
|
||||
image.as_ref(),
|
||||
&egui::ColorImage::from_rgba_premultiplied([side, side], expected.data()),
|
||||
"{surface}/{tab}: preserve roles with {ramp:?}"
|
||||
"{surface}/{kind}/{tab}: preserve roles with {ramp:?}"
|
||||
);
|
||||
if icon == "extrude" {
|
||||
let dominant = ["active-1", "active-2", "active-3"]
|
||||
@@ -1293,7 +1467,7 @@ fn confirm_radial_and_menu_danger_keep_multitone_artwork() {
|
||||
.into_iter()
|
||||
.max_by_key(|(count, _)| *count)
|
||||
.unwrap();
|
||||
assert!(dominant.0 > 0, "{surface}/{tab}: missing accent pixels");
|
||||
assert!(dominant.0 > 0, "{surface}/{kind}/{tab}: missing accent pixels");
|
||||
let group = if matches!(surface, "warning" | "danger" | "info") { "confirm" } else { surface };
|
||||
dominant_accents.entry(group).or_default().insert(dominant.1);
|
||||
}
|
||||
@@ -1302,11 +1476,13 @@ fn confirm_radial_and_menu_danger_keep_multitone_artwork() {
|
||||
super::checks::tests::textures_update(&mut textures, &output.textures_delta);
|
||||
let capture = super::checks::tests::raster(&ctx, output.shapes.clone(), output.pixels_per_point, bounds, &textures);
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
capture.save(std::path::Path::new(&dir).join(format!("{surface}-{icon}-{tab}-{}.png", if dark { "dark" } else { "light" }))).unwrap();
|
||||
capture
|
||||
.save(std::path::Path::new(&dir).join(format!("{surface}-{icon}-{kind}-{tab}-{}.png", if dark { "dark" } else { "light" })))
|
||||
.unwrap();
|
||||
}
|
||||
output.textures_delta.clear();
|
||||
}
|
||||
for (group, count) in [("confirm", 3), ("radial", 5), ("radial_hover", 5)] {
|
||||
for (group, count) in [("confirm", 3), ("radial", 5), ("radial_hover", 5), ("history_names", 5), ("history_icons", 5)] {
|
||||
assert_eq!(dominant_accents[group].len(), count, "{group}, dark={dark}: dominant accent pixels must differ across mappings");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,687 @@
|
||||
//! Shared history chips, dense name rows, drop bars and rollback markers.
|
||||
use crate::{
|
||||
icons,
|
||||
theme::{TabAccent, Tokens},
|
||||
};
|
||||
use egui::{Painter, Rect, Stroke, pos2, vec2};
|
||||
|
||||
/// Browser and named history rows use the same density.
|
||||
pub(crate) const TREE_ROW_HEIGHT: f32 = 26.0;
|
||||
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
pub(crate) enum HistoryStyle {
|
||||
Bottom,
|
||||
Icons,
|
||||
Names,
|
||||
}
|
||||
|
||||
impl HistoryStyle {
|
||||
pub fn height(self) -> f32 {
|
||||
let t = Tokens::get();
|
||||
match self {
|
||||
Self::Bottom => t.control_height,
|
||||
Self::Icons => t.control_height + t.space_10,
|
||||
Self::Names => TREE_ROW_HEIGHT,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct HistoryChip<'a> {
|
||||
pub icon: &'a str,
|
||||
pub name: &'a str,
|
||||
pub kind: &'a str,
|
||||
pub selected: bool,
|
||||
pub hovered: bool,
|
||||
pub dim: bool,
|
||||
pub suppressed: bool,
|
||||
pub error: bool,
|
||||
pub warning: bool,
|
||||
pub accent: TabAccent,
|
||||
}
|
||||
|
||||
/// Share the feature classification across chips and name rows. Surface aliases also
|
||||
/// cover Patch/Stitch/Thicken and other surface features without a Surface-prefixed kind.
|
||||
fn feature_icon_accent(kind: &str, icon: &str) -> Option<&'static str> {
|
||||
let tab = if kind.starts_with("Sketch") {
|
||||
"SKETCH"
|
||||
} else if kind.starts_with("Surface") || icon.starts_with("surface_") || icon == "continuity" {
|
||||
"SURFACE"
|
||||
} else if kind.starts_with("Mesh") {
|
||||
"MESH"
|
||||
} else if kind.starts_with("Form") {
|
||||
"FORM"
|
||||
} else {
|
||||
"MODEL"
|
||||
};
|
||||
crate::theme::icon_accent_for_tab(tab)
|
||||
}
|
||||
|
||||
impl HistoryChip<'_> {
|
||||
/// All strip variants use this painter; no connections are drawn between features.
|
||||
pub fn paint(&self, painter: &Painter, rect: Rect, style: HistoryStyle) {
|
||||
let t = Tokens::get();
|
||||
let mut p = painter.clone();
|
||||
if self.dim || self.suppressed {
|
||||
p.multiply_opacity(0.42);
|
||||
}
|
||||
let fill = if self.error {
|
||||
t.form_error_fill
|
||||
} else if self.selected {
|
||||
self.accent.soft
|
||||
} else if self.hovered {
|
||||
t.hover
|
||||
} else if style == HistoryStyle::Names {
|
||||
egui::Color32::TRANSPARENT
|
||||
} else {
|
||||
t.timeline_item
|
||||
};
|
||||
let edge = if self.error {
|
||||
t.form_error
|
||||
} else if self.selected || self.hovered {
|
||||
self.accent.color
|
||||
} else {
|
||||
t.border
|
||||
};
|
||||
let radius = if style == HistoryStyle::Icons { t.radius_lg } else { t.radius_sm };
|
||||
if style != HistoryStyle::Names || self.error {
|
||||
let weight = if style == HistoryStyle::Icons && (self.selected || self.error) { 1.5 } else { 1.0 };
|
||||
p.rect(rect, radius, fill, Stroke::new(weight, edge), egui::StrokeKind::Inside);
|
||||
} else {
|
||||
p.rect_filled(rect, radius, fill);
|
||||
}
|
||||
let names = style == HistoryStyle::Names;
|
||||
let side = if names {
|
||||
t.space_14 + 1.0
|
||||
} else if style == HistoryStyle::Icons {
|
||||
t.space_16 + t.space_3
|
||||
} else {
|
||||
rect.height() - t.space_8
|
||||
};
|
||||
let icon =
|
||||
Rect::from_center_size(if names { pos2(rect.left() + t.space_8 + side / 2.0, rect.center().y) } else { rect.center() }, vec2(side, side));
|
||||
icons::paint_accented(&p, icon, self.icon, feature_icon_accent(self.kind, self.icon), 1.0);
|
||||
if names {
|
||||
let ink = if self.selected { self.accent.ink } else { t.text };
|
||||
let font = if self.selected { crate::fonts::semibold(t.font_body) } else { egui::FontId::proportional(t.font_body) };
|
||||
let text_rect = Rect::from_min_max(
|
||||
pos2(icon.right() + t.space_6 + 1.0, rect.top()),
|
||||
pos2(rect.right() - if self.error || self.warning { t.space_16 } else { t.space_8 }, rect.bottom()),
|
||||
);
|
||||
let galley = p.layout_no_wrap(self.name.to_owned(), font, ink);
|
||||
p.with_clip_rect(text_rect.intersect(p.clip_rect())).galley(pos2(text_rect.left(), rect.center().y - galley.size().y / 2.0), galley, ink);
|
||||
}
|
||||
if self.suppressed {
|
||||
p.line_segment([icon.left_bottom(), icon.right_top()], Stroke::new(1.5, t.text_dim));
|
||||
}
|
||||
if self.error || self.warning {
|
||||
let side = if names { t.space_12 } else { t.space_10 };
|
||||
let at = if names { pos2(rect.right() - t.space_3 - side, rect.center().y - side / 2.0) } else { rect.right_top() - vec2(side, 0.0) };
|
||||
icons::paint_icon(&p, Rect::from_min_size(at, vec2(side, side)), if self.error { "error" } else { "warning" }, 1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A single drop indicator in either strip orientation.
|
||||
pub(crate) fn history_drop_bar(p: &Painter, rect: Rect, vertical: bool, colour: egui::Color32) {
|
||||
let points = if vertical {
|
||||
[pos2(rect.left(), rect.center().y), pos2(rect.right(), rect.center().y)]
|
||||
} else {
|
||||
[pos2(rect.center().x, rect.top()), pos2(rect.center().x, rect.bottom())]
|
||||
};
|
||||
p.line_segment(points, Stroke::new(Tokens::get().space_2, colour));
|
||||
}
|
||||
|
||||
/// Rollback line and hollow end circle; a vertical strip uses a horizontal line.
|
||||
pub(crate) fn history_marker(p: &Painter, rect: Rect, vertical: bool, accent: TabAccent) {
|
||||
let t = Tokens::get();
|
||||
let outer_radius = t.space_10 / 2.0;
|
||||
let centre = if vertical { pos2(rect.right() - outer_radius, rect.center().y) } else { pos2(rect.center().x, rect.bottom() - outer_radius) };
|
||||
let direction = if vertical { vec2(1.0, 0.0) } else { vec2(0.0, 1.0) };
|
||||
let start = if vertical { rect.left_center() } else { rect.center_top() };
|
||||
// The line reaches one point inside the circle's outer edge, as on the reference board.
|
||||
let end = centre - direction * (outer_radius - 1.0);
|
||||
p.line_segment([start, end], Stroke::new(t.space_2, accent.color));
|
||||
// Circle strokes are centred on their radius: inset by half the stroke for a 10 pt outside diameter.
|
||||
p.circle(centre, outer_radius - t.space_2 / 2.0, if vertical { t.panel } else { t.timeline }, Stroke::new(t.space_2, accent.color));
|
||||
}
|
||||
|
||||
/// The same four rollback controls are used in every History orientation.
|
||||
#[derive(Clone, Copy)]
|
||||
pub(crate) enum HistoryTransport {
|
||||
First,
|
||||
Back,
|
||||
Forward,
|
||||
Last,
|
||||
}
|
||||
|
||||
impl HistoryTransport {
|
||||
pub const ALL: [Self; 4] = [Self::First, Self::Back, Self::Forward, Self::Last];
|
||||
|
||||
pub fn id(self) -> &'static str {
|
||||
match self {
|
||||
Self::First => "first",
|
||||
Self::Back => "back",
|
||||
Self::Forward => "forward",
|
||||
Self::Last => "last",
|
||||
}
|
||||
}
|
||||
|
||||
fn label(self) -> &'static str {
|
||||
crate::i18n::tr(match self {
|
||||
Self::First => "ui.history_first",
|
||||
Self::Back => "ui.history_back",
|
||||
Self::Forward => "ui.history_forward",
|
||||
Self::Last => "ui.history_last",
|
||||
})
|
||||
}
|
||||
|
||||
pub fn show(self, ui: &mut egui::Ui, rect: Rect) -> egui::Response {
|
||||
let t = Tokens::get();
|
||||
let response = ui.interact(rect, ui.id().with(("history_transport", self.id())), egui::Sense::click());
|
||||
crate::scenario::publish_target(&format!("history:{}", self.id()), rect);
|
||||
if response.hovered() {
|
||||
ui.painter().rect_filled(rect, t.radius_sm, t.hover);
|
||||
}
|
||||
icons::glyphs::transport_glyph(ui.painter(), rect.center(), self.id(), t.icon);
|
||||
response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, ui.is_enabled(), self.label()));
|
||||
response.on_hover_cursor(egui::CursorIcon::PointingHand).on_hover_text(self.label())
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn history_transport_width() -> f32 {
|
||||
let t = Tokens::get();
|
||||
t.space_24 * HistoryTransport::ALL.len() as f32 + t.space_2 * (HistoryTransport::ALL.len() - 1) as f32
|
||||
}
|
||||
|
||||
/// Thin and minimum named widths; wider named panels retain their measured width.
|
||||
pub(crate) fn history_width(names: bool) -> f32 {
|
||||
let t = Tokens::get();
|
||||
if names { history_transport_width() + t.space_10 * 2.0 + t.space_8 } else { t.control_height * 2.0 }
|
||||
}
|
||||
|
||||
pub(crate) fn history_clamp_width(width: f32) -> f32 {
|
||||
if width.is_finite() { width.clamp(history_width(false), Tokens::get().space_24 * 26.0) } else { history_width(false) }
|
||||
}
|
||||
|
||||
/// Only the gap between thin and medium snaps. Every larger width is retained.
|
||||
pub(crate) fn history_snap_width(width: f32) -> f32 {
|
||||
let width = history_clamp_width(width);
|
||||
if width < (history_width(false) + history_width(true)) / 2.0 { history_width(false) } else { width.max(history_width(true)) }
|
||||
}
|
||||
|
||||
/// The same six-dot grip is used by Assistant and History headers.
|
||||
pub(crate) fn panel_grip(ui: &mut egui::Ui) -> egui::Response {
|
||||
let t = Tokens::get();
|
||||
let (rect, response) = ui.allocate_exact_size(vec2(t.space_10, t.space_16 + t.space_2), egui::Sense::hover());
|
||||
for row in 0..3 {
|
||||
for col in 0..2 {
|
||||
ui.painter().circle_filled(rect.left_top() + vec2(2.5 + col as f32 * 5.0, 4.0 + row as f32 * 5.0), 1.1, t.text_dim);
|
||||
}
|
||||
}
|
||||
response
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub(crate) enum HistoryHandleState {
|
||||
Rest,
|
||||
Hover,
|
||||
Drag,
|
||||
}
|
||||
|
||||
/// Seam geometry is independent of the strip's contents and consumes no layout space.
|
||||
pub(crate) struct HistorySeam {
|
||||
pub grip: Rect,
|
||||
pub pill: Rect,
|
||||
pub edge: Rect,
|
||||
}
|
||||
|
||||
impl HistorySeam {
|
||||
pub fn new(card: Rect) -> Self {
|
||||
let t = Tokens::get();
|
||||
Self {
|
||||
grip: Rect::from_center_size(pos2(card.right() - t.space_2 - t.space_3 / 2.0, card.center().y), vec2(t.space_3, TREE_ROW_HEIGHT)),
|
||||
pill: Rect::from_center_size(card.right_center(), vec2(t.space_16 + t.space_2, t.control_height + t.space_16)),
|
||||
edge: Rect::from_min_max(pos2(card.right() - t.space_10, card.top()), card.right_bottom()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn paint(&self, p: &Painter, card: Rect, names: bool, state: HistoryHandleState) {
|
||||
let t = Tokens::get();
|
||||
let accent = TabAccent::current(p.ctx());
|
||||
match state {
|
||||
HistoryHandleState::Rest => {
|
||||
p.rect_filled(self.grip, t.space_2, t.control_border);
|
||||
}
|
||||
HistoryHandleState::Hover => {
|
||||
p.rect(self.pill, self.pill.width() / 2.0, accent.soft, Stroke::new(1.0, accent.color), egui::StrokeKind::Inside);
|
||||
let c = self.pill.center();
|
||||
let dir = if names { -1.0 } else { 1.0 };
|
||||
p.add(egui::Shape::line(
|
||||
vec![c + vec2(-dir * t.space_2, -t.space_4), c + vec2(dir * t.space_2, 0.0), c + vec2(-dir * t.space_2, t.space_4)],
|
||||
Stroke::new(t.space_2, accent.color),
|
||||
));
|
||||
}
|
||||
HistoryHandleState::Drag => {
|
||||
p.rect_stroke(card, t.radius_lg, Stroke::new(1.0, accent.color), egui::StrokeKind::Inside);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct HistorySeamResponse {
|
||||
pub toggle: bool,
|
||||
pub width: Option<f32>,
|
||||
pub released: bool,
|
||||
#[cfg(test)]
|
||||
pub response: egui::Response,
|
||||
}
|
||||
|
||||
/// Focusable seam button and edge gesture, shared by the panel and CPU interaction tests.
|
||||
pub(crate) fn history_seam(ui: &mut egui::Ui, card: Rect, names: bool) -> HistorySeamResponse {
|
||||
let seam = HistorySeam::new(card);
|
||||
let id = ui.id().with("history_seam");
|
||||
let edge = ui.interact(seam.edge, id.with("edge"), egui::Sense::CLICK | egui::Sense::DRAG);
|
||||
let button = ui.interact(seam.pill, id, egui::Sense::click_and_drag());
|
||||
let label = crate::i18n::tr(if names { "ui.collapse" } else { "ui.expand" });
|
||||
button.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, ui.is_enabled(), label));
|
||||
if button.clicked() {
|
||||
button.request_focus();
|
||||
}
|
||||
let drag = if button.dragged() || button.drag_started() || button.drag_stopped() { &button } else { &edge };
|
||||
let start_id = id.with("start_width");
|
||||
if drag.drag_started() {
|
||||
let press_x = ui.input(|i| i.pointer.press_origin()).map_or(card.right(), |p| p.x);
|
||||
ui.data_mut(|d| d.insert_temp(start_id, (card.width(), press_x)));
|
||||
}
|
||||
let width = if drag.dragged() || drag.drag_stopped() {
|
||||
let (start_width, press_x) = ui.data(|d| d.get_temp::<(f32, f32)>(start_id)).unwrap_or((card.width(), card.right()));
|
||||
let pointer_x = ui.input(|i| i.pointer.latest_pos()).map_or(press_x, |p| p.x);
|
||||
Some(history_clamp_width(start_width + pointer_x - press_x))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
if drag.drag_stopped() {
|
||||
ui.data_mut(|d| d.remove::<(f32, f32)>(start_id));
|
||||
}
|
||||
let dragging = width.is_some();
|
||||
if dragging || edge.hovered() {
|
||||
ui.ctx().set_cursor_icon(egui::CursorIcon::ResizeHorizontal);
|
||||
}
|
||||
if !dragging && button.hovered() {
|
||||
ui.ctx().set_cursor_icon(egui::CursorIcon::PointingHand);
|
||||
}
|
||||
let hovered = edge.hovered() || button.hovered();
|
||||
let state = if dragging {
|
||||
HistoryHandleState::Drag
|
||||
} else if hovered {
|
||||
HistoryHandleState::Hover
|
||||
} else {
|
||||
HistoryHandleState::Rest
|
||||
};
|
||||
seam.paint(ui.painter(), card, names, state);
|
||||
let response = button.clone().union(edge.clone());
|
||||
if hovered && !dragging {
|
||||
let mut tip = egui::Tooltip::for_widget(&response);
|
||||
let t = Tokens::get();
|
||||
let frame = egui::Frame::NONE
|
||||
.fill(t.dialog_body)
|
||||
.stroke(Stroke::new(1.0, t.dialog_border))
|
||||
.corner_radius(t.radius_md)
|
||||
.inner_margin(egui::Margin::symmetric(t.space_8 as i8, t.space_4 as i8))
|
||||
.shadow(t.shell_shadow());
|
||||
tip.popup = tip.popup.anchor(seam.pill).align(egui::RectAlign::RIGHT_START).frame(frame);
|
||||
tip.show(|ui| {
|
||||
let t = Tokens::get();
|
||||
ui.label(egui::RichText::new(label).font(crate::fonts::semibold(t.font_body)).color(t.text));
|
||||
ui.label(egui::RichText::new(crate::i18n::tr("ui.history_edge_hint")).size(t.font_small).color(t.text_dim));
|
||||
});
|
||||
}
|
||||
crate::scenario::publish_handle("history:names", seam.pill.center());
|
||||
crate::scenario::publish_rect("history:seam", seam.edge);
|
||||
crate::scenario::publish_rect("history:handle", seam.pill);
|
||||
// egui's click response includes Enter and Space for a focused button.
|
||||
HistorySeamResponse {
|
||||
toggle: button.clicked() || edge.double_clicked(),
|
||||
width,
|
||||
released: drag.drag_stopped(),
|
||||
#[cfg(test)]
|
||||
response,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn seam_geometry_and_paint_states_follow_tokens_in_both_themes() {
|
||||
let previous = crate::theme::is_dark();
|
||||
for dark in [false, true] {
|
||||
crate::theme::set_dark(dark);
|
||||
for names in [false, true] {
|
||||
let card = Rect::from_min_size(pos2(20.0, 30.0), vec2(history_width(names), 280.0));
|
||||
let seam = HistorySeam::new(card);
|
||||
assert_eq!(seam.grip.size(), vec2(3.0, 26.0));
|
||||
assert_eq!(seam.grip.center().y, card.center().y);
|
||||
assert_eq!(seam.grip.right(), card.right() - 2.0);
|
||||
assert_eq!(seam.pill.size(), vec2(18.0, 44.0));
|
||||
assert_eq!(seam.pill.center(), card.right_center());
|
||||
assert_eq!(seam.edge.width(), 10.0);
|
||||
for state in [HistoryHandleState::Rest, HistoryHandleState::Hover, HistoryHandleState::Drag] {
|
||||
let ctx = crate::fonts::test_context();
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| seam.paint(ui.painter(), card, names, state));
|
||||
out.textures_delta.clear();
|
||||
let t = Tokens::get();
|
||||
let accent = TabAccent::current(&ctx);
|
||||
let rect = out
|
||||
.shapes
|
||||
.iter()
|
||||
.find_map(|s| match &s.shape {
|
||||
egui::Shape::Rect(r) => Some(r),
|
||||
_ => None,
|
||||
})
|
||||
.unwrap();
|
||||
match state {
|
||||
HistoryHandleState::Rest => {
|
||||
assert_eq!(rect.rect, seam.grip);
|
||||
assert_eq!(rect.fill, t.control_border);
|
||||
}
|
||||
HistoryHandleState::Hover => {
|
||||
assert_eq!(rect.rect, seam.pill);
|
||||
assert_eq!(rect.fill, accent.soft);
|
||||
assert_eq!(rect.stroke.color, accent.color);
|
||||
}
|
||||
HistoryHandleState::Drag => {
|
||||
assert_eq!(rect.rect, card);
|
||||
assert_eq!(rect.stroke.color, accent.color);
|
||||
assert!(!out.shapes.iter().any(|s| matches!(&s.shape, egui::Shape::Text(_))));
|
||||
assert!(!out.shapes.iter().any(|s| matches!(s.shape, egui::Shape::LineSegment { .. })));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
crate::theme::set_dark(previous);
|
||||
}
|
||||
|
||||
struct SeamHarness {
|
||||
ctx: egui::Context,
|
||||
names: bool,
|
||||
width: f32,
|
||||
time: f64,
|
||||
focused: bool,
|
||||
}
|
||||
|
||||
impl SeamHarness {
|
||||
fn new(names: bool) -> Self {
|
||||
let mut h = Self { ctx: crate::fonts::test_context(), names, width: history_width(names), time: 0.0, focused: false };
|
||||
h.frame(vec![]);
|
||||
h.frame(vec![]);
|
||||
h
|
||||
}
|
||||
|
||||
fn card(&self) -> Rect {
|
||||
Rect::from_min_size(pos2(20.0, 20.0), vec2(self.width, 280.0))
|
||||
}
|
||||
|
||||
fn frame(&mut self, events: Vec<egui::Event>) -> egui::FullOutput {
|
||||
self.time += 0.05;
|
||||
let card = self.card();
|
||||
let mut out = self.ctx.run_ui(
|
||||
egui::RawInput {
|
||||
screen_rect: Some(Rect::from_min_size(egui::Pos2::ZERO, vec2(400.0, 400.0))),
|
||||
time: Some(self.time),
|
||||
focused: true,
|
||||
events,
|
||||
..Default::default()
|
||||
},
|
||||
|ui| {
|
||||
let result = history_seam(ui, card, self.names);
|
||||
self.focused = result.response.has_focus();
|
||||
if let Some(width) = result.width {
|
||||
self.width = width;
|
||||
if result.released {
|
||||
self.names = history_snap_width(width) >= history_width(true);
|
||||
self.width = history_snap_width(width);
|
||||
}
|
||||
} else if result.toggle {
|
||||
self.names = !self.names;
|
||||
self.width = history_width(self.names);
|
||||
}
|
||||
},
|
||||
);
|
||||
out.textures_delta.clear();
|
||||
out
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn seam_edge_cursor_pill_click_double_click_and_keyboard_toggle() {
|
||||
use crate::test_support::{key, pointer};
|
||||
let mut h = SeamHarness::new(false);
|
||||
let edge = pos2(h.card().right() - 4.0, h.card().top() + 30.0);
|
||||
assert_eq!(h.frame(vec![egui::Event::PointerMoved(edge)]).platform_output.cursor_icon, egui::CursorIcon::ResizeHorizontal);
|
||||
let pill = h.card().right_center();
|
||||
assert_eq!(h.frame(vec![egui::Event::PointerMoved(pill)]).platform_output.cursor_icon, egui::CursorIcon::PointingHand);
|
||||
h.frame(pointer(pill, true));
|
||||
h.frame(pointer(pill, false));
|
||||
assert!(h.names);
|
||||
let mut h = SeamHarness::new(false);
|
||||
for _ in 0..2 {
|
||||
h.frame(pointer(edge, true));
|
||||
h.frame(pointer(edge, false));
|
||||
}
|
||||
assert!(h.names, "double-click toggles once");
|
||||
let mut h = SeamHarness::new(false);
|
||||
h.ctx.enable_accesskit();
|
||||
let focus = h.frame(key(egui::Key::Tab));
|
||||
assert!(
|
||||
focus
|
||||
.platform_output
|
||||
.events
|
||||
.iter()
|
||||
.any(|e| matches!(e, egui::output::OutputEvent::FocusGained(info) if info.label.as_deref() == Some("Expand")))
|
||||
);
|
||||
h.frame(vec![]);
|
||||
assert!(h.focused, "Tab reaches the seam button");
|
||||
h.frame(key(egui::Key::Enter));
|
||||
assert!(h.names);
|
||||
h.frame(key(egui::Key::Space));
|
||||
assert!(!h.names);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn seam_drag_resizes_continuously_and_snaps_both_directions() {
|
||||
use crate::test_support::pointer;
|
||||
for (names, delta, expected) in [(false, 40.0, true), (false, 20.0, false), (true, -40.0, false), (true, -20.0, true)] {
|
||||
for pill in [false, true] {
|
||||
let mut h = SeamHarness::new(names);
|
||||
let start = if pill { h.card().right_center() } else { pos2(h.card().right() - 4.0, h.card().top() + 30.0) };
|
||||
let end = start + vec2(delta, 0.0);
|
||||
h.frame(pointer(start, true));
|
||||
h.frame(vec![egui::Event::PointerMoved(start + vec2(delta / 2.0, 0.0))]);
|
||||
h.frame(vec![egui::Event::PointerMoved(end)]);
|
||||
assert_eq!(h.width, history_width(names) + delta, "continuous width before release");
|
||||
h.frame(pointer(end, false));
|
||||
assert_eq!(h.names, expected);
|
||||
assert_eq!(h.width, history_snap_width(history_width(names) + delta));
|
||||
}
|
||||
}
|
||||
for hostile in [f32::NAN, f32::INFINITY, f32::NEG_INFINITY, -1000.0, 10000.0] {
|
||||
assert!((history_width(false)..=Tokens::get().space_24 * 26.0).contains(&history_clamp_width(hostile)));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn chip_selection_error_and_rollback_use_tokens_in_both_themes() {
|
||||
let previous = crate::theme::is_dark();
|
||||
for dark in [false, true] {
|
||||
crate::theme::set_dark(dark);
|
||||
let t = Tokens::get();
|
||||
let accent = TabAccent::for_tab(&t, "SURFACE");
|
||||
for style in [HistoryStyle::Icons, HistoryStyle::Names] {
|
||||
for (selected, error, dim) in [(true, false, false), (false, true, false), (true, false, true)] {
|
||||
let rect = Rect::from_min_size(pos2(20.0, 20.0), vec2(158.0, style.height()));
|
||||
let ctx = crate::fonts::test_context();
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| {
|
||||
HistoryChip {
|
||||
icon: "surface_extrude",
|
||||
name: "Offset1",
|
||||
kind: "SurfaceOffsetFeature",
|
||||
selected,
|
||||
hovered: false,
|
||||
dim,
|
||||
suppressed: false,
|
||||
error,
|
||||
warning: false,
|
||||
accent,
|
||||
}
|
||||
.paint(ui.painter(), rect, style)
|
||||
});
|
||||
out.textures_delta.clear();
|
||||
let background = out
|
||||
.shapes
|
||||
.iter()
|
||||
.find_map(|s| match &s.shape {
|
||||
egui::Shape::Rect(r) if r.rect == rect => Some(r),
|
||||
_ => None,
|
||||
})
|
||||
.unwrap();
|
||||
let opacity = if dim { 0.42 } else { 1.0 };
|
||||
assert_eq!(background.fill, if error { t.form_error_fill } else { accent.soft }.gamma_multiply(opacity));
|
||||
if style == HistoryStyle::Icons || error {
|
||||
assert_eq!(background.stroke.color, if error { t.form_error } else { accent.color }.gamma_multiply(opacity));
|
||||
}
|
||||
if style == HistoryStyle::Names {
|
||||
let text = out
|
||||
.shapes
|
||||
.iter()
|
||||
.find_map(|s| match &s.shape {
|
||||
egui::Shape::Text(t) => Some(t),
|
||||
_ => None,
|
||||
})
|
||||
.unwrap();
|
||||
assert_eq!(text.galley.text(), "Offset1");
|
||||
assert_eq!(text.fallback_color, if selected { accent.ink } else { t.text }.gamma_multiply(opacity));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
crate::theme::set_dark(previous);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn chips_have_no_connector_shapes_in_either_theme_or_width() {
|
||||
let previous = crate::theme::is_dark();
|
||||
for dark in [false, true] {
|
||||
crate::theme::set_dark(dark);
|
||||
let t = Tokens::get();
|
||||
for style in [HistoryStyle::Bottom, HistoryStyle::Icons, HistoryStyle::Names] {
|
||||
let ctx = crate::fonts::test_context();
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| {
|
||||
for index in 0..3 {
|
||||
let rect = Rect::from_min_size(
|
||||
pos2(20.0, 20.0 + index as f32 * (style.height() + t.space_4)),
|
||||
vec2(if style == HistoryStyle::Names { 158.0 } else { style.height() }, style.height()),
|
||||
);
|
||||
HistoryChip {
|
||||
icon: "box",
|
||||
name: "Box",
|
||||
kind: "BoxFeature",
|
||||
selected: index == 0,
|
||||
hovered: false,
|
||||
dim: index == 2,
|
||||
suppressed: false,
|
||||
error: false,
|
||||
warning: false,
|
||||
accent: TabAccent::for_tab(&t, "MODEL"),
|
||||
}
|
||||
.paint(ui.painter(), rect, style);
|
||||
}
|
||||
});
|
||||
out.textures_delta.clear();
|
||||
let mut connections = 0;
|
||||
for clipped in out.shapes {
|
||||
crate::test_support::each_shape(&clipped.shape, &mut |shape| {
|
||||
if matches!(shape, egui::Shape::LineSegment { .. } | egui::Shape::Path(_)) {
|
||||
connections += 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
assert_eq!(connections, 0, "dark={dark}");
|
||||
}
|
||||
}
|
||||
crate::theme::set_dark(previous);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn both_strip_orientations_share_the_drop_bar_and_marker_geometry() {
|
||||
let t = Tokens::get();
|
||||
let accent = TabAccent::for_tab(&t, "SURFACE");
|
||||
for vertical in [false, true] {
|
||||
let rect = Rect::from_min_size(pos2(20.0, 20.0), if vertical { vec2(160.0, 12.0) } else { vec2(12.0, 28.0) });
|
||||
let ctx = crate::fonts::test_context();
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| history_drop_bar(ui.painter(), rect, vertical, accent.color));
|
||||
out.textures_delta.clear();
|
||||
let lines: Vec<_> = out
|
||||
.shapes
|
||||
.iter()
|
||||
.filter_map(|s| if let egui::Shape::LineSegment { points, stroke } = s.shape { Some((points, stroke)) } else { None })
|
||||
.collect();
|
||||
assert_eq!(lines.len(), 1);
|
||||
assert_eq!(lines[0].1, Stroke::new(t.space_2, accent.color));
|
||||
assert_eq!(lines[0].0, if vertical { [rect.left_center(), rect.right_center()] } else { [rect.center_top(), rect.center_bottom()] });
|
||||
}
|
||||
let previous = crate::theme::is_dark();
|
||||
for dark in [false, true] {
|
||||
crate::theme::set_dark(dark);
|
||||
let t = Tokens::get();
|
||||
let accent = TabAccent::for_tab(&t, "SURFACE");
|
||||
// Both vertical widths retain the 12 pt marker row; the bottom strip rotates it.
|
||||
for (vertical, size) in [(true, vec2(46.0, 12.0)), (true, vec2(158.0, 12.0)), (false, vec2(12.0, 28.0))] {
|
||||
let rect = Rect::from_min_size(pos2(20.0, 20.0), size);
|
||||
let ctx = crate::fonts::test_context();
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| history_marker(ui.painter(), rect, vertical, accent));
|
||||
out.textures_delta.clear();
|
||||
let lines: Vec<_> = out
|
||||
.shapes
|
||||
.iter()
|
||||
.filter_map(|s| match s.shape {
|
||||
egui::Shape::LineSegment { points, stroke } => Some((points, stroke)),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
assert_eq!(lines.len(), 1);
|
||||
assert_eq!(lines[0].1, Stroke::new(2.0, accent.color));
|
||||
let circles: Vec<_> = out
|
||||
.shapes
|
||||
.iter()
|
||||
.filter_map(|s| match &s.shape {
|
||||
egui::Shape::Circle(c) => Some(c),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
assert_eq!(circles.len(), 1);
|
||||
let circle = circles[0];
|
||||
assert_eq!(circle.stroke, Stroke::new(2.0, accent.color));
|
||||
assert_eq!(circle.fill, if vertical { t.panel } else { t.timeline });
|
||||
assert_ne!(circle.fill, accent.color);
|
||||
let outer = circle.radius + circle.stroke.width / 2.0;
|
||||
assert_eq!(outer * 2.0, 10.0);
|
||||
let bounds = Rect::from_center_size(circle.center, vec2(outer * 2.0, outer * 2.0));
|
||||
assert!(rect.contains_rect(bounds));
|
||||
assert_eq!(lines[0].0[0], if vertical { rect.left_center() } else { rect.center_top() });
|
||||
if vertical {
|
||||
assert_eq!(rect.height(), 12.0);
|
||||
assert_eq!(bounds.right(), rect.right());
|
||||
assert_eq!(lines[0].0[1], pos2(bounds.left() + 1.0, circle.center.y));
|
||||
} else {
|
||||
assert_eq!(bounds.bottom(), rect.bottom());
|
||||
assert_eq!(lines[0].0[1], pos2(circle.center.x, bounds.top() + 1.0));
|
||||
}
|
||||
assert!(!out.shapes.iter().any(|s| matches!(s.shape, egui::Shape::Path(_))), "no arrowheads");
|
||||
}
|
||||
}
|
||||
crate::theme::set_dark(previous);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ mod color;
|
||||
mod confirm;
|
||||
mod disclosure;
|
||||
mod fields;
|
||||
mod history;
|
||||
mod layout;
|
||||
mod menu;
|
||||
mod metrics;
|
||||
@@ -26,10 +27,11 @@ pub(crate) use color::*;
|
||||
pub(crate) use confirm::{Confirm, Tone};
|
||||
pub(crate) use disclosure::*;
|
||||
pub(crate) use fields::*;
|
||||
pub(crate) use history::*;
|
||||
pub(crate) use layout::*;
|
||||
pub(crate) use menu::{Menu, MenuItem, rename_menu, workspace_menu};
|
||||
pub(crate) use metrics::{ContentWidth, header_height, row_height, table_row_height};
|
||||
pub(crate) use panel::{ComputeStatus, FeatureOptions, Panel, Part, Window, WindowPage};
|
||||
pub(crate) use panel::{ComputeStatus, FeatureOptions, Panel, Part, Window, WindowPage, panel_header_hover};
|
||||
#[cfg(test)]
|
||||
pub(crate) use panel::{collapsible_header, header};
|
||||
pub(crate) use radial::{RADIAL_RADIUS, radial_menu};
|
||||
|
||||
@@ -3,6 +3,12 @@ use super::{actions::icon_button_at, metrics::*, text::paint_text};
|
||||
use crate::{scenario, theme::Tokens};
|
||||
use egui::{Ui, vec2};
|
||||
|
||||
/// Shared active-tab hover tint for the browser and collapsible panel chrome.
|
||||
pub(crate) fn panel_header_hover(painter: &egui::Painter, rect: egui::Rect) {
|
||||
let t = Tokens::get();
|
||||
painter.rect_filled(rect, t.radius_lg.saturating_sub(t.space_4 as u8), crate::theme::TabAccent::current(painter.ctx()).soft);
|
||||
}
|
||||
|
||||
/// Feature title/icon/close band. Tokens: `form_header_height, form_icon_size, form_close_size, form_inset, font_label, text, dialog_rule, space_8/10; icon_button_at tokens`.
|
||||
pub(crate) fn header(ui: &mut Ui, icon: &str, title: &str, on_close: impl FnOnce()) {
|
||||
header_impl(ui, icon, title, None, on_close);
|
||||
|
||||
@@ -210,6 +210,10 @@ fn requested_menu_icons_have_artwork_and_match_manifest() {
|
||||
history.frames(3);
|
||||
context_rows(&mut history, "timeline:", &mut requested);
|
||||
}
|
||||
// The seam has its own checked display menu, independent of feature and folder rows.
|
||||
history.step(&json!({"click":{"handle":"history:names"},"button":"right"})).unwrap();
|
||||
collect(&mut history, "history seam", &mut requested);
|
||||
escape(&mut history);
|
||||
let features = history.app.session.doc.features.iter().take(2).map(|f| f.id).collect::<Vec<_>>();
|
||||
let group = history.app.run("timeline.group", json!({"features":features,"name":"Audit history folder"})).unwrap()["group"].as_u64().unwrap();
|
||||
history.frames(3);
|
||||
@@ -217,13 +221,13 @@ fn requested_menu_icons_have_artwork_and_match_manifest() {
|
||||
history.app.tree.picked_timeline_groups.clear();
|
||||
history.app.run("select.set", json!({"items":features.iter().map(|id| json!({"type":"feature","id":id})).collect::<Vec<_>>()})).unwrap();
|
||||
history.frames(3);
|
||||
history.step(&json!({"widget":"2 selected"})).unwrap();
|
||||
history.step(&json!({"click":{"handle":"timeline:History A"},"button":"right"})).unwrap();
|
||||
collect(&mut history, "history feature selection", &mut requested);
|
||||
escape(&mut history);
|
||||
history.app.run("select.clear", json!({})).unwrap();
|
||||
history.app.tree.picked_timeline_groups = vec![group];
|
||||
history.frames(3);
|
||||
history.step(&json!({"widget":"1 selected"})).unwrap();
|
||||
history.step(&json!({"click":{"handle":"timeline-folder:Audit history folder"},"button":"right"})).unwrap();
|
||||
collect(&mut history, "history folder selection", &mut requested);
|
||||
escape(&mut history);
|
||||
history.app.tree.picked_timeline_groups.clear();
|
||||
|
||||
@@ -66,7 +66,10 @@
|
||||
- **Dialogs** dock on the right with a live preview. Most features also show drag handles and a
|
||||
value box in the viewport.
|
||||
- **Timeline** (bottom). Every feature in order. Double-click to edit, drag the marker to roll
|
||||
back, and drag features to reorder them.
|
||||
back, and drag features to reorder them. Preferences can put the timeline vertically at the
|
||||
far left of the viewport, beside the browser. Its seam handle switches between icon
|
||||
chips and compact feature names; the browser can collapse to a rail beside either width.
|
||||
Previous, Play and Next sit at the top. Double-click Previous to roll to the start.
|
||||
- **Command search (S).** Click the ribbon search field or press S to open the search popup
|
||||
below it. Results group commands by their ribbon path and show matching features and user
|
||||
parameters from this design. With an empty query, recent commands appear first, followed by
|
||||
|
||||
@@ -209,6 +209,7 @@ labels; `prefs:measure_axis_distances` identifies the checkbox.
|
||||
| `ui.capture` | `action?`: `capture`, `revert`, `cancel` | answers the Capture Position question (asked when a command starts or the design is saved while components were moved without capturing); without `action`, what waits |
|
||||
| `ui.window` | `action`: minimize, maximize, restore, toggle, close | what the title bar's caption buttons do (on Windows and Linux the application bar is the title bar); close asks about unsaved designs first |
|
||||
| `ui.agent_cursor` | `show` (bool), `speed`: a number from 1 to 5 (times the normal speed) or `"instant"` (no animation: the command runs at once and the pointer jumps to where it acted), `follow_camera` (bool); all optional | the settings. While the cursor is shown, `engine.execute` first glides to the command's toolbar button and to each pick, then runs and replies; later requests wait their turn. `"animate": false` on a call skips it |
|
||||
| `engine.execute` → `view.history_layout` | `width?`, `dock?`: `bottom`, `left`, `under_browser`, `collapsed?` | Resize/dock the history without opening a dialog or changing the design. Contents respond to measured width; browser-stacked history shares its width and splits height equally. One folded header gives the expanded card the rest; two folded headers stay at the top. |
|
||||
| `ui.agent_chat` | `features?`, `toolbar_button?`, `permissions?` (`ask`, `edits`, `all`), `add_agent?` ({`name`, `kind`: `acp` or `api`, `command` or `base_url` + `model`}; no keys), `default_agent?`, `agent?` (the conversation's agent, by id), `mode?` (the agent's own mode), `model?` (one of its models), `open?`, `side?` (`left`, `right`), `minimized?`, `popped?` (in its own window), `width?`, `picker?`, `refresh?`, `connect?`, `stop?`, `attach?`: a file's path (a picture, a text file or a CAD file, for the next message; CAD files are imported at once), `remove_file?` (index of a file on the next message), `send?`: text (files alone make a message too), `attach_view?`, `permission?`: an option id or `"cancel"` (the newest question of the agent's own), `approve?`: true, false or `"always"` (the oldest request held for Allow/Deny), `cancel?` (Stop: the queue stays), `send_now?` (stop the running step, then send the queued messages), `remove_pending?` (index), `new_chat?` (clear the chat, new session), `undo?` (the last message's changes) | the chat's state: `features`, `agents` (found and added), `currentAgent`, `state` (off, starting, ready, busy, auth, exited), `popped`, `window` (its place and size), `agent`, `modes`, `mode`, `models`, `model`, `authMethods`, `toolsPort`, `pid`, `waiting`, `turn`, `pending` (queued messages, with their `files`), `attachments` (the files on the next message, by name), `loading` (pictures still being read for it, by name), `stopped`, `detection` and the conversation (`items`). With `features` off only the settings apply. Desktop only; see [Agent chat](agent-chat.md) |
|
||||
| `ui.resize` | `width`, `height` | |
|
||||
| `app.quit` | `force?` (quit without asking about unsaved designs) | `quitting` (the window closes), `asking` (a "save changes?" prompt is open) |
|
||||
|
||||
@@ -57,6 +57,7 @@ table. Panel/Window/Confirm compositions also have dedicated geometry and intera
|
||||
|
||||
| Module / element | Use and options | Main tokens |
|
||||
| --- | --- | --- |
|
||||
| history: `HistoryChip`, `HistoryStyle`, `history_drop_bar`, `history_marker`, `HistorySeam`, `history_seam` | One painter family for bottom chips, 38 pt vertical icon chips and single-line 26 pt name rows (the browser's shared `TREE_ROW_HEIGHT`). Selected items use the active tab tint/ink/border; all variants retain multi-tone feature artwork using one shared kind-to-accent rule (Sketch green, Surface orange, Mesh yellow, Form purple, solids base blue); rolled-back items have 42% opacity. Error/warning badges, suppression strikes, horizontal/vertical drop bars and rollback line/hollow circle are shared. No connector lines. | `control_height`, `space_2/3/4/6/8/10/12/14/16/24`, radii, typography, `TabAccent`, `timeline_item`, `control_border`, `text/dim`, `form_error/fill` |
|
||||
| search: `CommandSearch`, `MenuItem::search_row` | Ribbon search composition: one persistent ribbon editor expands from 28 to 40 pt and to 520 pt wide with its right edge anchored, magnifier and S/Esc keycap, 38 pt two-line menu row with 26 pt icon tile, accent bold substring, path, shortcut/kind keycap, counts, JSON detail box and footer. The ordinary 30 pt menu row cannot fit a second line; this variant keeps its enabled/selected states and scenario IDs. Ranking and dispatch stay with the caller. | `form_card_width × 2 − space_8` (520 pt), `control_height`, `space_2/3/4/6/8/10/12/14/16/24`, `radius_xl/control_radius`, `control_fill`, `dialog_body/footer/rule/border`, `form_ink/dim/primary/error/error_fill/success/success_fill`, `selected_ink`, `accent_soft`, typography |
|
||||
| menu: `Menu`, `MenuItem` | Shared popup, 30 pt rows, 28 pt icon column, clipped labels, right-aligned mono shortcuts, submenu chevrons, checked/unchecked and document swatches, inert 40% disabled rows and danger ink; headings and separators; ribbon drag/pin targets retained | `dialog_body/border/rule`, `radius_xl`, `control_height/radius`, `form_ink/dim/primary/error`, `accent_soft`, typography and spacing |
|
||||
| radial: `radial_menu` | Eight rounded annular sectors, parallel 4 pt gaps, 9 pt circular corner joins, tab-accent artwork and hover, centre label/key; existing hold/flick/release dispatch | `dialog_body/border`, `form_ink/dim`, `TabAccent`, icon palette, font/spacing tokens |
|
||||
@@ -108,6 +109,38 @@ table. Panel/Window/Confirm compositions also have dedicated geometry and intera
|
||||
| status: `status_header`, `StatusHeader` | Supplied icon/name/status and constraint meter | `font_label`, `text/dim`, `accent`, sketch/header tokens |
|
||||
| `progress` | Clamped determinate progress | `space_3/6`, `dialog_rule`, `accent` |
|
||||
|
||||
History contents are selected from measured panel width. A 56 pt thin strip shows icons
|
||||
and four vertical transport controls: beginning, back, forward and end. The minimum named
|
||||
width is 130 pt; it adds horizontal transport and the same six-dot window grip as Assistant.
|
||||
When the remaining header space fits its measured text, **History** appears between grip
|
||||
and transport. No names-mode flag
|
||||
or command selects these layouts. The seam snaps between 56 and 130 pt; widths from 130
|
||||
through 624 pt remain continuous and persist as `timeline_left_width`.
|
||||
|
||||
Drag the grip or title to dock along the bottom, at the full-height left edge, or beneath
|
||||
the browser. Either card's right edge resizes their shared width. This position divides
|
||||
available column height equally. Folding either card leaves its header visible and gives the remainder to
|
||||
the other. If both are folded, their headers sit together at the top of the column.
|
||||
Expansion and collapse share a smooth cubic transition capped at 120 ms, respecting
|
||||
the interface’s instant-animation setting. Their collapse controls share the same active-tab blue hover tint. Browser resizing also resizes History.
|
||||
The `view.history_layout` command validates width, docking and collapse requests without
|
||||
altering the design or opening dialogs. Floating mode preserves viewport projection.
|
||||
|
||||
The seam handle overlays the strip's right edge without taking layout space. Its grip is
|
||||
visible at rest; the arrow appears only on hover. Click, double-click the edge, or use
|
||||
Enter/Space on the focused handle to resize between thin and minimum named widths. Drag
|
||||
freely above the named minimum; resizing draws no dotted guide or name label. Header/title dragging
|
||||
and the edge width gesture are separate from feature/folder and rollback dragging.
|
||||
The rollback marker is 12 pt high.
|
||||
Its 2 pt line uses the active tab fill and ends in a 10 pt hollow circle with a 2 pt accent
|
||||
border and the card/panel surface inside. The circle overlaps the line end by 1 pt. The bottom
|
||||
strip uses the same painter, rotated. Folder selection, range selection, context menus,
|
||||
sketch-pattern children, drag reordering and command JSON retain their existing behavior and handles.
|
||||
`history_icons`, `history_names`, `history_marker` and the `history_seam_rest/hover/drag` states
|
||||
have light/dark gallery references. The CPU
|
||||
board test captures both strip widths with expanded and collapsed browsers
|
||||
(`SOLIDCRAFT_HISTORY_EVIDENCE`).
|
||||
|
||||
`text(ui, text, options)` supports the existing text behaviors and the new error band:
|
||||
|
||||
| Option | Layout and scenario publication |
|
||||
|
||||
Reference in new issue
Block a user