Desktop app for designing parametric 3D models in CadQuery together with the coding agent of your choice
TypeScript 3d-modeling3d-printing3d-printing-toolsagentagentic-aiai-cadcadcadqueryclaude-codecodexelectronfemllmmacdmakeropencodeparametric-designpythonsteptext-to-cad
App: Strukturbaum im Viewer, Reiter Analysis und Animation (E82)
Kai-Jungsthoefelffdbf8959528
diff --git a/app/src/renderer/analysispanel.ts b/app/src/renderer/analysispanel.tsnew file mode 100644index 0000000..2cd62be--- /dev/null+++ b/app/src/renderer/analysispanel.ts@@ -0,0 +1,329 @@+import type { FemBc, ResultEntry, ResultPart } from '../shared/types';+import { icon } from './icons';+import { loc, safety, worstOf, withUnit, type ResultTool } from './resulttool';+import { el, fmtWhen, menuItem, menus } from './ui';++// Reiter Analysis (E82): Liste aller Ergebnisse und der ruhige Bericht zum gezeigten. Der Bericht sagt in einer großen Zahl, ob+// es hält, darunter je eine Zeile für die Annahmen (aufklappbar), die Teile als Tabelle und Berechnung und Hinweise zum+// Aufklappen. Farbe nur als Statuszeichen. Gezeigt wird im Bild über ResultTool, hier steht nur Text.++interface Ui {+ list: HTMLElement; listCount: HTMLElement; rows: HTMLElement;+ report: HTMLElement; back: HTMLButtonElement; backCount: HTMLElement; code: HTMLButtonElement; more: HTMLButtonElement;+ body: HTMLElement; pick: HTMLElement; rerun: HTMLButtonElement; agent: HTMLButtonElement; menu: HTMLElement;+}+interface Deps {+ tool: ResultTool;+ insert(text: string): void;+ openCode(file: string): void;+ copy(text: string): void;+ /** Ist der Eintrag neu (seit dem Öffnen des Modells dazugekommen und noch nicht angesehen)? */+ isNew(r: ResultEntry): boolean;+ /** Ergebnis angesehen: kein „new“ mehr. */+ seen(r: ResultEntry): void;+}++const plural = (n: number, w: string) => `${n} ${w}${n === 1 ? '' : 's'}`;+const AXES: [number, string, string][] = [[2, 'upward', 'downward'], [0, 'in +X', 'in -X'], [1, 'in +Y', 'in -Y']];+/** Richtung eines Vektors in Worten, wenn er fast entlang einer Achse zeigt, sonst die Komponenten. */+function direction(v: number[]): string {+ const n = Math.hypot(v[0], v[1], v[2]);+ if (n < 1e-12) return '';+ for (const [i, pos, neg] of AXES) if (Math.abs(v[i]) / n > 0.985) return v[i] > 0 ? pos : neg;+ return `along (${v.map((x) => loc(x / n, 2)).join(', ')})`;+}+const newton = (v: number[]) => `${loc(Math.hypot(v[0], v[1], v[2]), 1)} N`;+const modulus = (e: number) => (e >= 1000 ? `${loc(e / 1000, 1)} GPa` : `${loc(e, 0)} MPa`);++export class AnalysisPanel {+ /** Bericht oder Liste. Der Bericht gehört zum gezeigten Ergebnis. */+ private mode: 'list' | 'report' = 'report';+ /** Aufgeklappte Zeilen und Abschnitte des Berichts (bleiben beim Neuberechnen, gelten je Ergebnis). */+ private openRows = new Set<string>();+ private openFor = '';++ constructor(private readonly ui: Ui, private readonly d: Deps) {+ ui.back.addEventListener('click', () => { this.mode = 'list'; this.render(); });+ ui.rerun.addEventListener('click', () => void d.tool.rerun());+ ui.agent.addEventListener('click', () => { const t = d.tool.agentNote(); if (t) d.insert(t); });+ ui.code.addEventListener('click', () => { const f = d.tool.shown?.fem?.study; if (f) d.openCode(f); });+ ui.more.addEventListener('click', () => this.openMore());+ }++ /** Reiter geöffnet: der Bericht des gezeigten Ergebnisses, ohne Ergebnisse die Liste. */+ opened(): void { this.mode = 'report'; this.render(); }++ get showing(): 'list' | 'report' { return this.d.tool.shown ? this.mode : 'list'; }++ render(): void {+ const r = this.d.tool.shown;+ const report = !!r && this.mode === 'report';+ this.ui.list.hidden = report;+ this.ui.report.hidden = !report;+ const n = this.d.tool.list.length;+ this.ui.listCount.textContent = n ? String(n) : '';+ this.ui.backCount.textContent = String(n);+ if (report) this.renderReport(r!);+ else this.renderList();+ }++ // ---- Liste ----------------------------------------------------------------------------------------------------++ private renderList(): void {+ const list = [...this.d.tool.list].sort((a, b) => b.created - a.created);+ const cur = this.d.tool.currentId;+ const rows: HTMLElement[] = list.map((r) => {+ const w = worstOf(r);+ const bad = r.parts.some((p) => p.critical > 0);+ const d = el('span', { className: 'dot' });+ d.style.background = r.stale ? 'var(--tx3)' : bad ? 'var(--err)' : 'var(--ok)';+ const meta = el('div', { className: 'm' }, `${r.fem ? 'FEM' : 'Analysis'} · ${fmtWhen(r.created * 1000, true)}`);+ if (r.stale) meta.append(' · ', el('span', { className: 'w', textContent: 'older than the code' }));+ if (this.d.isNew(r)) meta.append(' ', el('span', { className: 'tag acc', textContent: 'new' }));+ const value = w ? (r.fem ? safety(w.value) : withUnit(w.value, r.unit)) : '–';+ const limit = r.fem ? `required ${loc(r.threshold, 1)}` : `limit ${withUnit(r.threshold, r.unit)}`;+ const b = el('button', { className: 'al-row' + (r.id === cur ? ' cur' : ''), title: `${r.title}\n${r.file}` },+ d, el('div', {}, el('div', { className: 't', textContent: r.title }), meta),+ el('div', { className: 'v' }, value, el('span', { textContent: limit })));+ b.dataset.id = r.id;+ b.addEventListener('click', () => { this.mode = 'report'; this.d.seen(r); this.d.tool.show(r.id); this.render(); });+ return b;+ });+ if (!rows.length) rows.push(el('div', { className: 'al-empty', textContent: 'No analyses yet.' }));+ this.ui.rows.replaceChildren(...rows, el('div', { className: 'al-note' },+ 'The agent creates analyses with ', el('code', { textContent: 'soma analyze' }), ' (skill “Analysis”): strength with FEM, wall thickness, overhang, clearance. They are kept in ',+ el('code', { textContent: '.soma/results/' }), '.'));+ }++ // ---- Bericht --------------------------------------------------------------------------------------------------++ private renderReport(r: ResultEntry): void {+ if (this.openFor !== r.id) { this.openFor = r.id; this.openRows.clear(); }+ this.d.seen(r);+ const tool = this.d.tool, busy = tool.busy;+ this.ui.code.hidden = !r.fem?.study;+ this.ui.code.title = r.fem?.study ? `Open the study file ${r.fem.study}` : '';+ this.ui.rerun.disabled = busy;+ const when = fmtWhen(r.created * 1000, true);+ const meta = el('div', { className: 'cx-meta' }, [r.fem ? 'FEM' : 'Analysis', r.seconds != null ? `${loc(r.seconds, 1)} s` : null,+ r.fem ? `${loc(r.fem.mesh.size, 2)} mm mesh` : null].filter(Boolean).join(' · ') + ' · ');+ if (busy) meta.append('recalculating …');+ else if (r.stale) meta.append(el('span', { className: 'w', textContent: 'older than the code' }));+ else meta.append(when);+ const kids: HTMLElement[] = [el('div', { className: 'cx-head' }, el('h3', { className: 'cx-title', textContent: r.title }), meta)];+ if (busy) kids.push(el('div', { className: 'cx-prog' }, el('i')));+ else if (r.stale) {+ const again = el('button', { textContent: 'Recalculate' });+ again.addEventListener('click', () => void tool.rerun());+ kids.push(el('div', { className: 'cx-line' }, icon('alert', 14, 2), `Values belong to the model as it was at ${when}.`, again));+ }+ kids.push(this.summary(r, busy), this.inputs(r), this.partsTable(r), this.calculation(r), ...this.notes(r));+ this.ui.body.replaceChildren(...kids);+ const pick = tool.pickText();+ this.ui.pick.hidden = !pick;+ this.ui.pick.textContent = pick ?? '';+ this.ui.pick.title = pick ? 'Clicked in the model. “Send to agent” passes this spot along.' : '';+ }++ /** Eine Zahl groß, darunter ob es hält, die kritischen Teile mit Sprung zur Stelle und ein Hinweis zur Netzabhängigkeit. */+ private summary(r: ResultEntry, dim: boolean): HTMLElement {+ const w = worstOf(r);+ const crit = r.parts.filter((p) => p.critical > 0).sort((a, b) => (r.bad === 'low' ? (a.min ?? 0) - (b.min ?? 0) : (b.max ?? 0) - (a.max ?? 0)));+ const value = (v: number | undefined) => (v == null ? '–' : r.fem ? safety(v) : loc(v, 2));+ const big = el('span', { className: 'n' }, w ? value(w.value) : '–', !r.fem && r.unit ? el('small', { textContent: r.unit }) : null);+ const what = r.fem ? 'lowest safety factor' : `${r.bad === 'low' ? 'smallest' : 'largest'} ${r.quantity.toLowerCase()}`;+ const req = r.fem ? `required ${loc(r.threshold, 1)}` : `limit ${withUnit(r.threshold, r.unit)}`;+ const ok = !crit.length;+ const status = ok ? (r.fem ? 'Holds the required safety' : `Nothing ${r.bad === 'low' ? 'below' : 'above'} the limit`)+ : r.fem ? `Below the required safety in ${plural(crit.length, 'part')}` : `${plural(crit.length, 'part')} ${r.bad === 'low' ? 'below' : 'above'} the limit`;+ const st = icon(ok ? 'okcirc' : 'xcirc', 16, 2);+ st.classList.add(ok ? 'ok' : 'bad');+ const box = el('div', { className: 'cx-sum' + (dim ? ' cx-dim' : '') },+ el('div', { className: 'cx-num' }, big, el('span', { className: 't' }, what, el('br'), el('span', { textContent: ok && w ? `${req} · ${w.part}` : req }))),+ el('div', { className: 'cx-st' }, st, status));+ for (const p of crit) {+ const d = el('span', { className: 'dot' });+ d.style.background = 'var(--err)';+ const go = el('button', { className: 'go', title: 'Show the spot', ariaLabel: `Show the spot in ${p.name}` }, icon('target', 14, 1.9));+ const row = el('div', { className: 'cx-pr' }, d, el('span', { className: 'nm', textContent: p.name }),+ el('span', { className: 'a', textContent: r.fem ? '' : `${loc(p.critical / 100, 2)} cm²` }),+ el('span', { className: 'v', textContent: value(r.bad === 'low' ? p.min : p.max) }), go);+ if (p.worst?.at) row.addEventListener('click', () => this.d.tool.showSpot(p.name)); else go.disabled = true;+ box.append(row);+ }+ // Hängt die Spitze am Netz, steht das hier, nicht erst in den Hinweisen: Die große Zahl ist dann nicht verlässlich+ const meshy = r.parts.filter((p) => p.coarse && Math.abs(p.coarse.change) > 0.15).map((p) => p.name);+ if (meshy.length) {+ const more = el('button', { className: 'lnk', textContent: 'Details' });+ more.addEventListener('click', () => { this.openRows.add('notes'); this.render(); this.ui.body.querySelector('.cx-fold.notes')?.scrollIntoView({ block: 'nearest' }); });+ box.append(el('div', { className: 'cx-warn' }, icon('alert', 14, 2), el('span', {}, `The peak in ${meshy.join(' and ')} depends on the mesh. `, more)));+ }+ return box;+ }++ /** Zeile mit Einzelheiten zum Aufklappen. */+ private row(key: string, label: string, value: string, sub: string, details: [string, string | HTMLElement][] | HTMLElement): HTMLElement[] {+ const open = this.openRows.has(key);+ const b = el('button', { className: 'cx-row' + (open ? ' open' : '') }, el('span', { className: 'l', textContent: label }),+ el('span', { className: 'v' }, value, sub ? el('span', { textContent: ` · ${sub}` }) : null), el('span', { className: 'ch' }, icon('right', 13, 2)));+ b.setAttribute('aria-expanded', String(open));+ b.addEventListener('click', () => { if (open) this.openRows.delete(key); else this.openRows.add(key); this.render(); });+ if (!open) return [b];+ const det = details instanceof HTMLElement ? details : el('dl', { className: 'cx-det' }, ...details.flatMap(([k, v]) => [el('dt', { textContent: k }), el('dd', {}, v)]));+ return [b, det];+ }++ private inputs(r: ResultEntry): HTMLElement {+ const sec = el('section', { className: 'cx-sec' }, el('div', { className: 'cx-sh', textContent: 'INPUTS' }));+ const fem = r.fem;+ if (!fem) {+ sec.append(...this.row('limit', 'Limit', withUnit(r.threshold, r.unit), `critical ${r.bad === 'low' ? 'below' : 'above'}`, [+ ['Quantity', r.unit ? `${r.quantity} (${r.unit})` : r.quantity], ['Color scale', `${withUnit(r.range[0], r.unit)} to ${withUnit(r.range[1], r.unit)}`],+ ...(r.neutral ? [['Contact', `${withUnit(r.neutral[0], r.unit)} to ${withUnit(r.neutral[1], r.unit)}, not critical`] as [string, string]] : []),+ ]));+ sec.append(...this.row('parts', 'Parts', plural(r.parts.length, 'part'), '', r.parts.map((p) => [p.name, p.group ?? ''] as [string, string])));+ return sec;+ }+ fem.bcs.forEach((b, i) => sec.append(...this.bcRow(b, i, fem.balance)));+ if (fem.gravity && Math.hypot(...fem.gravity) > 0) {+ sec.append(...this.row('gravity', 'Gravity', `${loc(Math.hypot(...fem.gravity), 2)} m/s²`, direction(fem.gravity), [['Vector', `(${fem.gravity.map((x) => loc(x, 2)).join(', ')}) m/s²`], ['Mass', 'from the density of each material']]));+ }+ // Werkstoffe: je Werkstoff einmal, mit den Teilen dazu+ const mats = new Map<string, { m: NonNullable<ResultPart['material']>; parts: string[] }>();+ for (const p of r.parts) if (p.material) {+ const e = mats.get(p.material.name);+ if (e) e.parts.push(p.name); else mats.set(p.material.name, { m: p.material, parts: [p.name] });+ }+ if (mats.size) {+ const names = [...mats.keys()];+ const det = el('dl', { className: 'cx-det' });+ for (const { m, parts } of mats.values()) {+ det.append(el('dd', { className: 'sub' }, m.name, el('span', { textContent: ` · ${parts.length > 3 ? plural(parts.length, 'part') : parts.join(', ')}` })));+ const pairs: [string, string][] = [['E modulus', modulus(m.E)], ['Strength', `${loc(m.strength, 0)} MPa, allowable ${loc(m.strength / r.threshold, 1)} MPa`]];+ if (m.nu != null) pairs.push(['Poisson ν', loc(m.nu, 2)]);+ if (m.density != null) pairs.push(['Density', `${loc(m.density, 2)} g/cm³`]);+ if (m.note) pairs.push(['Note', m.note]);+ for (const [k, v] of pairs) det.append(el('dt', { textContent: k }), el('dd', { textContent: v }));+ }+ sec.append(...this.row('mat', 'Material', names[0], names.slice(1).join(' · '), det));+ }+ const mesh = fem.mesh;+ const checked = r.parts.filter((p) => p.coarse);+ let check: string | HTMLElement = 'not checked with a coarser mesh';+ if (fem.coarse && checked.length) {+ const worst = [...checked].sort((a, b) => Math.abs(b.coarse!.change) - Math.abs(a.coarse!.change));+ const pct = (c: number) => `${c > 0 ? '+' : ''}${Math.round(c * 100) + 0} %`;+ const first = worst[0], rest = worst.slice(1);+ const big = Math.abs(first.coarse!.change) > 0.15;+ check = el('span', {}, `coarser mesh ${loc(fem.coarse.size, 2)} mm: `, el('span', { className: big ? 'wc' : 'okc', textContent: `${first.name} ${pct(first.coarse!.change)}` }),+ rest.length ? `, others ≤ ${Math.round(Math.max(...rest.map((p) => Math.abs(p.coarse!.change))) * 100)} %` : '');+ }+ sec.append(...this.row('mesh', 'Mesh', `${loc(mesh.size, 2)} mm`, `${mesh.elements.toLocaleString('en-US')} elements`, [+ ['Element size', `${loc(mesh.size, 2)} mm${mesh.auto == null ? '' : mesh.auto ? ', automatic from the model size' : ', set in the study'}`],+ ['Elements', `${mesh.elements.toLocaleString('en-US')} tetrahedra, 10 nodes`],+ ...(mesh.nodes ? [['Nodes', mesh.nodes.toLocaleString('en-US')] as [string, string]] : []),+ ['Check', check],+ ]));+ return sec;+ }++ private bcRow(b: FemBc, i: number, balance: number | undefined): HTMLElement[] {+ const faces: [string, string][] = [['Faces', b.label], ['Area', `${loc(b.area, 1)} mm²`]];+ if (b.kind === 'fix') {+ const axes = b.axes && b.axes !== 'xyz' ? b.axes.toUpperCase().split('').join(', ') : null;+ const det: [string, string | HTMLElement][] = [['Directions', axes ? `${axes} only` : 'all'], ...faces];+ if (b.reaction) det.push(['Reaction', `${newton(b.reaction)} ${direction(b.reaction)}`]);+ if (balance != null) det.push(['Balance', el('span', { className: balance < 0.01 ? 'okc' : 'wc', textContent: balance < 0.01 ? 'in equilibrium' : `off by ${loc(balance * 100, 1)} %` })]);+ return this.row(`bc${i}`, 'Support', axes ? `Fixed in ${axes}` : 'Fixed', `${b.part}`, det);+ }+ const total = b.total ?? [0, 0, 0];+ if (b.kind === 'pressure') {+ return this.row(`bc${i}`, 'Pressure', `${loc(b.value ?? 0, 3)} MPa`, b.part, [['Total force', `${newton(total)} ${direction(total)}`], ...faces]);+ }+ return this.row(`bc${i}`, 'Force', `${newton(total)} ${direction(total)}`.trim(), b.part, [['Vector', `(${total.map((x) => loc(x, 1)).join(', ')}) N`], ...faces]);+ }++ private partsTable(r: ResultEntry): HTMLElement {+ const fem = !!r.fem;+ const parts = [...r.parts].sort((a, b) => (r.bad === 'low' ? (a.min ?? Infinity) - (b.min ?? Infinity) : (b.max ?? -Infinity) - (a.max ?? -Infinity)));+ const head = fem ? ['Part', 'Safety', 'MPa', 'mm'] : ['Part', 'Min', 'Max', 'cm² crit.'];+ const rows = parts.map((p) => {+ const d = el('span', { className: 'dot' });+ d.style.background = p.critical > 0 ? 'var(--err)' : 'transparent';+ const cells = fem+ ? [p.min != null ? safety(p.min) : '–', p.stress ? loc(p.stress.value, 1) : '–', p.displacement ? loc(p.displacement.value, 3) : '–']+ : [p.min != null ? loc(p.min, 2) : '–', p.max != null ? loc(p.max, 2) : '–', p.critical > 0 ? loc(p.critical / 100, 2) : '–'];+ return el('tr', {}, el('td', { className: 'nm', title: p.name }, d, p.name), ...cells.map((c) => el('td', { textContent: c })));+ });+ return el('section', { className: 'cx-sec' },+ el('div', { className: 'cx-sh' }, 'PARTS ', el('span', { className: 'cnt', textContent: String(parts.length) }),+ el('span', { className: 'r', textContent: fem ? 'by safety' : `by ${r.bad === 'low' ? 'smallest' : 'largest'} value` })),+ el('table', { className: 'cx-tbl' }, el('thead', {}, el('tr', {}, ...head.map((h, i) => el('th', { className: i ? '' : 'l', textContent: h })))), el('tbody', {}, ...rows)));+ }++ /** Abschnitt zum Aufklappen (Berechnung, Hinweise). */+ private fold(key: string, title: string, right: string, body: HTMLElement[]): HTMLElement[] {+ const open = this.openRows.has(key);+ const b = el('button', { className: `cx-fold ${key}` }, el('span', { className: 'chev' }, icon(open ? 'down' : 'right', 13, 2)), title, el('span', { className: 'r', textContent: right }));+ b.setAttribute('aria-expanded', String(open));+ b.addEventListener('click', () => { if (open) this.openRows.delete(key); else this.openRows.add(key); this.render(); });+ return open ? [b, ...body] : [b];+ }++ private calculation(r: ResultEntry): HTMLElement {+ const fem = r.fem;+ const pairs: [string, string | HTMLElement][] = [];+ if (r.seconds != null) pairs.push(['Duration', `${loc(r.seconds, 1)} s, finished ${fmtWhen(r.created * 1000, true)}`]);+ else pairs.push(['Finished', fmtWhen(r.created * 1000, true)]);+ if (fem) {+ pairs.push(['Unknowns', fem.mesh.dofs.toLocaleString('en-US')], ['Solver', fem.mesh.solver]);+ if (fem.balance != null) pairs.push(['Equilibrium', `deviation ${loc(fem.balance * 100, 2)} %`]);+ pairs.push(['Model', 'linear elastic, small deformations, parts bonded'], ['Study', el('code', { textContent: fem.study })]);+ }+ pairs.push(['Command', el('code', { textContent: `soma ${r.command.join(' ')}` })], ['Result', el('code', { textContent: r.file })]);+ const det = el('dl', { className: 'cx-det wide' }, ...pairs.flatMap(([k, v]) => [el('dt', { textContent: k }), el('dd', {}, v)]));+ const right = [r.seconds != null ? `${loc(r.seconds, 1)} s` : null, fem ? fem.mesh.solver.split(',')[0] : null].filter(Boolean).join(' · ');+ const box = el('div', {}, ...this.fold('calc', 'CALCULATION', right, [det]));+ return box;+ }++ private notes(r: ResultEntry): HTMLElement[] {+ const notes = r.notes ?? [];+ if (!notes.length) return [];+ // Warnung: Netz, große Verformung, Spitze an der Einspannung. Sonst ein Hinweis (Werkstoff)+ const body = notes.map((t) => {+ const warn = /mesh|deformation is large|peak/i.test(t);+ return el('div', { className: 'cx-p ' + (warn ? 'w' : 'i') }, icon(warn ? 'alert' : 'info', 14, 2), el('span', { textContent: t }));+ });+ return this.fold('notes', 'NOTES', String(notes.length), body);+ }++ private openMore(): void {+ const r = this.d.tool.shown;+ if (!r) return;+ const m = this.ui.menu;+ m.replaceChildren(+ el('div', { className: 'mh', textContent: r.title }),+ menuItem('Copy command', { icon: 'copy', sub: `soma ${r.command.join(' ')}`, onClick: () => this.d.copy(`soma ${r.command.join(' ')}`) }),+ menuItem('Show the model', { icon: 'cube', onClick: () => this.d.tool.setActive(false) }),+ );+ menus.toggle(m, this.ui.more, 'right');+ }++ /** Prüfhilfe: was der Reiter zeigt. */+ state() {+ const q = (s: string) => [...this.ui.body.querySelectorAll<HTMLElement>(s)].map((x) => x.textContent ?? '');+ return {+ mode: this.ui.report.hidden ? 'list' : 'report',+ list: [...this.ui.rows.querySelectorAll<HTMLElement>('.al-row')].map((x) => ({ id: x.dataset.id, text: x.textContent, cur: x.classList.contains('cur'), isNew: !!x.querySelector('.tag') })),+ title: this.ui.body.querySelector('.cx-title')?.textContent ?? null, meta: this.ui.body.querySelector('.cx-meta')?.textContent ?? null,+ number: this.ui.body.querySelector('.cx-num .n')?.textContent ?? null, status: this.ui.body.querySelector('.cx-st')?.textContent ?? null,+ critical: q('.cx-pr'), warn: this.ui.body.querySelector('.cx-warn')?.textContent ?? null, stale: this.ui.body.querySelector('.cx-line')?.textContent ?? null,+ inputs: q('.cx-row'), details: q('.cx-det'), table: [...this.ui.body.querySelectorAll('.cx-tbl tbody tr')].map((tr) => [...tr.children].map((c) => c.textContent)),+ folds: q('.cx-fold'), notes: q('.cx-p'), pick: this.ui.pick.hidden ? null : this.ui.pick.textContent,+ };+ }++ /** Prüfhilfe: eine Zeile oder einen Abschnitt des Berichts auf- oder zuklappen. */+ testToggle(key: string): void { if (this.openRows.has(key)) this.openRows.delete(key); else this.openRows.add(key); this.render(); }+}diff --git a/app/src/renderer/animpanel.ts b/app/src/renderer/animpanel.tsnew file mode 100644index 0000000..0c4a392--- /dev/null+++ b/app/src/renderer/animpanel.ts@@ -0,0 +1,150 @@+import type { AnimEntry } from '../shared/types';+import { stepsOf, stepsSource, type AnimTool } from './animtool';+import { icon } from './icons';+import { el } from './ui';++// Reiter Animation (E82): Liste der Animationen mit den Videos darunter und der Ablauf der gezeigten. Die Schritte kommen aus der+// Animation (ausdrücklich oder aus den Untertiteln), ein Klick springt hin. Abgespielt wird in der Leiste unten im Bild (animtool.ts).++interface Ui {+ list: HTMLElement; listCount: HTMLElement; rows: HTMLElement;+ report: HTMLElement; back: HTMLButtonElement; backCount: HTMLElement; code: HTMLButtonElement;+ body: HTMLElement; video: HTMLButtonElement; agent: HTMLButtonElement;+}+interface Deps {+ tool: AnimTool;+ /** Videos in renders/ (Pfade im Projekt). */+ videos(): string[];+ openVideo(rel: string): void;+ openCode(file: string, line: number | null): void;+ insert(text: string): void;+ isNew(key: string): boolean;+ seen(key: string): void;+}++export const animKey = (a: AnimEntry) => `a:${a.id}`;+export const videoKey = (v: string) => `v:${v}`;+const base = (rel: string) => rel.split('/').pop() ?? rel;++export class AnimPanel {+ private mode: 'list' | 'report' = 'report';+ /** Zuletzt hervorgehobener Schritt: Nur bei einem Wechsel wird neu gezeichnet, nicht in jedem Bild. */+ private curStep = -2;++ constructor(private readonly ui: Ui, private readonly d: Deps) {+ ui.back.addEventListener('click', () => { this.mode = 'list'; this.render(); });+ ui.video.addEventListener('click', () => void d.tool.makeVideo());+ ui.agent.addEventListener('click', () => { const t = d.tool.agentNote(); if (t) d.insert(t); });+ ui.code.addEventListener('click', () => { const e = d.tool.shown?.entry; if (e) d.openCode(e.file, e.line); });+ }++ opened(): void { this.mode = 'report'; this.render(); }++ render(): void {+ const s = this.d.tool.shown;+ const report = !!s && this.mode === 'report';+ this.ui.list.hidden = report;+ this.ui.report.hidden = !report;+ const n = this.d.tool.entries.animations.length;+ this.ui.listCount.textContent = n ? String(n) : '';+ this.ui.backCount.textContent = String(n);+ this.curStep = -2;+ if (report) this.renderReport(); else this.renderList();+ }++ /** Zeit geändert: nur den aktuellen Schritt nachziehen. */+ tick(): void {+ const s = this.d.tool.shown;+ if (!s || this.ui.report.hidden) return;+ const t = this.d.tool.time;+ const steps = stepsOf(s.data);+ let cur = -1;+ steps.forEach((x, i) => { if (t >= x.start - 1e-6) cur = i; });+ if (cur === this.curStep) return;+ this.curStep = cur;+ this.ui.body.querySelectorAll('.cx-seq').forEach((r, i) => r.classList.toggle('cur', i === cur));+ }++ private videoRow(v: string): HTMLButtonElement {+ const b = el('button', { className: 'al-row ic3', title: `${v}: open in the player` }, el('span', { className: 'ic' }, icon('f-video', 16)),+ el('div', {}, el('div', { className: 't', textContent: base(v) }),+ el('div', { className: 'm' }, v.slice(0, v.length - base(v).length) || './', this.d.isNew(videoKey(v)) ? el('span', { className: 'tag acc', textContent: 'new' }) : null)),+ el('div', { className: 'v' }));+ b.addEventListener('click', () => { this.d.seen(videoKey(v)); this.d.openVideo(v); this.render(); });+ return b;+ }++ private renderList(): void {+ const { animations, errors } = this.d.tool.entries;+ const cur = this.d.tool.currentId;+ const rows: HTMLElement[] = animations.map((a) => {+ const meta = el('div', { className: 'm' }, `${a.parts} moving part${a.parts === 1 ? '' : 's'}`);+ if (a.stale) meta.append(' · ', el('span', { className: 'w', textContent: 'older than the code' }));+ if (this.d.isNew(animKey(a))) meta.append(' ', el('span', { className: 'tag acc', textContent: 'new' }));+ const b = el('button', { className: 'al-row ic3' + (a.id === cur ? ' cur' : ''), title: `${a.name}\n${a.file}` },+ el('span', { className: 'ic' }, icon('anim', 16)), el('div', {}, el('div', { className: 't', textContent: a.name }), meta),+ el('div', { className: 'v' }, el('span', { textContent: `${a.duration.toFixed(1)} s` })));+ b.dataset.id = a.id;+ b.addEventListener('click', () => { this.mode = 'report'; this.d.seen(animKey(a)); this.d.tool.show(a.id); this.render(); });+ return b;+ });+ for (const e of errors) rows.push(el('div', { className: 'al-err' }, icon('alert', 14, 2), el('span', { textContent: `${e.file}${e.line ? `, line ${e.line}` : ''}: ${e.message}` })));+ if (!animations.length && !errors.length) rows.push(el('div', { className: 'al-empty', textContent: 'No animations yet.' }));+ const videos = this.d.videos();+ if (videos.length) {+ rows.push(el('div', { className: 'al-sh' }, 'VIDEOS ', el('span', { className: 'cnt', textContent: String(videos.length) }), el('span', { className: 'r', textContent: 'renders/' })));+ rows.push(...videos.map((v) => this.videoRow(v)));+ }+ this.ui.rows.replaceChildren(...rows, el('div', { className: 'al-note' },+ 'The agent creates animations in ', el('code', { textContent: 'animations/' }), ' and videos with ', el('code', { textContent: 'soma render' }),+ ' (skill “Animation and video”). A video opens in the player.'));+ }++ private renderReport(): void {+ const s = this.d.tool.shown!;+ const { entry, data } = s;+ this.d.seen(animKey(entry));+ const tool = this.d.tool;+ this.ui.video.disabled = tool.isRendering;+ this.ui.code.title = `Open ${entry.file}${entry.line ? `, line ${entry.line}` : ''}`;+ const meta = el('div', { className: 'cx-meta' }, `Animation · ${data.duration.toFixed(1)} s · ${entry.parts} part${entry.parts === 1 ? '' : 's'} move`);+ const kids: HTMLElement[] = [el('div', { className: 'cx-head' }, el('h3', { className: 'cx-title', textContent: entry.name }), meta)];+ const hint = tool.hint();+ if (hint) kids.push(el('div', { className: 'cx-line' + (hint.warn ? '' : ' info') }, icon(hint.warn ? 'alert' : 'info', 14, 2), el('span', { textContent: hint.text })));+ kids.push(el('div', { className: 'cx-gap' }));+ const steps = stepsOf(data);+ const sec = el('section', { className: 'cx-sec' }, el('div', { className: 'cx-sh' }, 'STEPS', el('span', { className: 'r', textContent: stepsSource(data) })));+ if (steps.length) {+ sec.append(...steps.map((x) => {+ const b = el('button', { className: 'cx-seq', title: `Jump to ${x.start.toFixed(1)} s` }, el('span', { className: 't', textContent: `${x.start.toFixed(1)} s` }), el('span', { textContent: x.text }));+ b.addEventListener('click', () => tool.jump(x.start));+ return b;+ }));+ } else sec.append(el('div', { className: 'cx-empty', textContent: 'The animation has no steps or subtitles. Play it in the bar below the image.' }));+ kids.push(sec);+ // Videos dieser Animation: „Make video“ schreibt renders/<id>.mp4, der Agent nennt seine meist ähnlich+ const mine = this.d.videos().filter((v) => base(v).toLowerCase().startsWith(entry.id.toLowerCase()));+ const vids = el('section', { className: 'cx-sec' }, el('div', { className: 'cx-sh' }, 'VIDEOS ', el('span', { className: 'cnt', textContent: String(mine.length) }), el('span', { className: 'r', textContent: 'renders/' })));+ if (mine.length) vids.append(...mine.map((v) => {+ const b = el('button', { className: 'cx-file', title: `${v}: open in the player` }, icon('f-video', 15), el('span', { textContent: base(v) }), el('span', { className: 's' }));+ b.addEventListener('click', () => { this.d.seen(videoKey(v)); this.d.openVideo(v); });+ return b;+ }));+ else vids.append(el('div', { className: 'cx-empty', textContent: 'No video yet. “Make video” writes one to renders/.' }));+ kids.push(vids);+ this.ui.body.replaceChildren(...kids);+ this.tick();+ }++ /** Prüfhilfe. */+ state() {+ return {+ mode: this.ui.report.hidden ? 'list' : 'report',+ list: [...this.ui.rows.querySelectorAll<HTMLElement>('.al-row')].map((x) => ({ id: x.dataset.id ?? null, text: x.textContent, cur: x.classList.contains('cur'), isNew: !!x.querySelector('.tag') })),+ title: this.ui.body.querySelector('.cx-title')?.textContent ?? null, meta: this.ui.body.querySelector('.cx-meta')?.textContent ?? null,+ hint: this.ui.body.querySelector('.cx-line')?.textContent ?? null,+ steps: [...this.ui.body.querySelectorAll<HTMLElement>('.cx-seq')].map((x) => ({ text: x.textContent, cur: x.classList.contains('cur') })),+ videos: [...this.ui.body.querySelectorAll<HTMLElement>('.cx-file')].map((x) => x.textContent),+ };+ }+}diff --git a/app/src/renderer/animtool.ts b/app/src/renderer/animtool.tsindex 50404fe..1a599f9 100644--- a/app/src/renderer/animtool.ts+++ b/app/src/renderer/animtool.ts@@ -6,16 +6,17 @@ import { paintOverlay } from './overlay';import { el } from './ui';import type { Viewer } from './viewer';-// Animationen im Viewer (E58): auswählen, abspielen, an eine Stelle springen. Die Bauteile bewegen sich im echten Modell,+// Animationen im Viewer (E58, E82): abspielen, an eine Stelle springen. Die Bauteile bewegen sich im echten Modell,// angehalten gehen Schnitt, Auswahl und Markieren. Untertitel und Beschriftungen stehen wie im Video über dem Bild, lassen sich-// im Viewer aber ausblenden (das Video behält sie).+// im Viewer aber ausblenden (das Video behält sie). Abgespielt wird in der Leiste unten im Bild (mit dem × zurück zum Modell),+// Liste, Schritte und Videos zeigt der Reiter Animation (animpanel.ts).interface Ui {- card: HTMLElement; close: HTMLButtonElement;- select: HTMLSelectElement; play: HTMLButtonElement; range: HTMLInputElement; time: HTMLElement;- loop: HTMLButtonElement; follow: HTMLButtonElement; speed: HTMLSelectElement; hint: HTMLElement;- video: HTMLButtonElement; agent: HTMLButtonElement;- /** Bekommt die Klasse `animating`, solange die Karte offen ist. */+ /** Leiste unten im Bild. */+ bar: HTMLElement; close: HTMLButtonElement;+ play: HTMLButtonElement; range: HTMLInputElement; time: HTMLElement; total: HTMLElement; ticks: HTMLElement;+ loop: HTMLButtonElement; follow: HTMLButtonElement; texts: HTMLButtonElement; speed: HTMLSelectElement;+ /** Bekommt die Klasse `animating`, solange eine Animation gezeigt wird. */viewerEl: HTMLElement;}interface Deps {@@ -30,8 +31,10 @@ interface Deps {toast(text: string, kind?: 'ok' | 'info' | 'error'): void;/** Ein erzeugtes Video zeigen. */showVideo(rel: string): void;- /** An, aus oder eine andere Animation: der Umschalter oben links zeigt, was zu sehen ist. */+ /** An, aus, eine andere Animation, neu gelesen oder Video fertig: Reiter und Baum ziehen nach. */changed(): void;+ /** Zeit oder Abspielen geändert (bei jedem Bild): der aktuelle Schritt im Reiter. */+ tick(): void;}export class AnimTool {@@ -46,27 +49,25 @@ export class AnimTool {private loop = false;/** Titel, Untertitel und Beschriftungen zeigen. Gilt für alle Animationen der Sitzung: Wer sie ausblendet, will meist nur die Bewegung sehen. */private texts = true;- /** Der Schalter steht in der Karte, gesucht statt übergeben (fehlt er, gibt es eben keinen Schalter). */- private readonly textsBtn: HTMLButtonElement | null;private rendering = false;+ /** Fortschritt beim Erzeugen eines Videos (0 bis 1). */+ private renderFraction = 0;+ /** Zuletzt gezeigte Animation: Der Reiter Animation bringt sie wieder. */+ private lastId: string | null = null;/** Für welche veraltete Animation schon ein Neubau angestoßen ist (nicht in jeder Runde erneut). */private rebuilt = '';private loading = 0;- /** Beim nächsten Laden diese Animation zeigen (Wahl im Umschalter). */+ /** Beim nächsten Laden diese Animation zeigen (Wahl im Reiter). */private want: string | null = null;constructor(private readonly ui: Ui, private readonly d: Deps) {ui.close.addEventListener('click', () => this.setActive(false));- ui.select.addEventListener('change', () => void this.choose(ui.select.value));ui.play.addEventListener('click', () => (this.playing ? this.pause() : this.play()));ui.range.addEventListener('input', () => { this.pause(); this.seek(Number(ui.range.value)); });ui.loop.addEventListener('click', () => { this.loop = !this.loop; ui.loop.setAttribute('aria-pressed', String(this.loop)); });ui.follow.addEventListener('click', () => this.setFollow(!this.follow));- this.textsBtn = ui.card.querySelector<HTMLButtonElement>('#btn-anim-texts');- this.textsBtn?.addEventListener('click', () => this.setTexts(!this.texts));+ ui.texts.addEventListener('click', () => this.setTexts(!this.texts));ui.speed.addEventListener('change', () => { this.last = performance.now(); });- ui.video.addEventListener('click', () => void this.makeVideo());- ui.agent.addEventListener('click', () => { const t = this.agentNote(); if (t) d.insert(t); });window.addEventListener('keydown', (e) => {if (!this.active || (e.target as HTMLElement | null)?.closest?.('input, textarea, select, .cm-editor, #terminals')) return;// Liegt ein Video oder die Zeichenfläche darüber, gehört ihnen die Leertaste@@ -79,19 +80,26 @@ export class AnimTool {/** Name der gezeigten Animation (null: keine geladen). */get currentName(): string | null { return this.active ? this.current?.entry.name ?? null : null; }get currentId(): string | null { return this.active ? this.current?.entry.id ?? null : null; }+ /** Gezeigte Animation mit ihren Daten (Schritte, Untertitel), null: keine. */+ get shown(): { entry: AnimEntry; data: AnimData } | null { return this.active ? this.current : null; }+ /** Alle Animationen und Fehler der Dateien, wie zuletzt gelesen. */+ get entries(): AnimList { return this.list; }+ get time(): number { return this.t; }+ get isPlaying(): boolean { return this.playing; }+ get isRendering(): boolean { return this.rendering; }- /** Eine bestimmte Animation zeigen (aus dem Umschalter oben links), null: die zuletzt gezeigte oder die erste. */+ /** Eine bestimmte Animation zeigen, null: die zuletzt gezeigte, beim ersten Mal die erste. */show(id: string | null): void {- this.want = id;+ this.want = id ?? this.lastId;if (!this.active) this.setActive(true);- else if (id && id !== this.current?.entry.id) void this.choose(id);+ else if (this.want && this.want !== this.current?.entry.id) { const w = this.want; this.want = null; void this.choose(w); }}setActive(on: boolean): void {if (on === this.active) return;if (on) this.d.beforeOn();this.active = on;- this.ui.card.hidden = !on;+ this.ui.bar.hidden = !on;this.ui.viewerEl.classList.toggle('animating', on);this.d.changed();if (on) { void this.refresh(); return; }@@ -102,19 +110,18 @@ export class AnimTool {this.d.viewer.setPainter(null);}- /** Liste neu lesen (Watcher, Build, Einschalten) und die gewählte Animation neu laden. */+ /** Liste neu lesen (Watcher, Build, Einschalten) und die gewählte Animation neu laden. Ohne gezeigte Animation nur die Liste. */async refresh(): Promise<void> {- if (!this.active) return;const seq = ++this.loading;- try { this.list = await this.d.list(); } catch { return; }- if (seq !== this.loading || !this.active) return;+ let list: AnimList;+ try { list = await this.d.list(); } catch { return; }+ if (seq !== this.loading) return;+ this.list = list;+ if (!this.active) { this.d.changed(); return; }const anims = this.list.animations;- this.ui.select.replaceChildren(...anims.map((a) => el('option', { value: a.id, textContent: `${a.name} (${a.duration.toFixed(1)} s)` })));- this.ui.select.disabled = anims.length < 2;const want = anims.find((a) => a.id === (this.want ?? this.current?.entry.id)) ?? anims[0];this.want = null;if (want) {- this.ui.select.value = want.id;// Veraltet (Code oder Animationsdatei geändert): einmal neu bauen lassen, die Liste kommt danach wiederif (!want.stale) this.rebuilt = '';else if (!this.list.building && this.rebuilt !== want.id) {@@ -129,8 +136,12 @@ export class AnimTool {this.d.viewer.setPainter(null);}this.render();+ this.d.changed();}+ /** Liste von außen (der Reiter liest sie ohnehin), ohne die gezeigte Animation neu zu laden. */+ setList(list: AnimList): void { this.list = list; }+/** Neues Modell geladen: Liste neu lesen (veraltet?) und die Lagen erneut anwenden, die Bauteile sind neu. */modelChanged(): void { if (this.active) void this.refresh(); }@@ -141,6 +152,7 @@ export class AnimTool {this.t = 0;await this.load(e, ++this.loading);this.render();+ this.d.changed();}private async load(entry: AnimEntry, seq: number): Promise<void> {@@ -150,12 +162,19 @@ export class AnimTool {if (seq !== this.loading || !this.active) return;const fresh = this.current?.entry.id !== entry.id;this.current = { entry, data, glb: entry.glb };+ this.lastId = entry.id;if (fresh) this.setFollow(!data.meta.cameraAuto);this.ui.range.max = String(data.duration);this.ui.range.step = String(Math.min(0.01, data.duration / 1000));this.t = Math.min(this.t, data.duration);+ // Marken der Schritte auf der Zeitleiste+ this.ui.ticks.replaceChildren(...stepsOf(data).map((s) => {+ const m = el('span', { className: 'cm', title: s.text });+ m.style.left = `${((s.start / Math.max(data.duration, 1e-6)) * 100).toFixed(2)}%`;+ return m;+ }));+ this.ui.total.textContent = `${data.duration.toFixed(1)} s`;this.apply();- this.d.changed();} catch (e) {this.current = null;this.d.toast(`Could not load the animation: ${e instanceof Error ? e.message : String(e)}`, 'error');@@ -170,7 +189,7 @@ export class AnimTool {private setTexts(on: boolean): void {this.texts = on;- this.textsBtn?.setAttribute('aria-pressed', String(on));+ this.ui.texts.setAttribute('aria-pressed', String(on));// Nur die Texte neu malen: Ein ganzes apply() würde angehalten die frei gedrehte Kamera zurücksetzenif (this.current) this.paintTexts(this.current.data.frame(this.t));}@@ -181,6 +200,9 @@ export class AnimTool {this.apply();}+ /** An eine Zeit springen (Schritt im Reiter angeklickt). Läuft die Animation, läuft sie dort weiter. */+ jump(t: number): void { this.last = performance.now(); this.seek(t); }+/** Stand zur aktuellen Zeit in den Viewer: Lagen, Zustände, Kamera (wenn sie folgt) und Texte. */private apply(): void {const c = this.current;@@ -195,7 +217,9 @@ export class AnimTool {if (this.follow) this.d.viewer.setCamera(f.camera.position, f.camera.target);this.paintTexts(f);this.ui.range.value = String(this.t);- this.ui.time.textContent = `${this.t.toFixed(2)} / ${c.data.duration.toFixed(2)} s`;+ this.ui.range.style.setProperty('--done', `${((this.t / Math.max(c.data.duration, 1e-6)) * 100).toFixed(2)}%`);+ this.ui.time.textContent = `${this.t.toFixed(1)} s`;+ this.d.tick();}/** Titel, Untertitel und Beschriftungen über das Bild, ausgeschaltet gar nichts (auch nicht im Bild für die Markierung). */@@ -203,8 +227,8 @@ export class AnimTool {if (!this.texts) { this.d.viewer.setPainter(null); return; }this.d.viewer.setPainter((g, w, h, project) => paintOverlay(g, w, h, {caption: f.caption, title: f.title,- // Im Viewer stehen unten links die Karten: Untertitel darüber, sonst verdecken sie ihn (im Video steht er unten)- captionLift: this.ui.card.hidden ? 0 : ((this.ui.card.parentElement ?? this.ui.card).offsetHeight + 24) * (w / Math.max(1, this.ui.viewerEl.clientWidth)),+ // Im Viewer steht unten die Abspielleiste: Untertitel darüber, sonst verdeckt sie ihn (im Video steht er unten)+ captionLift: this.ui.bar.hidden ? 0 : (this.ui.bar.offsetHeight + 34) * (w / Math.max(1, this.ui.viewerEl.clientWidth)),labels: f.labels.map((l) => ({ text: l.text, p: project(l.at) })).filter((l) => l.p).map((l) => ({ text: l.text, x: l.p!.x, y: l.p!.y })),}));}@@ -238,42 +262,43 @@ export class AnimTool {}private renderPlay(): void {- this.ui.play.replaceChildren(icon(this.playing ? 'pause' : 'play', 16, 2));+ this.ui.play.replaceChildren(icon(this.playing ? 'pause' : 'play', 16, 2.2));this.ui.play.setAttribute('aria-label', this.playing ? 'Pause' : 'Play');this.ui.play.title = this.playing ? 'Pause (Space)' : 'Play (Space)';+ this.d.tick();}private render(): void {- const c = this.current, hint = this.ui.hint;- const err = this.list.errors[0];- const has = !!c;- for (const b of [this.ui.play, this.ui.agent, this.ui.video, this.ui.follow, this.ui.loop, this.textsBtn]) if (b) b.disabled = !has;+ const has = !!this.current;+ for (const b of [this.ui.play, this.ui.follow, this.ui.loop, this.ui.texts]) b.disabled = !has;this.ui.range.disabled = !has;- this.ui.video.disabled = !has || this.rendering;- hint.classList.toggle('warn', !!err || !!c?.entry.stale);- if (this.rendering) return;- if (err) hint.textContent = `${err.file}${err.line ? `, line ${err.line}` : ''}: ${err.message}`;- else if (this.list.building) hint.textContent = 'Building the animation …';- else if (c?.entry.stale) hint.textContent = 'Older than the code, rebuilding …';- else if (c) hint.textContent = `${c.entry.file}, line ${c.entry.line ?? 1} · ${c.entry.parts} moving part${c.entry.parts === 1 ? '' : 's'}`;- else hint.textContent = 'No animation yet. The agent creates them in animations/ (skill “Animation and video”).';- if (!has) this.ui.time.textContent = '';+ if (!has) { this.ui.time.textContent = ''; this.ui.total.textContent = ''; this.ui.ticks.replaceChildren(); }+ }++ /** Zeile unter dem Kopf im Reiter: Fehler, Bauen, veraltet, Video in Arbeit. `warn`: gelb. */+ hint(): { text: string; warn: boolean } | null {+ const c = this.current, err = this.list.errors[0];+ if (this.rendering) return { text: `Making the video … ${Math.round(this.renderFraction * 100)} %`, warn: false };+ if (err) return { text: `${err.file}${err.line ? `, line ${err.line}` : ''}: ${err.message}`, warn: true };+ if (this.list.building) return { text: 'Building the animation …', warn: false };+ if (c?.entry.stale) return { text: 'Older than the code, rebuilding …', warn: true };+ return null;}/** Fortschritt beim Erzeugen eines Videos (0 bis 1). */progress(f: number): void {if (!this.rendering) return;- this.ui.hint.classList.remove('warn');- this.ui.hint.textContent = `Making the video … ${Math.round(f * 100)} %`;+ this.renderFraction = f;+ this.d.changed();}- private async makeVideo(): Promise<void> {+ async makeVideo(): Promise<void> {const c = this.current;if (!c || this.rendering) return;this.pause();this.rendering = true;- this.ui.video.disabled = true;- this.progress(0);+ this.renderFraction = 0;+ this.d.changed();try {const r = await this.d.renderVideo(c.entry.id);if (!r.ok) { this.d.toast(`Could not make the video: ${r.error ?? 'unknown error'}`, 'error'); return; }@@ -282,7 +307,7 @@ export class AnimTool {if (mp4) this.d.showVideo(mp4);} finally {this.rendering = false;- this.render();+ this.d.changed();}}@@ -293,7 +318,7 @@ export class AnimTool {return `animation "${this.current.entry.name}" at ${this.t.toFixed(2)} s${this.texts ? '' : ' (without titles, captions and labels)'}`;}- private agentNote(): string | null {+ agentNote(): string | null {const c = this.current;return c ? `[Animation: "${c.entry.name}" (${c.entry.file}) at ${this.t.toFixed(2)} s] ` : null;}@@ -303,7 +328,7 @@ export class AnimTool {return {active: this.active, playing: this.playing, t: +this.t.toFixed(3), follow: this.follow, loop: this.loop, texts: this.texts,name: this.current?.entry.name ?? null, duration: this.current?.data.duration ?? null,- options: [...this.ui.select.options].map((o) => o.textContent), hint: this.ui.hint.textContent, time: this.ui.time.textContent,+ options: this.list.animations.map((a) => a.name), hint: this.hint()?.text ?? '', time: this.ui.time.textContent,note: this.agentNote(), building: this.list.building, errors: this.list.errors.length,};}@@ -311,3 +336,16 @@ export class AnimTool {/** Prüfhilfe: an diese Zeit springen (in unsichtbaren Fenstern läuft requestAnimationFrame nicht). */testSeek(t: number): void { this.pause(); this.seek(t); }}++/**+ * Schritte einer Animation für den Reiter (E82): die Untertitel, die der Agent für Menschen geschrieben hat. Ohne Untertitel+ * der Ablauf aus der Datei (Bewegungen und Kamera, wie `soma anim info`), ohne Pausen und Texte.+ */+export function stepsOf(data: AnimData): { start: number; end: number; text: string }[] {+ const caps = (data.meta.captions ?? []).filter((c) => c.text);+ if (caps.length) return caps;+ return (data.meta.steps ?? []).filter((x) => !/^(Pause|Title|Caption|Label)/.test(x.text));+}++/** Woher die Schritte kommen. */+export const stepsSource = (data: AnimData) => ((data.meta.captions ?? []).some((c) => c.text) ? 'from the subtitles' : 'from the animation');diff --git a/app/src/renderer/icons.ts b/app/src/renderer/icons.tsindex 0297d5f..63f7fec 100644--- a/app/src/renderer/icons.ts+++ b/app/src/renderer/icons.ts@@ -4,7 +4,15 @@ const PATHS: Record<string, string> = {cube: '<path d="M12 2.5 20.5 7.2v9.6L12 21.5l-8.5-4.7V7.2z"/><path d="M3.5 7.2 12 12l8.5-4.8M12 12v9.5"/>',// Marke von SOMA (E44): der Würfel als Sprechblase mit gefülltem Deckellogo: '<path d="M12 2.6 19.9 7.1 12 11.6 4.1 7.1z" fill="currentColor"/><path d="M12 2.6 19.9 7.1v9L12 20.6l-4.3-2.45-5.3 3.2 1.7-7.5V7.1z"/><path d="M4.1 7.1 12 11.6l7.9-4.5M12 11.6v9"/>',- down: '<path d="m6 9 6 6 6-6"/>', up: '<path d="m6 15 6-6 6 6"/>', right: '<path d="m9 6 6 6-6 6"/>',+ down: '<path d="m6 9 6 6 6-6"/>', up: '<path d="m6 15 6-6 6 6"/>', right: '<path d="m9 6 6 6-6 6"/>', left: '<path d="m15 6-6 6 6 6"/>',+ key: '<rect x="3" y="6" width="18" height="12" rx="2"/><path d="M7 10h.01M11 10h.01M15 10h.01M8 14h8"/>',+ // Strukturbaum (E82): Wurzel mit zwei Zweigen+ tree: '<rect x="3" y="3" width="7" height="5" rx="1"/><rect x="13" y="10.5" width="8" height="4.5" rx="1"/><rect x="13" y="17" width="8" height="4.5" rx="1"/><path d="M6.5 8v11.2H13M6.5 12.7H13"/>',+ // Bericht der Analyse (E82): hält, hält nicht, Kraft als Beschriftung im Bild, weitere Befehle+ okcirc: '<circle cx="12" cy="12" r="9"/><path d="m8 12.4 2.8 2.8L16.2 9.6"/>',+ xcirc: '<circle cx="12" cy="12" r="9"/><path d="m15 9-6 6M9 9l6 6"/>',+ force: '<path d="M12 20.5V4.5M6.5 10 12 4.5l5.5 5.5"/>',+ more: '<circle cx="5" cy="12" r="1.3" fill="currentColor"/><circle cx="12" cy="12" r="1.3" fill="currentColor"/><circle cx="19" cy="12" r="1.3" fill="currentColor"/>',refresh: '<path d="M20 12a8 8 0 1 1-2.3-5.7L20 8.5"/><path d="M20 3.5v5h-5"/>',export: '<path d="M12 15V4M7 9l5-5 5 5"/><path d="M5 14v5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5"/>',folder: '<path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>',diff --git a/app/src/renderer/index.html b/app/src/renderer/index.htmlindex 3bd8d27..0e3831f 100644--- a/app/src/renderer/index.html+++ b/app/src/renderer/index.html@@ -35,10 +35,15 @@</header><div id="body">+ <!-- Leiste in drei Gruppen (E82): Arbeit am Modell, Ergebnisse des Agenten, Regeln für den Agenten. Die Bauteile stehen im Baum oben links im Viewer.+ Der Punkt am Reiter: Neues vom Agenten, noch nicht angesehen --><nav id="rail" aria-label="Sidebars">- <button data-panel="parts" aria-pressed="false" title="Parts of the model: select, hide and show, make transparent"><i data-icon="cube" data-size="20" data-stroke="1.7"></i><span>Parts</span></button><button data-panel="params" aria-pressed="false" title="Parameters: values of the model you can change, such as sizes, counts or angles"><i data-icon="sliders" data-size="20" data-stroke="1.7"></i><span>Parameters</span></button><button data-panel="files" aria-pressed="false" title="Files of the model. Click a file to open it in the code next to it."><i data-icon="folder" data-size="20" data-stroke="1.7"></i><span>Files</span></button>+ <span class="rail-sep"></span>+ <button data-panel="analysis" aria-pressed="false" title="Analyses of the agent: strength (FEM), wall thickness, overhang, clearance. Shows the result in the viewer."><i data-icon="gauge" data-size="20" data-stroke="1.7"></i><span>Analysis</span><i id="nd-analysis" class="nd" hidden></i></button>+ <button data-panel="anim" aria-pressed="false" title="Animations and videos of the agent. Plays the animation in the viewer."><i data-icon="anim" data-size="20" data-stroke="1.7"></i><span>Animation</span><i id="nd-anim" class="nd" hidden></i></button>+ <span class="rail-sep"></span><button data-panel="skills" aria-pressed="false" title="Skills: rules for the agent, set per model (3D printing, tolerances …)"><i data-icon="book" data-size="20" data-stroke="1.7"></i><span>Skills</span></button><span class="grow"></span><button disabled title="Help is coming in a later version"><i data-icon="help" data-size="20" data-stroke="1.7"></i><span>Help</span></button>@@ -46,14 +51,6 @@</nav><aside id="side" hidden>- <!-- Bauteile (Entwurf 2): fest in der Seitenleiste statt als Karte im Viewer -->- <section id="panel-parts" class="panel" aria-label="Parts" hidden>- <div class="side-hd"><b>Parts</b><span id="parts-count" class="c3 hd-count"></span><span class="grow"></span>- <button id="btn-parts-search" class="ibtn s" aria-label="Search parts" title="Search parts"><i data-icon="search" data-size="15" data-stroke="1.9"></i></button>- <button class="ibtn s side-close" aria-label="Close sidebar"><i data-icon="x" data-size="15" data-stroke="2"></i></button></div>- <input id="parts-filter" class="filter" type="search" placeholder="Search part" aria-label="Search part" hidden>- <div id="tab-model" class="list ptree"></div>- </section><!-- Parameter (Entwurf 2, Bild 6): Werte, die der Agent mit param() freigibt. Der Wert im Code bleibt, die des Nutzers stehen in parameters.json --><section id="panel-params" class="panel" aria-label="Parameters" hidden><div class="side-hd"><b>Parameters</b><span id="params-count" class="c3 hd-count"></span><span class="grow"></span>@@ -71,6 +68,48 @@<div id="tab-files" class="ftree"></div><div id="dropzone" class="dropzone" title="STEP files, images and sketches go to inputs/. Existing files are not overwritten."><i data-icon="upload" data-size="16"></i><span><b>Drop here:</b> goes to <code>inputs/</code></span></div></section>+ <!-- Analysis (E82): Liste aller Ergebnisse und der ruhige Bericht zum gezeigten (analysispanel.ts) -->+ <section id="panel-analysis" class="panel cx" aria-label="Analyses" hidden>+ <div id="an-list" class="panel">+ <div class="side-hd"><b>Analyses</b><span id="an-count" class="c3 hd-count"></span><span class="grow"></span>+ <button class="ibtn s" aria-label="What are analyses?" title="Analyses are results of the agent: strength with FEM, wall thickness, overhang, clearance. Click one to see it in the viewer with its report. The × in the bar below the image shows the model again."><i data-icon="info" data-size="15" data-stroke="1.9"></i></button>+ <button class="ibtn s side-close" aria-label="Close sidebar"><i data-icon="x" data-size="15" data-stroke="2"></i></button></div>+ <div id="an-rows" class="al"></div>+ </div>+ <div id="an-report" class="panel" hidden>+ <div class="side-hd"><button id="btn-an-back" class="back" title="All analyses"><i data-icon="left" data-size="15" data-stroke="2"></i>Analyses<span id="an-back-count" class="cnt"></span></button><span class="grow"></span>+ <button id="btn-an-code" class="ibtn s" aria-label="Open the study file"><i data-icon="code" data-size="15" data-stroke="1.9"></i></button>+ <button id="btn-an-more" class="ibtn s" aria-label="More" title="More" aria-haspopup="menu" aria-expanded="false"><i data-icon="more" data-size="16"></i></button>+ <button class="ibtn s side-close" aria-label="Close sidebar" title="Close the sidebar. The result stays in the viewer."><i data-icon="x" data-size="15" data-stroke="2"></i></button></div>+ <div id="an-body" class="cx-scroll"></div>+ <div class="cx-foot">+ <div id="an-pick" class="cx-pick" hidden></div>+ <div class="cx-acts">+ <button id="btn-result-rerun" class="btn sm" title="Run the same analysis again on the current model"><i data-icon="refresh" data-size="14" data-stroke="1.9"></i>Recalculate</button>+ <button id="btn-result-agent" class="btn sm acc" title="Add the result and the clicked spot to the agent's input"><i data-icon="send" data-size="14" data-stroke="1.9"></i>Send to agent</button>+ </div>+ </div>+ </div>+ </section>+ <!-- Animation (E82): Liste mit Videos und der Ablauf der gezeigten (animpanel.ts). Abgespielt wird unten im Bild -->+ <section id="panel-anim" class="panel cx" aria-label="Animations" hidden>+ <div id="am-list" class="panel">+ <div class="side-hd"><b>Animations</b><span id="am-count" class="c3 hd-count"></span><span class="grow"></span>+ <button class="ibtn s" aria-label="What are animations?" title="Animations show motion: assembly, mechanisms, explanations. The agent writes them in animations/. Click one to play it in the viewer, the × in the bar below the image shows the model again. Videos are made from them."><i data-icon="info" data-size="15" data-stroke="1.9"></i></button>+ <button class="ibtn s side-close" aria-label="Close sidebar"><i data-icon="x" data-size="15" data-stroke="2"></i></button></div>+ <div id="am-rows" class="al"></div>+ </div>+ <div id="am-report" class="panel" hidden>+ <div class="side-hd"><button id="btn-am-back" class="back" title="All animations"><i data-icon="left" data-size="15" data-stroke="2"></i>Animations<span id="am-back-count" class="cnt"></span></button><span class="grow"></span>+ <button id="btn-am-code" class="ibtn s" aria-label="Open the animation file"><i data-icon="code" data-size="15" data-stroke="1.9"></i></button>+ <button class="ibtn s side-close" aria-label="Close sidebar" title="Close the sidebar. The animation stays in the viewer."><i data-icon="x" data-size="15" data-stroke="2"></i></button></div>+ <div id="am-body" class="cx-scroll"></div>+ <div class="cx-foot"><div class="cx-acts">+ <button id="btn-anim-video" class="btn sm" title="Write a video (MP4) of this animation to renders/ and play it"><i data-icon="f-video" data-size="14" data-stroke="1.9"></i>Make video</button>+ <button id="btn-anim-agent" class="btn sm acc" title="Add the animation's name and the time to the agent's input"><i data-icon="send" data-size="14" data-stroke="1.9"></i>Send to agent</button>+ </div></div>+ </div>+ </section><section id="panel-skills" class="panel" aria-label="Skills" hidden><div class="side-hd"><b>Skills</b><span class="grow"></span><button id="btn-skills-manage" class="ibtn s" aria-label="Edit skills" title="Edit skills and add your own (Settings)"><i data-icon="pen" data-size="15" data-stroke="1.9"></i></button>@@ -112,15 +151,10 @@</div></div>- <!-- Oben links: was der Viewer zeigt (Modell oder ein Ergebnis des Agenten). In der Mitte die Werkzeuge. -->+ <!-- Ganz oben links der Strukturbaum (E82, tree.ts): ohne Hintergrund, eingeklappt nur der Name des Modells. In der Mitte die Werkzeuge. -->+ <div id="tree" class="tree" aria-label="Structure tree"></div><div id="vtop" class="vtop">- <div id="view-switch" class="float switcher">- <button id="btn-view" class="sb" aria-haspopup="menu" aria-expanded="false" title="What the viewer shows: the model, an analysis, an animation or a video">- <span id="view-ico" class="vico"><i data-icon="cube" data-size="16"></i></span><b id="view-name">Model</b><span id="view-sub" class="c3"></span>- <span id="view-new" class="newbadge" hidden></span><i data-icon="down" data-size="14" data-stroke="2"></i></button>- <span id="view-sep" class="vs" hidden></span>- <button id="btn-view-close" class="ibtn s" aria-label="Back to the model" title="Back to the model" hidden><i data-icon="x" data-size="14" data-stroke="2"></i></button>- </div>+ <span id="tree-space" class="treespace"></span><span class="grow"></span><div id="dock" class="float dock" role="toolbar" aria-label="Tools"><button id="btn-measure" aria-pressed="false" title="Measure: click a face or edge, a second click measures distance and angle (exact values)"><i data-icon="ruler"></i><span class="lbl">Measure</span></button>@@ -216,62 +250,39 @@</div></div>- <!-- Animation (E58, animtool.ts): Ablauf aus animations/*.py abspielen. Ändert nichts am Modell. -->- <div id="anim-card" class="float ancard" hidden>- <div class="mc-hd"><span class="mc-ico"><i data-icon="anim" data-size="16"></i></span><b>Animation</b>- <select id="anim-select" class="an-select" aria-label="Choose animation"></select>- <button id="btn-anim-close" class="ibtn s" aria-label="Close animation" title="Close animation (the model returns to its assembled position)"><i data-icon="x" data-size="14" data-stroke="2"></i></button></div>- <div class="an-transport">- <button id="btn-anim-play" class="ibtn an-play" aria-label="Play" title="Play (Space)"><i data-icon="play" data-size="16" data-stroke="2"></i></button>- <input id="anim-range" type="range" min="0" max="1" step="0.01" value="0" aria-label="Time in the animation">- <span id="anim-time" class="an-time"></span>- </div>- <div class="an-opts">- <button id="btn-anim-follow" class="btn sm" aria-pressed="true" title="Follow the animation's camera. Off: rotate freely, the parts still move"><i data-icon="camera" data-size="14" data-stroke="1.9"></i>Camera</button>- <button id="btn-anim-loop" class="btn sm" aria-pressed="false" title="Start over at the end"><i data-icon="loop" data-size="14" data-stroke="1.9"></i>Loop</button>- <button id="btn-anim-texts" class="btn sm" aria-pressed="true" title="Show titles, subtitles and labels of the animation. Off: only the motion, the video still contains them"><i data-icon="text" data-size="14" data-stroke="1.9"></i>Texts</button>- <span class="grow"></span>- <select id="anim-speed" class="an-speed" aria-label="Speed" title="Speed"><option value="0.25">0.25×</option><option value="0.5">0.5×</option><option value="1" selected>1×</option><option value="2">2×</option></select>- </div>- <div id="anim-hint" class="mc-hint"></div>- <div class="sc-actions">- <button id="btn-anim-video" class="btn sm" title="Write a video (MP4) of this animation to renders/ and play it"><i data-icon="f-video" data-size="14" data-stroke="1.9"></i>Make video</button>- <button id="btn-anim-agent" class="btn sm acc" title="Add the animation's name and the time to the agent's input"><i data-icon="send" data-size="14" data-stroke="1.9"></i>Send to agent</button>- </div></div>- <!-- Analyse (E58, resulttool.ts): Ergebnisse von soma analyze farbig zeigen -->- <div id="result-card" class="float rscard" hidden>- <div class="mc-hd"><span class="mc-ico"><i data-icon="gauge" data-size="16"></i></span><b>Analysis</b>- <select id="result-select" class="an-select" aria-label="Choose result"></select>- <button id="btn-result-close" class="ibtn s" aria-label="Close analysis" title="Close analysis (shows the model again)"><i data-icon="x" data-size="14" data-stroke="2"></i></button></div>- <div id="result-legend" class="rs-legend"></div>- <!-- Farbskala: gezeigte Größe (nur FEM: Sicherheit oder Vergleichsspannung) und Spanne der Färbung -->- <div id="result-scale" class="an-opts rs-fem rs-opts">- <select id="result-field" class="an-speed" aria-label="Quantity" title="Quantity shown: safety factor or von Mises stress" hidden>- <option value="value">Safety factor</option><option value="stress">Stress</option></select>- <select id="result-range" class="an-speed" aria-label="Range of the color scale" title="Range of the coloring: as suggested by the analysis, from the smallest to the largest value, or custom">- <option value="auto">Auto scale</option><option value="minmax">Scale min to max</option><option value="custom">Custom scale</option></select>- <span id="result-custom" class="rs-custom" hidden>- <input id="result-lo" class="an-speed rs-num" type="number" step="any" aria-label="Scale from" title="Lower end of the color scale">- <span>to</span>- <input id="result-hi" class="an-speed rs-num" type="number" step="any" aria-label="Scale to" title="Upper end of the color scale"></span>- </div>- <!-- Nur bei FEM (E65): Verformung überhöht zeigen, Lastfall ein- und ausblenden -->- <div id="result-fem" class="an-opts rs-fem" hidden>- <select id="result-deform" class="an-speed" aria-label="Deformation" title="Deformation: undeformed, true scale or exaggerated so you can see it"></select>- <span class="grow"></span>- <button id="btn-result-bcs" class="btn sm" aria-pressed="true" title="Show the load case: fixed faces and loads in blue, forces as arrows"><i data-icon="arrow" data-size="14" data-stroke="1.9"></i>Load case</button>- </div>- <div id="result-summary" class="rs-summary"></div>- <div id="result-probe" class="rs-probe"></div>- <div id="result-hint" class="mc-hint"></div>- <div class="sc-actions">- <button id="btn-result-rerun" class="btn sm" title="Run the same analysis again on the current model"><i data-icon="refresh" data-size="14" data-stroke="1.9"></i>Recalculate</button>- <button id="btn-result-agent" class="btn sm acc" title="Add the result and the clicked spot to the agent's input"><i data-icon="send" data-size="14" data-stroke="1.9"></i>Send to agent</button>- </div>+ <!-- Analyse im Bild (E82, resulttool.ts): schmale Legende senkrecht am rechten Rand unter dem Würfel. Die Skala stellt das+ Menü hinter dem Knopf darunter ein (#menu-scale), dort stehen auch Größe und Erklärung ausgeschrieben -->+ <div id="result-legend" class="float lg" hidden>+ <div id="result-q" class="lg-hd"></div>+ <button id="btn-result-scale" class="lg-sub" aria-haspopup="menu" aria-expanded="false" title="Change the color scale: automatic, min to max, or your own range"><span id="result-scale-mode">Auto</span><i data-icon="down" data-size="11" data-stroke="2.2"></i></button>+ <div id="result-lg-body" class="lg-body"></div>+ </div>+ <!-- Darstellung unten im Bild: Größe und Verformung nur bei FEM (E65), × zurück zum Modell -->+ <div id="result-bar" class="float dbar" role="toolbar" aria-label="Analysis" hidden>+ <span id="result-name" class="dl strong"></span>+ <div id="result-field" class="seg" role="radiogroup" aria-label="Quantity shown"></div>+ <span class="vsep" data-fem></span><span id="result-deform-label" class="dl">Deformation</span>+ <div id="result-deform" class="seg" role="radiogroup" aria-label="Deformation"></div>+ <span class="vsep" data-fem></span>+ <button id="btn-result-bcs" class="tgl" aria-pressed="true" title="Show the load case: fixed faces and loads in blue, forces as arrows"><i data-icon="force" data-size="14" data-stroke="2"></i>Load case</button>+ <span class="vsep" data-fem></span>+ <button id="btn-result-close" class="ibtn s" aria-label="Close the analysis" title="Close the analysis and show the model"><i data-icon="x" data-size="15" data-stroke="2"></i></button></div>+ <!-- Animation im Bild (E82, animtool.ts): Abspielleiste unten, × zurück zum Modell -->+ <div id="anim-bar" class="float tbar" role="toolbar" aria-label="Animation" hidden>+ <button id="btn-anim-play" class="play" aria-label="Play" title="Play (Space)"><i data-icon="play" data-size="16" data-stroke="2.2"></i></button>+ <span id="anim-time" class="tm"></span>+ <div class="scrub"><input id="anim-range" type="range" min="0" max="1" step="0.01" value="0" aria-label="Time in the animation"><div id="anim-ticks" class="ticks"></div></div>+ <span id="anim-total" class="tm"></span><span class="vsep"></span>+ <select id="anim-speed" class="sel" aria-label="Speed" title="Speed"><option value="0.25">0.25×</option><option value="0.5">0.5×</option><option value="1" selected>1×</option><option value="2">2×</option></select>+ <button id="btn-anim-follow" class="tgl" aria-pressed="true" title="Follow the animation's camera. Off: rotate freely, the parts still move"><i data-icon="camera" data-size="14" data-stroke="1.9"></i>Camera</button>+ <button id="btn-anim-loop" class="tgl" aria-pressed="false" title="Start over at the end"><i data-icon="loop" data-size="14" data-stroke="1.9"></i>Loop</button>+ <button id="btn-anim-texts" class="tgl" aria-pressed="true" title="Show titles, subtitles and labels of the animation. Off: only the motion, the video still contains them"><i data-icon="text" data-size="14" data-stroke="1.9"></i>Texts</button>+ <span class="vsep"></span>+ <button id="btn-anim-close" class="ibtn s" aria-label="Close the animation" title="Close the animation and show the model (it returns to its assembled position)"><i data-icon="x" data-size="15" data-stroke="2"></i></button></div><div id="errcard" class="float errcard" hidden>@@ -392,7 +403,6 @@<button id="btn-build" class="mi" role="menuitem"><i data-icon="play" data-size="15"></i><span>Build now</span><span class="k">Ctrl B</span></button></div>- <div id="menu-view" class="menu wide" role="menu" aria-label="What the viewer shows" hidden></div><div id="menu-display" class="menu" role="menu" hidden><div class="mh">DISPLAY</div>@@ -440,6 +450,22 @@<div id="menu-ctx" class="menu" role="menu" hidden></div>+ <!-- Farbskala der Analyse (E82): Spanne wählen, eigene Grenzen, was die Farben heißen -->+ <div id="menu-scale" class="menu scalemenu" role="dialog" aria-label="Color scale" hidden>+ <div class="mh">COLOR SCALE</div>+ <div id="result-q-full" class="sm-q"></div>+ <div id="result-range" class="seg" role="radiogroup" aria-label="Range of the color scale">+ <button data-range="auto" role="radio" title="Range as suggested by the analysis">Auto</button>+ <button data-range="minmax" role="radio" title="From the smallest to the largest value in the model">Min to max</button>+ <button data-range="custom" role="radio" title="Your own range">Custom</button>+ </div>+ <span id="result-custom" class="rs-custom" hidden>+ <input id="result-lo" class="rs-num" type="number" step="any" aria-label="Scale from" title="Lower end of the color scale">+ <span>to</span>+ <input id="result-hi" class="rs-num" type="number" step="any" aria-label="Scale to" title="Upper end of the color scale"></span>+ <div id="result-lg-foot" class="mnote"></div>+ </div>+<div id="menu-mark-color" class="menu" role="menu" aria-label="Markup color" hidden><div class="mh">COLOR</div><div class="mk-palette">@@ -499,11 +525,13 @@<div class="st-body"><nav id="st-nav" class="st-nav" aria-label="Settings"><button data-sec="viewer" aria-current="page"><i data-icon="cube" data-size="16" data-stroke="1.8"></i><span>Viewer</span></button>+ <button data-sec="keys"><i data-icon="key" data-size="16" data-stroke="1.8"></i><span>Shortcuts</span></button><button data-sec="skills"><i data-icon="book" data-size="16" data-stroke="1.8"></i><span>Skills</span></button><button data-sec="storage"><i data-icon="disk" data-size="16" data-stroke="1.8"></i><span>Storage</span></button><button data-sec="about"><i data-icon="info" data-size="16" data-stroke="1.8"></i><span>About</span></button></nav><section id="st-viewer" class="st-sec st-page" aria-label="Viewer"></section>+ <section id="st-keys" class="st-sec st-page" aria-label="Shortcuts" hidden></section><section id="st-skills" class="st-sec" aria-label="Skills" hidden><div class="st-col"><div class="st-tools">diff --git a/app/src/renderer/main.ts b/app/src/renderer/main.tsindex 64599ea..246fb20 100644--- a/app/src/renderer/main.ts+++ b/app/src/renderer/main.ts@@ -1,6 +1,8 @@import { affectsBuild } from '../shared/editable';import { DEFAULT_SETTINGS, type SettingsPatch, type SettingsResult, type SettingsState } from '../shared/settings';import type { AgentInfo, AnimEntry, BuildStatus, ExportResult, FileNode, ModelMap, PartMap, PreviewResult, ProjectInfo, ProjectListEntry, ResultEntry, SaveState } from '../shared/types';+import { AnalysisPanel } from './analysispanel';+import { AnimPanel, animKey, videoKey } from './animpanel';import { SOMA_VERSION } from '../shared/version';import { CodePanel, codeRows, isDxf, isPdf, type Mark } from './code';import { AnimTool } from './animtool';@@ -13,10 +15,10 @@ import { MeasureTool } from './measuretool';import { SectionTool } from './sectiontool';import { ExplodeTool } from './explodetool';import { SettingsDialog } from './settings';-import { AboutPage, StoragePage, ViewerPage } from './settingspages';+import { AboutPage, ShortcutsPage, StoragePage, ViewerPage } from './settingspages';import { SkillsPanel } from './skills';import { ParamsPanel } from './params';-import { DRAG_PART, PartsCard } from './parts';+import { StructureTree } from './tree';import { ResultTool } from './resulttool';import { ResultLayer } from './resultview';import { TerminalTabs } from './terminals';@@ -40,6 +42,8 @@ let errorAt = 0;let map: ModelMap | null = null;let loadSeq = 0;let selection: { partId: string; pick: PickResult | null } | null = null;+/** Alle ausgewählten Bauteile (Strg/Shift-Klick, Rahmen, Baum). `selection` ist das zuletzt gewählte darunter. */+let picked: string[] = [];let agents: AgentInfo[] = [];const textCache = new Map<string, string>();@@ -62,13 +66,13 @@ const SURFACE: Record<string, string> = {const surfaceName = (s: string | null) => (s ? SURFACE[s] ?? s.toLowerCase() : 'face');const ERROR_KIND: Record<string, string> = { Timeout: 'Time limit exceeded', PythonStart: 'Python could not be started', NoResult: 'Build without result' };-// ---- Seitenleiste (Bauteile, Parameter, Dateien, Skills) und Code-Spalte (Entwurf 2) ------------------------------+// ---- Seitenleiste (Parameter, Dateien, Analyse, Animation, Skills, E82) und Code-Spalte (Entwurf 2) -------------------type PanelName = 'parts' | 'params' | 'files' | 'skills';-const PANELS: PanelName[] = ['parts', 'params', 'files', 'skills'];+type PanelName = 'params' | 'files' | 'analysis' | 'anim' | 'skills';+const PANELS: PanelName[] = ['params', 'files', 'analysis', 'anim', 'skills'];let panel: PanelName | null = null;/** Zuletzt gezeigte Ansicht der Seitenleiste: Der Schalter oben bringt sie wieder. */-let lastPanel: PanelName = 'parts';+let lastPanel: PanelName = 'files';let filesDirty = true;let codeOpen = false;/** Der Dateibaum entsteht nach dem Code-Panel, das ihm schon beim Aufbau die offene Datei meldet. */@@ -79,17 +83,24 @@ function showPanel(p: PanelName | null): void {if (p) lastPanel = p;$('side').hidden = !p;$('split-side').hidden = !p;- $('panel-parts').hidden = p !== 'parts';$('panel-params').hidden = p !== 'params';$('panel-files').hidden = p !== 'files';+ $('panel-analysis').hidden = p !== 'analysis';+ $('panel-anim').hidden = p !== 'anim';$('panel-skills').hidden = p !== 'skills';+ // Bericht und Ablauf brauchen mehr Breite als Listen (Entwurf: 352 px). Zieht der Nutzer breiter, gilt seine Breite+ $('side').classList.toggle('wide', p === 'analysis' || p === 'anim');document.querySelectorAll<HTMLButtonElement>('#rail [data-panel]').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.panel === p)));if (p === 'files' && filesDirty) void refreshFiles();if (p === 'params') void paramsPanel.refresh();if (p === 'skills') void skills.refresh();else skills.closeDetail();- store.set('soma.side', p ?? '');+ if (p === 'analysis') void openResults();+ if (p === 'anim') void openAnims();+ // Nur die Ansichten zum Arbeiten am Modell bleiben über einen Neustart: Ein Ergebnis zeigt sich erst auf Wunsch+ if (p !== 'analysis' && p !== 'anim') store.set('soma.side', p ?? '');renderLayout();+ renderResults();}/** Code als eigene Spalte neben der Seitenleiste, damit Dateien und Code gleichzeitig offen sein können. */@@ -200,6 +211,7 @@ async function changeSettings(patch: SettingsPatch): Promise<SettingsResult> {const viewerPage = new ViewerPage($('st-viewer'), { current: () => appSettings, set: (patch) => changeSettings(patch), toast });const storagePage = new StoragePage($('st-storage'), { api: api.storage, toast });+const shortcutsPage = new ShortcutsPage($('st-keys'), { current: () => appSettings });const aboutPage = new AboutPage($('st-about'), {api: api.about, toast,openUrl: (url) => void api.openUrl(url).then((r) => { if (!r.ok) toast(r.error ?? `${url} could not be opened.`, 'error'); }),@@ -222,7 +234,7 @@ const settings = new SettingsDialog({},changed: () => { if (project && skills.isLoaded) void skills.refresh(); },modelMode: async (id) => (project ? (await api.skills.list()).find((s) => s.id === id)?.mode ?? 'off' : null),- pages: { viewer: viewerPage, storage: storagePage, about: aboutPage },+ pages: { viewer: viewerPage, keys: shortcutsPage, storage: storagePage, about: aboutPage },});$('btn-settings').addEventListener('click', () => void settings.open());$('btn-start-settings').addEventListener('click', () => void settings.open());@@ -308,7 +320,7 @@ $('btn-folder-new').addEventListener('click', () => files.startCreate('', true))// Bauteile und Dateien aus der App lassen sich ins Terminal ziehen (ersetzt die Übergabeleiste, Entwurf 2).let dragDepth = 0;const hasFiles = (e: DragEvent) => !!e.dataTransfer && [...e.dataTransfer.types].includes('Files');-const isInternal = (e: DragEvent) => !!e.dataTransfer && [...e.dataTransfer.types].some((t) => t === DRAG_PART || t === DRAG_FILE);+const isInternal = (e: DragEvent) => !!e.dataTransfer && [...e.dataTransfer.types].some((t) => t === DRAG_FILE);const overTerminal = (e: DragEvent) => !!(e.target as HTMLElement | null)?.closest?.('#term-panes');document.addEventListener('dragenter', (e) => {if (!hasFiles(e)) return;@@ -329,8 +341,8 @@ document.addEventListener('drop', (e) => {$('term-panes').classList.remove('dropping');if (isInternal(e)) {if (!overTerminal(e)) return;- const partId = e.dataTransfer?.getData(DRAG_PART), rel = e.dataTransfer?.getData(DRAG_FILE);- if (partId) { selectPart(partId, null); insertToAgent(selectionText()); } else if (rel) insertToAgent(`[File: ${rel}] `);+ const rel = e.dataTransfer?.getData(DRAG_FILE);+ if (rel) insertToAgent(`[File: ${rel}] `);return;}const list = [...(e.dataTransfer?.files ?? [])];@@ -351,36 +363,90 @@ async function importFiles(list: File[]): Promise<void> {// ---- Bauteile und Auswahl ----------------------------------------------------------------------------------------const partsCard = new PartsCard({- list: $('tab-model'), count: $('parts-count'), search: $<HTMLButtonElement>('btn-parts-search'), filter: $<HTMLInputElement>('parts-filter'),-}, {- select: (id) => selectPart(id, null, true),+// Strukturbaum oben links im Viewer (E82). Ausblenden und Transparent liegen im Viewer und gelten für Modell, Analyse und Animation+const tree = new StructureTree($('tree'), {+ select: (s) => {+ if (s.how === 'replace') selectPart(s.id, null, true);+ else if (s.how === 'range') setPicked(s.ids, s.id);+ else setPicked(picked.includes(s.id) ? picked.filter((x) => x !== s.id) : [...picked, s.id], picked.includes(s.id) ? picked.filter((x) => x !== s.id).at(-1) ?? null : s.id);+ },setVisible: (ids, on) => { viewer.setVisible(ids, on); resultTool.forgetProbe(); },isVisible: (id) => viewer.isVisible(id),setGhost: (ids, on) => { viewer.setGhosted(ids, on); resultTool.forgetProbe(); },isGhost: (id) => viewer.isGhosted(id),+ showAll: () => { viewer.showAll(); resultTool.forgetProbe(); },context: (id, x, y) => openPartMenu(id, x, y),groupContext: (ids, name, x, y) => openGroupMenu(ids, name, x, y),+ resized: () => fitDock(),});-const refreshPartsCard = () => { partsCard.set(viewer.partList(), viewer.selection); renderViewSwitch(); };+const refreshTree = () => { tree.set(viewer.partList(), picked); resultTool.forgetProbe(); fitDock(); };++/**+ * Werkzeuge oben in der Mitte neben dem Baum: Der Platz links gehört dem Baum, wird es eng, zeigen sie nur Symbole (E82).+ * Gemessen statt per CSS, weil die Breite des Baums vom Namen des Modells und vom Aufklappen abhängt.+ */+function fitDock(): void {+ const dock = $('dock'), vtop = $('vtop');+ $('tree-space').style.width = `${$('tree').offsetWidth}px`;+ dock.classList.remove('compact');+ const room = vtop.clientWidth - $('tree-space').offsetWidth - $('vtop').querySelector<HTMLElement>('.cubespace')!.offsetWidth - 3 * 12;+ dock.classList.toggle('compact', dock.scrollWidth > room);+}+new ResizeObserver(() => fitDock()).observe($('viewer'));const partEntry = (id: string): PartMap | undefined => map?.parts.find((x) => x.id === id);const partInfo = (id: string) => viewer.partList().find((x) => x.id === id);const lineRange = (e: PartMap) => ({ from: e.line!, to: e.end_line && e.end_line >= e.line! ? e.end_line : e.line! });function selectPart(id: string | null, pick: PickResult | null, focus = false): void {selection = id ? { partId: id, pick } : null;+ picked = id ? [id] : [];if (!pick) viewer.select(id); // ein Klick im Viewer hat die Auswahl dort schon gesetztif (id && focus) viewer.focusPart(id);- partsCard.select(id);+ tree.select(picked);+ void renderSelection();+}++/** Mehrere Bauteile auswählen, `primary` zeigt die Auswahlkarte (bei mehreren eine Zusammenfassung). */+function setPicked(ids: string[], primary: string | null, pick: PickResult | null = null): void {+ picked = [...new Set(ids)];+ const main = primary && picked.includes(primary) ? primary : picked.at(-1) ?? null;+ selection = main ? { partId: main, pick: main === primary ? pick : null } : null;+ viewer.setSelection(picked, main);+ tree.select(picked);void renderSelection();}-viewer.onPick = (r) => selectPart(r?.partId ?? null, r);+// Klick ins Modell: allein auswählen, mit Shift dazu, mit Strg dazu oder heraus. Daneben geklickt mit Taste: Auswahl bleibt+viewer.onPick = (r, mods) => {+ const add = mods.shift || mods.ctrl;+ if (!add) { selectPart(r?.partId ?? null, r); return; }+ if (!r) { setPicked(picked, selection?.partId ?? null, selection?.pick ?? null); return; }+ if (mods.ctrl && picked.includes(r.partId)) { const rest = picked.filter((x) => x !== r.partId); setPicked(rest, rest.at(-1) ?? null); return; }+ setPicked([...picked, r.partId], r.partId, r);+};+// Alt + links ziehen: Rahmenauswahl, mit Shift oder Strg dazu+viewer.onBox = (ids, add) => setPicked(add ? [...picked, ...ids] : ids, ids.at(-1) ?? (add ? selection?.partId ?? null : null));+viewer.onContext = (id, x, y) => { if (id) openPartMenu(id, x, y); else openViewerMenu(x, y); };++const partName = (id: string) => partEntry(id)?.name ?? partInfo(id)?.name ?? id;async function renderSelection(): Promise<void> {const card = $('selcard');if (!selection) { card.hidden = true; return; }+ $<HTMLButtonElement>('btn-sel-export').disabled = picked.length > 1;+ if (picked.length > 1) {+ // Mehrere: Zahl und Namen, kein Code und kein Export eines einzelnen Teils+ $('sel-name').textContent = `${picked.length} parts selected`;+ $('sel-name').title = '';+ $('sel-swatch').style.background = 'var(--acc)';+ const names = picked.map(partName);+ $('info').textContent = names.slice(0, 6).join(', ') + (names.length > 6 ? ` and ${names.length - 6} more` : '');+ $('code').replaceChildren();+ $<HTMLButtonElement>('btn-sel-code').disabled = true;+ card.hidden = false;+ return;+ }const { partId, pick } = selection;const p = partInfo(partId);const e = partEntry(partId);@@ -413,6 +479,10 @@ async function renderSelection(): Promise<void> {/** Text für die Eingabe des Agenten. Zahlen mit Punkt, damit sie eindeutig bleiben. */function selectionText(): string | null {if (!selection) return null;+ if (picked.length > 1) {+ const names = picked.map((id) => `"${partName(id)}"`);+ return `[Selection: ${picked.length} parts: ${names.slice(0, 40).join(', ')}${names.length > 40 ? ` and ${names.length - 40} more` : ''}] `;+ }const e = partEntry(selection.partId);const group = partInfo(selection.partId)?.group;const bits = [`part "${e?.name ?? partInfo(selection.partId)?.name ?? selection.partId}"${group ? ` in group "${group}"` : ''}`];@@ -579,6 +649,7 @@ async function sendMarkup(): Promise<void> {// ---- Animation, Analyse und Video (E58) -----------------------------------------------------------------------------const resultLayer = new ResultLayer(viewer);+/** Zeigt der Viewer gerade eine Analyse oder Animation, sagen es Reiter, Baum und die Leiste unten im Bild (E82). *//** Messen, Explosion, Animation und Analyse schließen sich aus: Jedes braucht das Modell in seiner eigenen Lage. */const endOthers = (keep: 'measure' | 'explode' | 'anim' | 'result') => {if (keep !== 'measure' && measureTool.isActive) measureTool.setActive(false);@@ -587,26 +658,46 @@ const endOthers = (keep: 'measure' | 'explode' | 'anim' | 'result') => {if (keep !== 'result') resultTool.setActive(false);};const animTool = new AnimTool({- card: $('anim-card'), close: $<HTMLButtonElement>('btn-anim-close'),- select: $<HTMLSelectElement>('anim-select'), play: $<HTMLButtonElement>('btn-anim-play'), range: $<HTMLInputElement>('anim-range'), time: $('anim-time'),- loop: $<HTMLButtonElement>('btn-anim-loop'), follow: $<HTMLButtonElement>('btn-anim-follow'), speed: $<HTMLSelectElement>('anim-speed'), hint: $('anim-hint'),- video: $<HTMLButtonElement>('btn-anim-video'), agent: $<HTMLButtonElement>('btn-anim-agent'), viewerEl: $('viewer'),+ bar: $('anim-bar'), close: $<HTMLButtonElement>('btn-anim-close'),+ play: $<HTMLButtonElement>('btn-anim-play'), range: $<HTMLInputElement>('anim-range'), time: $('anim-time'), total: $('anim-total'), ticks: $('anim-ticks'),+ loop: $<HTMLButtonElement>('btn-anim-loop'), follow: $<HTMLButtonElement>('btn-anim-follow'), texts: $<HTMLButtonElement>('btn-anim-texts'),+ speed: $<HTMLSelectElement>('anim-speed'), viewerEl: $('viewer'),}, {viewer, list: () => api.anim.list(), build: (f) => api.anim.build(f), readBinary: (rel) => api.fs.readBinary(rel), renderVideo: (id) => api.render.video(id),- beforeOn: () => endOthers('anim'), insert: (t) => insertToAgent(t), toast, showVideo: (rel) => { void refreshFiles(); void videoView.open(rel); },- changed: () => renderViewSwitch(),+ beforeOn: () => endOthers('anim'), insert: (t) => insertToAgent(t), toast,+ showVideo: (rel) => { void refreshFiles(); seen.add(videoKey(rel)); scheduleViewLists(); void videoView.open(rel); },+ changed: () => renderResults(),+ tick: () => animPanel.tick(),});const resultTool = new ResultTool({- card: $('result-card'), close: $<HTMLButtonElement>('btn-result-close'), select: $<HTMLSelectElement>('result-select'),- legend: $('result-legend'), summary: $('result-summary'), probe: $('result-probe'), hint: $('result-hint'),- rerun: $<HTMLButtonElement>('btn-result-rerun'), agent: $<HTMLButtonElement>('btn-result-agent'), viewerEl: $('viewer'),- femRow: $('result-fem'), deform: $<HTMLSelectElement>('result-deform'), bcs: $<HTMLButtonElement>('btn-result-bcs'),- field: $<HTMLSelectElement>('result-field'), range: $<HTMLSelectElement>('result-range'), custom: $('result-custom'),- lo: $<HTMLInputElement>('result-lo'), hi: $<HTMLInputElement>('result-hi'),+ legend: $('result-legend'), legendTitle: $('result-q'), legendBody: $('result-lg-body'), scaleBtn: $<HTMLButtonElement>('btn-result-scale'), scaleMode: $('result-scale-mode'),+ scaleMenu: $('menu-scale'), legendFull: $('result-q-full'), legendFoot: $('result-lg-foot'),+ range: $('result-range'), custom: $('result-custom'), lo: $<HTMLInputElement>('result-lo'), hi: $<HTMLInputElement>('result-hi'),+ bar: $('result-bar'), field: $('result-field'), deform: $('result-deform'), deformLabel: $('result-deform-label'), bcs: $<HTMLButtonElement>('btn-result-bcs'),+ name: $('result-name'), close: $<HTMLButtonElement>('btn-result-close'), viewerEl: $('viewer'),}, {- layer: resultLayer, list: () => api.results.list(), rerun: (id) => api.results.rerun(id), readBinary: (rel) => api.fs.readBinary(rel),- beforeOn: () => endOthers('result'), insert: (t) => insertToAgent(t), toast,- changed: () => renderViewSwitch(),+ layer: resultLayer, viewer, list: () => api.results.list(), rerun: (id) => api.results.rerun(id), readBinary: (rel) => api.fs.readBinary(rel),+ beforeOn: () => endOthers('result'), toast,+ changed: () => renderResults(),+});+const analysisPanel = new AnalysisPanel({+ list: $('an-list'), listCount: $('an-count'), rows: $('an-rows'),+ report: $('an-report'), back: $<HTMLButtonElement>('btn-an-back'), backCount: $('an-back-count'), code: $<HTMLButtonElement>('btn-an-code'),+ more: $<HTMLButtonElement>('btn-an-more'), body: $('an-body'), pick: $('an-pick'), rerun: $<HTMLButtonElement>('btn-result-rerun'),+ agent: $<HTMLButtonElement>('btn-result-agent'), menu: $('menu-ctx'),+}, {+ tool: resultTool, insert: (t) => insertToAgent(t), openCode: (f) => void openCode(f),+ copy: (t) => void navigator.clipboard.writeText(t).then(() => toast(`Copied: ${t}`), (e) => toast(`Could not copy: ${e instanceof Error ? e.message : String(e)}`, 'error')),+ isNew: (r) => !seen.has(resultKey(r)), seen: (r) => { seen.add(resultKey(r)); },+});+const animPanel = new AnimPanel({+ list: $('am-list'), listCount: $('am-count'), rows: $('am-rows'),+ report: $('am-report'), back: $<HTMLButtonElement>('btn-am-back'), backCount: $('am-back-count'), code: $<HTMLButtonElement>('btn-am-code'),+ body: $('am-body'), video: $<HTMLButtonElement>('btn-anim-video'), agent: $<HTMLButtonElement>('btn-anim-agent'),+}, {+ tool: animTool, videos: () => viewLists.videos, openVideo: (rel) => void videoView.open(rel),+ openCode: (file, line) => void openCode(file, line ? { from: line, to: line, label: animTool.currentName ?? 'Animation' } : undefined),+ insert: (t) => insertToAgent(t), isNew: (k) => !seen.has(k), seen: (k) => { seen.add(k); },});// Messen und Explosion schalten die beiden aus, bevor sie selbst anfangen (Lauscher in der Erfassungsphase laufen vor denen// der Werkzeuge): Beide rechnen mit der Einbaulage@@ -626,17 +717,23 @@ $('btn-mark').addEventListener('click', startMarkup);$('btn-mark-cancel').addEventListener('click', () => markup.close());$('btn-mark-send').addEventListener('click', () => void sendMarkup());+/**+ * Rechtsklick auf ein Teil (Baum oder Bild). Ist es Teil einer Mehrfachauswahl, gilt das Menü für alle. Sonst wird es+ * ausgewählt, wie in CAD üblich. Die Tasten stehen daneben.+ */function openPartMenu(id: string, x: number, y: number): void {+ if (picked.length > 1 && picked.includes(id)) { openSelectionMenu(x, y); return; }+ if (selection?.partId !== id) selectPart(id, null);const e = partEntry(id);const visible = viewer.isVisible(id);const ghost = viewer.isGhosted(id);const m = $('menu-ctx');const items: (HTMLElement | null)[] = [el('div', { className: 'mh', textContent: e?.name ?? partInfo(id)?.name ?? id }),- menuItem('Isolate', { icon: 'target', onClick: () => { viewer.isolate(id); refreshPartsCard(); } }),- viewer.hiddenCount ? menuItem('Show all', { icon: 'eye', onClick: () => { viewer.showAll(); refreshPartsCard(); } }) : null,- menuItem(visible ? 'Hide' : 'Show', { icon: visible ? 'eyeoff' : 'eye', onClick: () => { viewer.setVisible(id, !visible); refreshPartsCard(); } }),- menuItem(ghost ? 'Not transparent' : 'Transparent', { icon: 'ghost', onClick: () => { viewer.setGhosted(id, !ghost); refreshPartsCard(); } }),+ menuItem('Isolate', { icon: 'target', kbd: 'I', onClick: () => { viewer.isolate(id); refreshTree(); } }),+ viewer.hiddenCount ? menuItem('Show all', { icon: 'eye', kbd: 'Shift H', onClick: () => { viewer.showAll(); refreshTree(); } }) : null,+ menuItem(visible ? 'Hide' : 'Show', { icon: visible ? 'eyeoff' : 'eye', kbd: visible ? 'H' : '', onClick: () => { viewer.setVisible(id, !visible); refreshTree(); } }),+ menuItem(ghost ? 'Not transparent' : 'Transparent', { icon: 'ghost', kbd: 'T', onClick: () => { viewer.setGhosted(id, !ghost); refreshTree(); } }),menuItem('Zoom to part', { icon: 'fit', onClick: () => viewer.focusPart(id) }),el('div', { className: 'msep' }),menuItem('Show code', { icon: 'code', disabled: !e?.file, onClick: () => { selectPart(id, null); if (e?.file && e.line) void openCode(e.file, { ...lineRange(e), label: e.name, color: partInfo(id)?.color }); } }),@@ -654,16 +751,78 @@ function openGroupMenu(ids: string[], name: string, x: number, y: number): voidconst m = $('menu-ctx');const items: (HTMLElement | null)[] = [el('div', { className: 'mh', textContent: `${name} · ${ids.length} part${ids.length === 1 ? '' : 's'}` }),- menuItem('Isolate', { icon: 'target', onClick: () => { viewer.isolate(ids); refreshPartsCard(); } }),- viewer.hiddenCount ? menuItem('Show all', { icon: 'eye', onClick: () => { viewer.showAll(); refreshPartsCard(); } }) : null,- menuItem(anyVisible ? 'Hide' : 'Show', { icon: anyVisible ? 'eyeoff' : 'eye', onClick: () => { viewer.setVisible(ids, !anyVisible); refreshPartsCard(); } }),- menuItem(allGhost ? 'Not transparent' : 'Transparent', { icon: 'ghost', onClick: () => { viewer.setGhosted(ids, !allGhost); refreshPartsCard(); } }),+ menuItem('Isolate', { icon: 'target', onClick: () => { viewer.isolate(ids); refreshTree(); } }),+ viewer.hiddenCount ? menuItem('Show all', { icon: 'eye', kbd: 'Shift H', onClick: () => { viewer.showAll(); refreshTree(); } }) : null,+ menuItem(anyVisible ? 'Hide' : 'Show', { icon: anyVisible ? 'eyeoff' : 'eye', onClick: () => { viewer.setVisible(ids, !anyVisible); refreshTree(); } }),+ menuItem(allGhost ? 'Not transparent' : 'Transparent', { icon: 'ghost', onClick: () => { viewer.setGhosted(ids, !allGhost); refreshTree(); } }),menuItem('Zoom to group', { icon: 'fit', onClick: () => viewer.setView('fit', ids) }),];m.replaceChildren(...items.filter((x): x is HTMLElement => !!x));menus.at(m, x, y);}+/** Rechtsklick auf mehrere ausgewählte Teile: Isolieren, Ausblenden, Transparent für alle. */+function openSelectionMenu(x: number, y: number): void {+ const ids = [...picked];+ const allGhost = ids.every((id) => viewer.isGhosted(id));+ const m = $('menu-ctx');+ const items: (HTMLElement | null)[] = [+ el('div', { className: 'mh', textContent: `${ids.length} parts selected` }),+ menuItem(`Isolate ${ids.length} parts`, { icon: 'target', kbd: 'I', onClick: () => selectionAction('isolate') }),+ menuItem(`Hide ${ids.length} parts`, { icon: 'eyeoff', kbd: 'H', onClick: () => selectionAction('hide') }),+ viewer.hiddenCount ? menuItem('Show all', { icon: 'eye', kbd: 'Shift H', onClick: () => selectionAction('showAll') }) : null,+ menuItem(allGhost ? 'Not transparent' : 'Transparent', { icon: 'ghost', kbd: 'T', onClick: () => selectionAction('ghost') }),+ menuItem('Zoom to selection', { icon: 'fit', onClick: () => viewer.setView('fit', ids) }),+ el('div', { className: 'msep' }),+ menuItem('Send to agent', { icon: 'send', onClick: () => insertToAgent(selectionText()) }),+ menuItem('Clear selection', { icon: 'x', kbd: 'Esc', onClick: () => selectPart(null, null) }),+ ];+ m.replaceChildren(...items.filter((x): x is HTMLElement => !!x));+ menus.at(m, x, y);+}++/** Rechtsklick ins Bild neben das Modell: alles einblenden, Auswahl aufheben. Ohne beides kein Menü. */+function openViewerMenu(x: number, y: number): void {+ const items: HTMLElement[] = [];+ if (viewer.hiddenCount) items.push(menuItem('Show all', { icon: 'eye', kbd: 'Shift H', onClick: () => selectionAction('showAll') }));+ if (picked.length) items.push(menuItem('Clear selection', { icon: 'x', kbd: 'Esc', onClick: () => selectPart(null, null) }));+ if (!items.length) return;+ $('menu-ctx').replaceChildren(...items);+ menus.at($('menu-ctx'), x, y);+}++/**+ * Was die Tasten H, Shift H, I und T tun (auch aus den Menüs). Ausgeblendete Teile verlassen die Auswahl, sonst wirkte die+ * nächste Taste auf Unsichtbares.+ */+function selectionAction(a: 'hide' | 'showAll' | 'isolate' | 'ghost'): void {+ const ids = [...picked];+ if (a === 'showAll') viewer.showAll();+ else if (!ids.length) { toast('Select parts first: click in the model or the tree, Ctrl or Shift for more, Alt + drag for a box.', 'info'); return; }+ else if (a === 'hide') { viewer.setVisible(ids, false); selectPart(null, null); }+ else if (a === 'isolate') viewer.isolate(ids);+ else viewer.setGhosted(ids, !ids.every((id) => viewer.isGhosted(id)));+ refreshTree();+}++// Tasten für die Auswahl (wie in CAD): H ausblenden, Shift H alles einblenden, I isolieren, T transparent, Esc Auswahl aufheben.+// Nicht beim Schreiben (Code, Terminal, Felder) und nicht, solange Markierung, Video, Einstellungen oder die Startseite offen sind+window.addEventListener('keydown', (e) => {+ if (!project || e.ctrlKey || e.altKey || e.metaKey || e.repeat || settings.isOpen || !$('start').hidden) return;+ if ((e.target as HTMLElement | null)?.closest?.('#terminals, #code-view, input, textarea, select, [contenteditable=true]')) return;+ if (markup.active || !$('videoview').hidden) return;+ const k = e.key.toLowerCase();+ if (k === 'h' && e.shiftKey) selectionAction('showAll');+ else if (e.shiftKey) return;+ else if (k === 'h') selectionAction('hide');+ else if (k === 'i') selectionAction('isolate');+ else if (k === 't') selectionAction('ghost');+ // Escape gehört zuerst Menüs und Werkzeugen (Messen, Schnitt mit Flächenwahl, Ladeanzeige): nur ohne sie die Auswahl aufheben+ else if (e.key === 'Escape' && picked.length && !e.defaultPrevented && !measureTool.isActive && $('viewer-busy').hidden) selectPart(null, null);+ else return;+ e.preventDefault();+});+// ---- Build und Modell -------------------------------------------------------------------------------------------/** Zuletzt gezeigter Fehler der Projektumgebung (E67): als Hinweis nur einmal. */@@ -756,10 +915,12 @@ async function loadModel(): Promise<void> {if (resultTool.isActive) void resultTool.refresh();sectionTool.refresh();msg.className = ''; msg.textContent = '';- refreshPartsCard();+ refreshTree();// Flächen-IDs gelten nur für einen Build: nach dem Neuladen bleibt das Bauteil gewählt, die Fläche nicht- if (selection && !partInfo(selection.partId)) selectPart(null, null);- else if (selection) { selection.pick = null; viewer.select(selection.partId); void renderSelection(); }+ // Mehrfachauswahl: was es nach dem Build noch gibt+ const still = picked.filter((id) => partInfo(id));+ if (selection && !partInfo(selection.partId)) setPicked(still, still.at(-1) ?? null);+ else if (selection) { selection.pick = null; setPicked(still, selection.partId); }void renderErrorCard();scheduleThumb();} catch (e) {@@ -797,11 +958,11 @@ const versions = new VersionsBar({measureTool.reset();explodeTool.refresh();sectionTool.refresh();- refreshPartsCard();+ refreshTree();selectPart(null, null);void renderErrorCard();} catch (e) { toast(`The preview cannot be shown: ${e instanceof Error ? e.message : String(e)}`, 'error'); }- renderViewSwitch();+ renderResults();},toast,beforeRestore: () => leaveEditor('Restore version'), // Wiederherstellen ersetzt Dateien@@ -824,6 +985,7 @@ async function onProject(p: ProjectInfo): Promise<void> {videoView.close();viewer.clear();versions.reset();+ tree.setTitle(p.name);terminals.closeAll();code.reset();skills.reset();@@ -834,8 +996,9 @@ async function onProject(p: ProjectInfo): Promise<void> {resetViewLists();applyDisplayDefaults();selection = null;+ picked = [];void renderSelection();- partsCard.message('Building the model …');+ tree.message('Building the model …');$('doc-name').textContent = p.name;document.title = `SOMA – ${p.name}`;$<HTMLInputElement>('chk-auto').checked = p.autoBuild;@@ -938,6 +1101,7 @@ async function doSave(saveAs = false): Promise<void> {toast(lines.join('\n'), r.warnings?.length ? 'error' : 'ok');project = await api.project.current(); // der Modellname folgt dem Dateinamen$('doc-name').textContent = project.name;+ tree.setTitle(project.name);void refreshSaveState();} finally {saving = false;@@ -963,6 +1127,14 @@ async function doBuild(): Promise<void> {}const openProject = async (id: string) => { if (await leaveEditor('Open model')) await api.project.open(id); };+// F3 klappt den Strukturbaum auf und zu wie in CATIA (E82, Vorschlag aus dem Entwurf). Nicht beim Schreiben in Code, Terminal oder Feldern+window.addEventListener('keydown', (e) => {+ if (e.key !== 'F3' || e.ctrlKey || e.altKey || e.shiftKey || !project || settings.isOpen || !$('start').hidden) return;+ if ((e.target as HTMLElement | null)?.closest?.('#terminals, #code-view, input, textarea, select, [contenteditable=true]')) return;+ e.preventDefault();+ tree.setOpen(!tree.isOpen);+});+// Kurzbefehle gelten nicht im Terminal: dort gehören Strg+S/Strg+O den Programmen (Claude Code nutzt Strg+O selbst)window.addEventListener('keydown', (e) => {// Die Einstellungen liegen über allem und haben eigene Kurzbefehle (Strg+S speichert den Skill)@@ -1102,19 +1274,22 @@ async function doExport(fmt: string, label: string): Promise<ExportResult> {return r;}-// ---- Umschalter oben links: was der Viewer zeigt (Entwurf 2) ------------------------------------------------------// Analysen, Animationen und Videos sind Ergebnisse des Agenten, keine Werkzeuge. Hier wählt man, was der Viewer zeigt.+// ---- Ergebnisse des Agenten in den Reitern Analysis und Animation (E82) ----------------------------------------------+// Analysen, Animationen und Videos sind Ergebnisse des Agenten, keine Werkzeuge. Ein Klick auf den Reiter zeigt das zuletzt+// gezeigte Ergebnis im Viewer (beim ersten Mal das neueste), das × in der Leiste unten im Bild führt zurück zum Modell.let viewLists: { results: ResultEntry[]; anims: AnimEntry[]; videos: string[] } = { results: [], anims: [], videos: [] };-/** Schon gesehene Ergebnisse. Was danach dazukommt, bekommt einen Punkt am Umschalter. */+/** Angesehene Ergebnisse (Schlüssel). Was danach dazukommt, steht in der Liste als „new“, bis man es öffnet. */const seen = new Set<string>();+/** Ergebnisse, die schon in einem geöffneten Reiter standen. Was nicht darin ist, gibt dem Reiter einen Punkt. */+const tabSeen = new Set<string>();let seenReady = false;let viewSeq = 0;let viewTimer: ReturnType<typeof setTimeout> | undefined;-const resultKey = (r: ResultEntry) => `r:${r.id}:${String((r as { created?: unknown }).created ?? '')}`;-const animKey = (a: AnimEntry) => `a:${a.id}`;-const viewKeys = () => [...viewLists.results.map(resultKey), ...viewLists.anims.map(animKey), ...viewLists.videos.map((v) => `v:${v}`)];+const resultKey = (r: ResultEntry) => `r:${r.id}:${String(r.created ?? '')}`;+const analysisKeys = () => viewLists.results.map(resultKey);+const animKeys = () => [...viewLists.anims.map(animKey), ...viewLists.videos.map(videoKey)];function videosIn(nodes: FileNode[], out: string[] = []): string[] {for (const n of nodes) {@@ -1128,8 +1303,9 @@ function resetViewLists(): void {viewSeq++;viewLists = { results: [], anims: [], videos: [] };seen.clear();+ tabSeen.clear();seenReady = false;- renderViewSwitch();+ renderResults();void refreshViewLists();}@@ -1137,101 +1313,47 @@ async function refreshViewLists(): Promise<void> {if (!project) return;const seq = ++viewSeq;const [results, anims, nodes] = await Promise.all([- api.results.list().catch(() => [] as ResultEntry[]), api.anim.list().then((l) => l.animations).catch(() => [] as AnimEntry[]), api.fs.list().catch(() => [] as FileNode[]),+ api.results.list().catch(() => null), api.anim.list().catch(() => null), api.fs.list().catch(() => [] as FileNode[]),]);if (seq !== viewSeq) return;- viewLists = { results, anims, videos: videosIn(nodes) };+ viewLists = { results: results ?? viewLists.results, anims: anims?.animations ?? viewLists.anims, videos: videosIn(nodes) };+ if (results) resultTool.setList(results);+ if (anims) animTool.setList(anims);// Was beim Öffnen des Modells schon da ist, gilt als gesehen- if (!seenReady) { for (const k of viewKeys()) seen.add(k); seenReady = true; }- renderViewSwitch();+ if (!seenReady) { for (const k of [...analysisKeys(), ...animKeys()]) { seen.add(k); tabSeen.add(k); } seenReady = true; }+ renderResults();}const scheduleViewLists = () => { clearTimeout(viewTimer); viewTimer = setTimeout(() => void refreshViewLists(), 400); };-function renderViewSwitch(): void {- const prev = versions.previewed;- let ico = 'cube', name = 'Model', sub = '', closable = false;- const n = viewer.partList().length;- if (prev) { ico = 'history'; name = `Version ${prev.short}`; sub = 'view only'; closable = true; }- // Bei Analyse und Animation sagt das Symbol, was es ist: Der Platz gehört dem Namen- else if (resultTool.isActive) { ico = 'gauge'; name = resultTool.currentTitle ?? 'Analysis'; closable = true; }- else if (animTool.isActive) { ico = 'anim'; name = animTool.currentName ?? 'Animation'; closable = true; }- else sub = n ? `${n} part${n === 1 ? '' : 's'}` : '';- $('view-ico').replaceChildren(icon(ico, 16));- $('view-name').textContent = name;- $('view-sub').textContent = sub;- $('btn-view').title = resultTool.isActive && !prev ? `Analysis: ${name}` : animTool.isActive && !prev ? `Animation: ${name}` : 'What the viewer shows: the model, an analysis, an animation or a video';- $('view-switch').classList.toggle('vio', !!prev);- $('view-switch').classList.toggle('result', !prev && (resultTool.isActive || animTool.isActive));- $('btn-view-close').hidden = !closable;- $('view-sep').hidden = !closable;- const unseen = viewKeys().filter((k) => !seen.has(k)).length;- const badge = $('view-new');- badge.hidden = !unseen;- badge.dataset.n = String(unseen);- badge.textContent = `${unseen} new`;- badge.title = 'New results from the agent. Click to show the list.';-}--/** Eintrag im Menü des Umschalters. `dot`: Statusfarbe (Fundstellen), `isNew`: noch nicht gesehen. */-function viewItem(ico: string, label: string, opts: { sub?: string; on?: boolean; dot?: string; isNew?: boolean; title?: string; onClick: () => void }): HTMLButtonElement {- const d = opts.dot ? el('span', { className: 'dot' }) : null;- if (d) d.style.background = opts.dot!;- const b = el('button', { className: 'mi' + (opts.on ? ' cur' : ''), title: opts.title ?? '' },- icon(ico, 15), el('span', { className: 'vl', textContent: label }), opts.isNew ? el('span', { className: 'tag acc', textContent: 'new' }) : null,- el('span', { className: 'k' }, d, opts.sub ?? '', el('span', { className: 'chk' }, icon('check', 14, 2.2))));- b.setAttribute('role', 'menuitemradio');- b.setAttribute('aria-checked', String(!!opts.on));- b.addEventListener('click', opts.onClick);- return b;-}--async function openViewMenu(): Promise<void> {- const m = $('menu-view');- if (menus.isOpen(m)) { menus.close(); return; }+/** Reiter, Punkte an der Leiste und Baum nachziehen: Was zeigt der Viewer, was ist neu? */+function renderResults(): void {+ // Ein offener Reiter zeigt das Neue selbst (in der Liste), dort braucht es keinen Punkt+ if (panel === 'analysis') for (const k of analysisKeys()) tabSeen.add(k);+ if (panel === 'anim') for (const k of animKeys()) tabSeen.add(k);+ $('nd-analysis').hidden = !analysisKeys().some((k) => !tabSeen.has(k));+ $('nd-anim').hidden = !animKeys().some((k) => !tabSeen.has(k));+ if (panel === 'analysis') analysisPanel.render();+ if (panel === 'anim') animPanel.render();+ // In der Analyse stehen im Baum nur die gerechneten Körper, gegliedert wie im Modell+ const r = resultTool.shown;+ tree.limit(r ? r.parts.map((x) => x.name) : null);+ fitDock();+}++/** Reiter Analysis geöffnet: das zuletzt gezeigte Ergebnis ins Bild, beim ersten Mal das neueste. Ohne Ergebnisse die Liste. */+async function openResults(): Promise<void> {+ analysisPanel.opened();+ if (resultTool.isActive || versions.previewing) return;await refreshViewLists();- const n = viewer.partList().length;- const items: HTMLElement[] = [viewItem('cube', 'Model', { sub: `${n} part${n === 1 ? '' : 's'}`, on: !resultTool.isActive && !animTool.isActive, onClick: () => showModelView() })];- const { results, anims, videos } = viewLists;- const head = (t: string, src: string) => el('div', { className: 'mh' }, t, el('span', { className: 'src', textContent: src }));- if (results.length) {- items.push(el('div', { className: 'msep' }), head('ANALYSES', '.soma/results/'));- for (const r of results) {- const bad = r.parts.filter((x) => x.critical > 0).length;- items.push(viewItem('gauge', r.id === r.kind ? r.title : `${r.title} (${r.id})`, {- sub: r.stale ? 'outdated' : bad ? `${bad} part${bad === 1 ? '' : 's'} critical` : 'OK', dot: r.stale ? 'var(--tx3)' : bad ? 'var(--err)' : 'var(--ok)',- on: resultTool.isActive && resultTool.currentId === r.id, isNew: !seen.has(resultKey(r)), onClick: () => resultTool.show(r.id),- }));- }- }- if (anims.length) {- items.push(el('div', { className: 'msep' }), head('ANIMATIONS', 'animations/'));- for (const a of anims) {- items.push(viewItem('anim', a.name, { sub: `${a.duration.toFixed(1)} s`, on: animTool.isActive && animTool.currentId === a.id, isNew: !seen.has(animKey(a)), title: a.file, onClick: () => animTool.show(a.id) }));- }- }- if (videos.length) {- items.push(el('div', { className: 'msep' }), head('VIDEOS', 'renders/'));- for (const v of videos) items.push(viewItem('f-video', v.split('/').pop() ?? v, { isNew: !seen.has(`v:${v}`), title: v, onClick: () => void videoView.open(v) }));- }- if (!results.length && !anims.length && !videos.length) {- items.push(el('div', { className: 'msep' }), el('div', {- className: 'mnote', textContent: 'No results yet. The agent creates them: analyses with soma analyze, animations in animations/, videos with soma render (skills “Analysis” and “Animation and video”).',- }));- }- m.replaceChildren(...items);- for (const k of viewKeys()) seen.add(k);- renderViewSwitch();- menus.toggle(m, $('btn-view'));+ if (panel === 'analysis' && !resultTool.isActive && viewLists.results.length) resultTool.show(null);}-/** Zurück zum Modell: Analyse und Animation beenden, eine Vorschau verlassen. */-function showModelView(): void {- if (versions.previewing) { $('btn-live').click(); return; }- animTool.setActive(false);- resultTool.setActive(false);+async function openAnims(): Promise<void> {+ animPanel.opened();+ if (animTool.isActive || versions.previewing) return;+ await refreshViewLists();+ if (panel === 'anim' && !animTool.isActive && viewLists.anims.length) animTool.show(null);}-$('btn-view').addEventListener('click', () => void openViewMenu());-$('btn-view-close').addEventListener('click', () => showModelView());// ---- Viewer-Bedienung -------------------------------------------------------------------------------------------@@ -1401,10 +1523,10 @@ api.project.onSaveState((st) => renderSaveState(st));void api.settings.get().then((st) => { appSettings = st; applySettings(); applyDisplayDefaults(); }).catch(() => { /* es gelten die Vorgaben */ });if (store.get('soma.agentCollapsed') === '1') setAgentCollapsed(true);-// Seitenleiste wie beim letzten Mal, beim ersten Start mit den Bauteilen+// Seitenleiste wie beim letzten Mal, beim ersten Start zu: Die Bauteile stehen im Baum im Viewer (E82){const side = store.get('soma.side');- showPanel(side === null ? 'parts' : PANELS.includes(side as PanelName) ? side as PanelName : null);+ showPanel(side && PANELS.includes(side as PanelName) ? side as PanelName : null);}// Die App beginnt auf der Startseite (E69), der Hauptprozess öffnet kein Modell. Nur im Testmodus öffnet er gleich eins.if (api.startsHome) void showStart(true);@@ -1419,7 +1541,11 @@ if (api.testMode) {status: () => ({ state: buildStatus.state, text: $('status').textContent, detail: $('status-detail').textContent, viewerMsg: $('errcard').hidden ? $('viewer-msg').textContent : $('errcard').textContent }),info: () => ($('selcard').hidden ? '' : `${$('sel-name').textContent} · ${$('info').textContent} · ${$('code').querySelector('.ph')?.textContent ?? ''}`),codeHighlight: () => [...document.querySelectorAll('#code .cl.hl')].map((x) => x.textContent),- treeNames: () => [...document.querySelectorAll('#tab-model .pname')].map((x) => x.textContent),+ treeNames: () => tree.names(),+ tree: () => tree.state(),+ treeOpen: (on: boolean) => tree.setOpen(on),+ picked: () => picked.map(partName),+ treeExpandAll: () => tree.expandAll(),termText: (id: number) => terminals.text(id),versions: () => versions.state(),saveState: () => saveState,@@ -1439,6 +1565,15 @@ if (api.testMode) {result: () => resultTool.state(),resultRefresh: () => resultTool.refresh(),resultPin: (x: number, y: number) => resultTool.testPin(x, y),+ resultShow: (id: string) => resultTool.show(id),+ resultField: (f: 'value' | 'stress' | 'disp') => resultTool.testField(f),+ resultDeform: (sc: number) => resultTool.testDeform(sc),+ analysis: () => analysisPanel.state(),+ analysisToggle: (key: string) => analysisPanel.testToggle(key),+ animShow: (id: string) => animTool.show(id),+ animPanel: () => animPanel.state(),+ rail: () => ({ analysis: !$('nd-analysis').hidden, anim: !$('nd-anim').hidden, pressed: [...document.querySelectorAll<HTMLElement>('#rail [aria-pressed=true]')].map((b) => b.dataset.panel) }),+ dockCompact: () => $('dock').classList.contains('compact'),video: () => videoView.state(),videoOpen: (rel: string) => videoView.open(rel),videoSeek: (t: number) => videoView.testSeek(t),@@ -1453,9 +1588,6 @@ if (api.testMode) {showPanel: (p: PanelName | 'code' | null) => (p === 'code' ? showCode(true) : showPanel(p)),showCode,layout: () => ({ side: panel, code: codeOpen, agent: !$('terminals').classList.contains('collapsed') }),- viewSwitch: () => ({ name: $('view-name').textContent, sub: $('view-sub').textContent, unseen: $('view-new').hidden ? 0 : Number($('view-new').dataset.n ?? 0), closable: !$('btn-view-close').hidden }),- openViewMenu: () => openViewMenu(),- viewMenu: () => [...$('menu-view').querySelectorAll('.mi')].map((x) => x.textContent),refreshViewLists: () => refreshViewLists(),openSkill: (id: string | null) => skills.openDetail(id),settings: () => settings.state(),@@ -1464,7 +1596,7 @@ if (api.testMode) {settingsSelect: (id: string | null) => settings.select(id),settingsType: (text: string) => settings.type(text),settingsSave: () => settings.save(),- settingsShow: (sec: 'viewer' | 'skills' | 'storage' | 'about') => settings.open(undefined, sec),+ settingsShow: (sec: 'viewer' | 'keys' | 'skills' | 'storage' | 'about') => settings.open(undefined, sec),settingsPages: () => ({ viewer: viewerPage.state(), storage: storagePage.state(), about: aboutPage.state() }),appSettings: () => appSettings,storageRefresh: () => storagePage.refresh(),diff --git a/app/src/renderer/parts.ts b/app/src/renderer/parts.tsdeleted file mode 100644index 8d83577..0000000--- a/app/src/renderer/parts.ts+++ /dev/null@@ -1,144 +0,0 @@-import { icon } from './icons';-import { el } from './ui';--/** `group`: Pfad der Gruppe mit „/“, z. B. „Gehäuse/Schrauben“, oder null. */-export interface PartRow { id: string; name: string; role: string; color: string; group: string | null }--interface Hooks {- select(id: string): void;- setVisible(ids: string[], on: boolean): void;- isVisible(id: string): boolean;- setGhost(ids: string[], on: boolean): void;- isGhost(id: string): boolean;- context(id: string, x: number, y: number): void;- groupContext(ids: string[], name: string, x: number, y: number): void;-}--/** Gruppe im Baum. `items` in der Reihenfolge, in der sie im Modell zuerst vorkommen (Gruppen und Teile gemischt). */-interface GroupNode { key: string; name: string; items: ({ group: GroupNode } | { part: PartRow })[] }--/** Datentyp beim Ziehen eines Bauteils ins Terminal (Wert: die ID). */-export const DRAG_PART = 'application/x-soma-part';--/**- * Bauteilbaum in der Seitenleiste (Entwurf 2, vorher eine Karte im Viewer). Mit Suche, Zeilen lassen sich ins Terminal ziehen.- * Gruppen (aus add_part(group=…) oder aus der Struktur importierter STEP-Dateien) stehen als aufklappbarer Baum.- * Jedes Teil und jede Gruppe lässt sich aus- und einblenden sowie transparent schalten. Referenzen stehen für sich (E34).- */-export class PartsCard {- private parts: PartRow[] = [];- private selected: string | null = null;- private filter = '';- private placeholder = '';- private collapsed = new Set<string>();-- constructor(private ui: { list: HTMLElement; count: HTMLElement; search: HTMLButtonElement; filter: HTMLInputElement }, private hooks: Hooks) {- ui.search.addEventListener('click', () => {- ui.filter.hidden = !ui.filter.hidden;- if (ui.filter.hidden) { ui.filter.value = ''; this.filter = ''; this.render(); } else ui.filter.focus();- });- ui.filter.addEventListener('input', () => { this.filter = ui.filter.value.trim().toLowerCase(); this.render(); });- }-- /** Hinweis statt Liste, z. B. während des ersten Builds. */- message(text: string): void { this.placeholder = text; this.parts = []; this.render(); }-- set(parts: PartRow[], selected: string | null): void { this.parts = parts; this.selected = selected; this.placeholder = ''; this.render(); }-- select(id: string | null): void { this.selected = id; this.render(); }-- render(): void {- const { list, count } = this.ui;- count.textContent = this.parts.length ? String(this.parts.length) : '';- if (!this.parts.length) { list.replaceChildren(el('div', { className: 'hint', textContent: this.placeholder || 'No parts yet.' })); return; }- const match = (p: PartRow) => !this.filter || p.name.toLowerCase().includes(this.filter) || (p.group ?? '').toLowerCase().includes(this.filter);- const own = this.tree('own', this.parts.filter((p) => p.role !== 'reference' && match(p)));- const refs = this.tree('ref', this.parts.filter((p) => p.role === 'reference' && match(p)));- const rows: HTMLElement[] = this.rows(own, 0);- if (refs.items.length) rows.push(el('div', { className: 'grp', textContent: 'REFERENCES' }), ...this.rows(refs, 0));- if (!rows.length) rows.push(el('div', { className: 'hint', textContent: 'No part matches the search.' }));- list.replaceChildren(...rows);- }-- private tree(section: string, parts: PartRow[]): GroupNode {- const root: GroupNode = { key: section, name: '', items: [] };- for (const p of parts) {- let node = root;- for (const seg of (p.group ?? '').split('/').filter(Boolean)) {- let next = node.items.find((x): x is { group: GroupNode } => 'group' in x && x.group.name === seg)?.group;- if (!next) { next = { key: `${node.key}/${seg}`, name: seg, items: [] }; node.items.push({ group: next }); }- node = next;- }- node.items.push({ part: p });- }- return root;- }-- private static ids(node: GroupNode): string[] {- return node.items.flatMap((x) => ('part' in x ? [x.part.id] : PartsCard.ids(x.group)));- }-- private rows(node: GroupNode, depth: number): HTMLElement[] {- const out: HTMLElement[] = [];- for (const it of node.items) {- if ('part' in it) { out.push(this.row(it.part, depth)); continue; }- const g = it.group;- // Beim Suchen immer aufgeklappt, sonst sähe man die Treffer nicht- const open = !!this.filter || !this.collapsed.has(g.key);- out.push(this.groupRow(g, depth, open));- if (open) out.push(...this.rows(g, depth + 1));- }- return out;- }-- private groupRow(g: GroupNode, depth: number, open: boolean): HTMLElement {- const ids = PartsCard.ids(g);- const anyVisible = ids.some((id) => this.hooks.isVisible(id));- const ghosts = ids.filter((id) => this.hooks.isGhost(id)).length;- const toggle = () => { if (open) this.collapsed.add(g.key); else this.collapsed.delete(g.key); this.render(); };- const name = el('button', { className: 'nm', title: open ? 'Collapse group' : 'Expand group' },- el('span', { className: 'chev' + (open ? '' : ' shut') }, icon('down', 13, 2)), el('span', { className: 'gname', textContent: g.name }), el('span', { className: 'gcount', textContent: String(ids.length) }));- name.setAttribute('aria-expanded', String(open));- name.addEventListener('click', toggle);- const row = el('div', { className: 'row gr' + (anyVisible ? '' : ' off') }, name,- this.ghostButton(`group ${g.name}`, ghosts === ids.length, ghosts > 0 && ghosts < ids.length, () => this.hooks.setGhost(ids, ghosts !== ids.length)),- this.eyeButton(`group ${g.name}`, anyVisible, () => this.hooks.setVisible(ids, !anyVisible)));- row.style.paddingLeft = `${4 + depth * 14}px`;- row.addEventListener('contextmenu', (e) => { e.preventDefault(); this.hooks.groupContext(ids, g.name, e.clientX, e.clientY); });- return row;- }-- private row(p: PartRow, depth: number): HTMLElement {- const visible = this.hooks.isVisible(p.id);- const ghost = this.hooks.isGhost(p.id);- const sw = el('span', { className: 'sw' + (p.role === 'reference' ? ' ref' : '') });- sw.style.background = p.color;- const name = el('button', { className: 'nm', title: 'Select and show the code location' }, sw, el('span', { className: 'pname', textContent: p.name }));- name.addEventListener('click', () => this.hooks.select(p.id));- const row = el('div', { className: 'row' + (this.selected === p.id ? ' sel' : '') + (visible ? '' : ' off') }, name,- this.ghostButton(p.name, ghost, false, () => this.hooks.setGhost([p.id], !ghost)),- this.eyeButton(p.name, visible, () => this.hooks.setVisible([p.id], !visible)));- row.style.paddingLeft = `${4 + depth * 14}px`;- row.dataset.id = p.id;- row.draggable = true;- row.addEventListener('dragstart', (e) => { e.dataTransfer?.setData(DRAG_PART, p.id); if (e.dataTransfer) e.dataTransfer.effectAllowed = 'copy'; });- row.addEventListener('contextmenu', (e) => { e.preventDefault(); this.hooks.context(p.id, e.clientX, e.clientY); });- return row;- }-- private eyeButton(what: string, visible: boolean, act: () => void): HTMLButtonElement {- const b = el('button', { className: 'eye', title: visible ? 'Hide' : 'Show' }, icon(visible ? 'eye' : 'eyeoff', 15));- b.setAttribute('aria-label', `${visible ? 'Hide' : 'Show'} ${what}`);- b.addEventListener('click', () => { act(); this.render(); });- return b;- }-- /** Transparent schalten. `partly`: nur ein Teil der Gruppe ist transparent. */- private ghostButton(what: string, on: boolean, partly: boolean, act: () => void): HTMLButtonElement {- const b = el('button', { className: 'eye gh' + (on ? ' on' : partly ? ' partly' : ''), title: on ? 'Not transparent' : 'Make transparent' }, icon('ghost', 15));- b.setAttribute('aria-label', `${on ? 'Make opaque' : 'Make transparent'}: ${what}`);- b.setAttribute('aria-pressed', String(on));- b.addEventListener('click', () => { act(); this.render(); });- return b;- }-}diff --git a/app/src/renderer/resulttool.ts b/app/src/renderer/resulttool.tsindex a820d28..ac86413 100644--- a/app/src/renderer/resulttool.ts+++ b/app/src/renderer/resulttool.ts@@ -1,68 +1,94 @@+import * as THREE from 'three';import type { ResultEntry } from '../shared/types';+import { icon } from './icons';import { resultColor } from './overlay';import { fmtScale, type ResultField, type ResultLayer, type ResultProbe } from './resultview';-import { el } from './ui';+import { el, menus } from './ui';+import type { Viewer } from './viewer';-// Ergebnisse von `soma analyze` im Viewer (E58): auswählen, farbig zeigen, Wert unter dem Zeiger, an den Agenten geben.-// Gerechnet wird in Python, hier wird nur gezeigt. Neu berechnen nutzt die Angaben, mit denen der Agent es erzeugt hat.+// Ergebnisse von `soma analyze` im Viewer (E58, E82): farbig zeigen, Wert unter dem Zeiger, eine Stelle für den Agenten merken.+// Gerechnet wird in Python, hier wird nur gezeigt. Im Bild stehen die Legende senkrecht am rechten Rand, die Darstellung in einer+// Leiste unten (mit dem × zurück zum Modell) und bei FEM die Kraft und der kleinste Wert als Beschriftung. Den Bericht mit+// Annahmen und Zahlen zeigt der Reiter Analysis (analysispanel.ts), er liest den Zustand hier.interface Ui {- card: HTMLElement; close: HTMLButtonElement; select: HTMLSelectElement;- legend: HTMLElement; summary: HTMLElement; probe: HTMLElement; hint: HTMLElement;- rerun: HTMLButtonElement; agent: HTMLButtonElement;- /** Nur FEM: Überhöhung der Verformung und Lastfall ein/aus. */- femRow: HTMLElement; deform: HTMLSelectElement; bcs: HTMLButtonElement;- /** Farbskala: gezeigte Größe (nur FEM), Spanne (automatisch, Min bis Max, eigene) und die eigenen Grenzen. */- field: HTMLSelectElement; range: HTMLSelectElement; custom: HTMLElement; lo: HTMLInputElement; hi: HTMLInputElement;+ /** Schmale Legende: Größe kurz, Knopf zur Skala (zeigt die Spanne), Verlauf mit Grenzwert. */+ legend: HTMLElement; legendTitle: HTMLElement; legendBody: HTMLElement; scaleBtn: HTMLButtonElement; scaleMode: HTMLElement;+ /** Menü der Skala: Größe ausgeschrieben, Spanne, eigene Grenzen, was die Farben heißen. */+ scaleMenu: HTMLElement; legendFull: HTMLElement; legendFoot: HTMLElement;+ range: HTMLElement; custom: HTMLElement; lo: HTMLInputElement; hi: HTMLInputElement;+ /** Leiste unten im Bild: gezeigte Größe (nur FEM), Überhöhung der Verformung (nur FEM), Lastfall, Name, ×. */+ bar: HTMLElement; field: HTMLElement; deform: HTMLElement; deformLabel: HTMLElement; bcs: HTMLButtonElement; name: HTMLElement; close: HTMLButtonElement;viewerEl: HTMLElement;}interface Deps {layer: ResultLayer;+ viewer: Viewer;list(): Promise<ResultEntry[]>;rerun(id: string): Promise<{ ok: boolean; error?: string }>;readBinary(rel: string): Promise<ArrayBuffer>;beforeOn(): void;- insert(text: string): void;toast(text: string, kind?: 'ok' | 'info' | 'error'): void;- /** An, aus oder ein anderes Ergebnis: der Umschalter oben links zeigt, was zu sehen ist. */+ /** An, aus, ein anderes Ergebnis, neu berechnet oder eine Stelle gemerkt: Reiter, Baum und Leiste ziehen nach. */changed(): void;}const num = (v: number, unit: string) => (+v.toFixed(unit === '°' ? 1 : 2) + 0).toLocaleString('en-US'); // + 0: kein „-0“// Ohne Einheit (Sicherheitsfaktor der FEM) steht die Zahl allein-const withUnit = (v: number, unit: string) => `${num(v, unit)}${unit === '°' ? '°' : unit ? ` ${unit}` : ''}`;+export const withUnit = (v: number, unit: string) => `${num(v, unit)}${unit === '°' ? '°' : unit ? ` ${unit}` : ''}`;const dot = (v: number, unit: string) => `${v.toFixed(unit === '°' ? 1 : 2)}${unit === '°' ? '°' : unit ? ` ${unit}` : ''}`;-const loc = (v: number, digits: number) => (+v.toFixed(digits) + 0).toLocaleString('en-US');+export const loc = (v: number, digits: number) => (+v.toFixed(digits) + 0).toLocaleString('en-US');/** Höchster Sicherheitsfaktor in der Datei (soma.fem VALUE_CAP): Dort ist kaum Spannung, der Wert selbst sagt nichts. */-const SAFETY_CAP = 99;-const safety = (v: number) => (v >= SAFETY_CAP ? `over ${SAFETY_CAP}` : loc(v, 2));-/** FEM an einer Stelle: die gezeigte Größe zuerst, dann die andere und die Verschiebung. */+export const SAFETY_CAP = 99;+export const safety = (v: number) => (v >= SAFETY_CAP ? `over ${SAFETY_CAP}` : loc(v, 2));+/** FEM an einer Stelle: die gezeigte Größe zuerst, dann die anderen. */const femAt = (p: ResultProbe, field: ResultField, label: boolean) => {const stress = p.stress != null ? `${loc(p.stress, 1)} MPa` : null;- const sf = `${label || field === 'stress' ? 'Safety ' : ''}${safety(p.value)}`;- return [...(field === 'stress' && stress ? [stress, sf] : [sf, stress]), p.disp != null ? `${loc(p.disp, 3)} mm` : null].filter(Boolean).join(' · ');+ const disp = p.disp != null ? `${loc(p.disp, 3)} mm` : null;+ const sf = `${label || field !== 'value' ? 'Safety ' : ''}${safety(p.value)}`;+ const parts = field === 'stress' ? [stress, sf, disp] : field === 'disp' ? [disp, sf, stress] : [sf, stress, disp];+ return parts.filter(Boolean).join(' · ');};type RangeMode = 'auto' | 'minmax' | 'custom';/** Abstand des Schilds vom Zeiger (px): neben den Armen des Fadenkreuzes, nicht darauf. */const TIP_GAP = 14;+/** Höhe des Verlaufs in der Legende (px). */+const LEGEND_H = 160;+const RANGE_LABEL: Record<RangeMode, string> = { auto: 'Auto', minmax: 'Min–max', custom: 'Custom' };+const FIELD_LABEL: Record<ResultField, string> = { value: 'Safety factor', stress: 'Stress', disp: 'Displacement' };++/** Kleinster Wert (kritisch darunter) oder größter (kritisch darüber) über alle Teile, mit dem Teil. */+export function worstOf(r: ResultEntry): { part: string; value: number; at: number[] | null } | null {+ let best: { part: string; value: number; at: number[] | null } | null = null;+ for (const p of r.parts) {+ const v = r.bad === 'low' ? p.min : p.max;+ if (v == null) continue;+ if (!best || (r.bad === 'low' ? v < best.value : v > best.value)) best = { part: p.name, value: v, at: p.worst?.at ?? null };+ }+ return best;+}export class ResultTool {private active = false;- private list: ResultEntry[] = [];+ private entries: ResultEntry[] = [];private current: ResultEntry | null = null;/** Zuletzt angeklickte Stelle (für „An Agent geben“). */private pinned: ResultProbe | null = null;+ /** Stelle, die der Bericht zeigen soll („Show the spot“): Teil, an dem die Beschriftung steht. */+ private spot: string | null = null;private loading = 0;- private busy = false;- /** Beim nächsten Laden dieses Ergebnis zeigen (Wahl im Umschalter). */+ private rerunning = false;+ /** Beim nächsten Laden dieses Ergebnis zeigen. */private want: string | null = null;+ /** Zuletzt gezeigtes Ergebnis: Der Reiter Analysis bringt es wieder. */+ private lastId: string | null = null;// Farbskala: Die Wahl gilt über Ergebnisse hinweg, eigene Grenzen nur für dasselbe Ergebnis und dieselbe Größe// (nach „Neu berechnen“ bleibt die Skala, die Farben bleiben vergleichbar)private field: ResultField = 'value';private mode: RangeMode = 'auto';private custom: { key: string; range: [number, number] } | null = null;- // Schild am Zeiger: Der Wert steht dort, wo man hinschaut, die Zeile in der Karte bleibt für das Merken per Klick.- // Ein einziges Element, das nur verschoben und per textContent befüllt wird (Bauteilnamen kommen aus dem Projekt).+ // Schild am Zeiger: Der Wert steht dort, wo man hinschaut. Ein einziges Element, das nur verschoben und per textContent+ // befüllt wird (Bauteilnamen kommen aus dem Projekt).private readonly tipDot = el('span', { className: 'rs-tip-dot' });private readonly tipVal = el('b');private readonly tipName = el('div', { className: 'rs-tip-n' });@@ -70,13 +96,15 @@ export class ResultTool {constructor(private readonly ui: Ui, private readonly d: Deps) {ui.close.addEventListener('click', () => this.setActive(false));- ui.select.addEventListener('change', () => { const e = this.list.find((r) => r.id === ui.select.value); if (e) void this.load(e); });- ui.rerun.addEventListener('click', () => void this.rerun());- ui.agent.addEventListener('click', () => { const t = this.agentNote(); if (t) d.insert(t); });- ui.deform.addEventListener('change', () => { d.layer.setScale(Number(ui.deform.value) || 0); this.hideTip(); });- ui.bcs.addEventListener('click', () => { d.layer.setBcsVisible(!d.layer.bcsVisible); ui.bcs.setAttribute('aria-pressed', String(d.layer.bcsVisible)); });- ui.field.addEventListener('change', () => { this.field = ui.field.value === 'stress' ? 'stress' : 'value'; this.applyScale(); this.render(); });- ui.range.addEventListener('change', () => { this.mode = ui.range.value as RangeMode; this.applyScale(); this.render(); });+ ui.bcs.addEventListener('click', () => { d.layer.setBcsVisible(!d.layer.bcsVisible); this.renderBar(); this.renderTags(); });+ // Links neben der Legende, damit der Verlauf beim Einstellen zu sehen bleibt+ ui.scaleBtn.addEventListener('click', () => {+ menus.toggle(ui.scaleMenu, ui.legend, 'beside', () => ui.scaleBtn.setAttribute('aria-expanded', 'false'));+ ui.scaleBtn.setAttribute('aria-expanded', String(menus.isOpen(ui.scaleMenu)));+ });+ for (const b of ui.range.querySelectorAll<HTMLButtonElement>('[data-range]')) {+ b.addEventListener('click', () => { this.mode = b.dataset.range as RangeMode; this.applyScale(); this.renderLegend(); });+ }// Eigene Grenzen gelten sofort beim Tippen, solange sie gültig sind (von kleiner als bis), sonst rot umrandet und unverändertconst typed = () => {const lo = ui.lo.valueAsNumber, hi = ui.hi.valueAsNumber;@@ -92,25 +120,21 @@ export class ResultTool {ui.lo.addEventListener('input', typed);ui.hi.addEventListener('input', typed);ui.viewerEl.append(this.tip);- let queued = false, pos: [number, number] | null = null, away = true;- // Zeiger nicht mehr über dem Bild: Schild weg, die Karte zeigt wieder die gemerkte Stelle (wichtig vor „An Agent geben“)- const leave = () => { pos = null; this.hideTip(); if (!away) { away = true; this.showProbe(null, false); } };+ let queued = false, pos: [number, number] | null = null;+ const leave = () => { pos = null; this.hideTip(); };const track = (e: MouseEvent) => {if (!this.active) return;- // Beim Drehen und Verschieben bliebe das Schild mit altem Wert stehen, die Zeile in der Karte bleibt wie bisher+ // Beim Drehen und Verschieben bliebe das Schild mit altem Wert stehenif (e.buttons) { pos = null; this.hideTip(); return; }- // Über Karten, Knöpfen, Würfel oder Video kein Wert vom Modell dahinter+ // Über Baum, Leisten, Würfel oder Video kein Wert vom Modell dahinterif (!this.overImage(e.target)) { leave(); return; }- away = false;pos = [e.clientX, e.clientY];if (queued) return;queued = true;requestAnimationFrame(() => {queued = false;if (!pos || !this.active) return;- const p = this.d.layer.probe(pos[0], pos[1]);- this.showProbe(p, false);- this.showTip(p, pos);+ this.showTip(this.d.layer.probe(pos[0], pos[1]), pos);});};ui.viewerEl.addEventListener('pointermove', track);@@ -121,53 +145,69 @@ export class ResultTool {ui.viewerEl.addEventListener('pointerdown', (e) => { down = [e.clientX, e.clientY]; });ui.viewerEl.addEventListener('pointerup', (e) => {if (!this.active || !down || Math.hypot(e.clientX - down[0], e.clientY - down[1]) > 4) return;- if ((e.target as HTMLElement).closest('.float')) return;+ if (!this.overImage(e.target)) return;this.pinned = this.d.layer.probe(e.clientX, e.clientY);- this.showProbe(this.pinned, true);+ this.d.changed();});}get isActive(): boolean { return this.active; }- /** Titel des gezeigten Ergebnisses (null: keines geladen). */- get currentTitle(): string | null { return this.active ? this.current?.title ?? null : null; }- get currentId(): string | null { return this.active ? this.current?.id ?? null : null; }+ /** Gezeigtes Ergebnis (null: keines geladen). */+ get shown(): ResultEntry | null { return this.active ? this.current : null; }+ get currentTitle(): string | null { return this.shown?.title ?? null; }+ get currentId(): string | null { return this.shown?.id ?? null; }+ /** Alle Ergebnisse, wie zuletzt gelesen. */+ get list(): ResultEntry[] { return this.entries; }+ get busy(): boolean { return this.rerunning; }+ get picked(): ResultProbe | null { return this.pinned; }- /** Ein bestimmtes Ergebnis zeigen (aus dem Umschalter oben links), null: das zuletzt gezeigte oder das erste. */+ /** Ein bestimmtes Ergebnis zeigen, null: das zuletzt gezeigte, beim ersten Mal das neueste. */show(id: string | null): void {- this.want = id;+ this.want = id ?? this.lastId;if (!this.active) { this.setActive(true); return; }- const e = id ? this.list.find((r) => r.id === id) : undefined;+ const e = this.want ? this.entries.find((r) => r.id === this.want) : undefined;+ this.want = null;if (e && e.id !== this.current?.id) void this.load(e);- else void this.refresh();}setActive(on: boolean): void {if (on === this.active) return;if (on) this.d.beforeOn();this.active = on;- this.ui.card.hidden = !on;this.ui.viewerEl.classList.toggle('analyzing', on);- this.d.changed();- if (on) { void this.refresh(); return; }+ if (on) { this.renderAll(); this.d.changed(); void this.refresh(); return; }this.loading++;this.hideTip();this.d.layer.hide();this.current = null;this.pinned = null;+ this.spot = null;+ this.renderAll();+ this.d.changed();}/** Liste neu lesen (Einschalten, neuer Build, nach einer Auswertung) und das gewählte Ergebnis neu laden. */async refresh(): Promise<void> {- if (!this.active) return;const seq = ++this.loading;- try { this.list = await this.d.list(); } catch { return; }- if (seq !== this.loading || !this.active) return;- this.ui.select.replaceChildren(...this.list.map((r) => el('option', { value: r.id, textContent: r.id === r.kind ? r.title : `${r.title} (${r.id})` })));- this.ui.select.disabled = this.list.length < 2;- const want = this.list.find((r) => r.id === (this.want ?? this.current?.id)) ?? this.list[0];+ let list: ResultEntry[];+ try { list = await this.d.list(); } catch { return; }+ if (seq !== this.loading) return;+ this.entries = list;+ if (!this.active) { this.d.changed(); return; }+ const newest = [...list].sort((a, b) => b.created - a.created)[0];+ const want = list.find((r) => r.id === (this.want ?? this.current?.id)) ?? newest;this.want = null;if (want) await this.load(want, seq);- else { this.d.layer.hide(); this.current = null; this.render(); }+ else { this.d.layer.hide(); this.current = null; this.renderAll(); this.d.changed(); }+ }++ /** Liste von außen (Reiter Analysis liest sie ohnehin), ohne das gezeigte Ergebnis neu zu laden. */+ setList(list: ResultEntry[]): void {+ this.entries = list;+ // Die Zahlen im Bericht folgen der Datei (veraltet, neu gerechnet): Das gezeigte Ergebnis lädt nur neu, wenn es sich geändert hat+ const now = this.current ? list.find((r) => r.id === this.current!.id) : undefined;+ if (this.active && now && now.created !== this.current!.created) void this.load(now);+ else if (this.active && now) this.current = now;}private async load(e: ResultEntry, seq = ++this.loading): Promise<void> {@@ -178,83 +218,177 @@ export class ResultTool {// Während des Ladens geschlossen oder ein anderes gewählt: nicht stehen lassenif (!this.active) { this.d.layer.hide(); return; }if (seq !== this.loading) return;+ if (this.current?.id !== e.id) { this.pinned = null; this.spot = null; }this.current = e;+ this.lastId = e.id;this.applyScale();- this.ui.select.value = e.id;- this.pinned = null;- this.d.changed();} catch (err) {this.d.toast(`Could not load the result: ${err instanceof Error ? err.message : String(err)}`, 'error');}- this.render();+ this.renderAll();+ this.d.changed();}- private render(): void {- const r = this.current;- this.ui.rerun.disabled = !r || this.busy;- this.ui.agent.disabled = !r;- this.ui.legend.replaceChildren();- this.ui.summary.replaceChildren();- this.ui.probe.textContent = '';+ private renderAll(): void {// Anderes Ergebnis oder neu berechnet: Der Wert im Schild gilt nicht mehr, die nächste Bewegung holt den neuenthis.hideTip();- this.ui.hint.classList.toggle('warn', !!r?.stale);- // Ohne Ergebnis keine Skala zum Einstellen- this.ui.range.parentElement!.hidden = !r;- if (!r) {- this.ui.hint.textContent = 'No result yet. The agent creates it with soma analyze (overhang, wall thickness, clearance, strength with FEM).';- return;- }- this.ui.hint.textContent = this.busy ? 'Recalculating …' : r.stale ? 'Older than the code. “Recalculate” evaluates the current model.' : `soma ${r.command.join(' ')}`;+ const has = this.active && !!this.current;+ this.ui.legend.hidden = !has;+ this.ui.bar.hidden = !this.active;this.renderLegend();- for (const p of r.parts) {- const range = p.min != null && p.max != null ? `${withUnit(p.min, r.unit)} to ${withUnit(p.max, r.unit)}` : 'no values';- const crit = p.critical > 0 ? `${(p.critical / 100).toLocaleString('en-US', { maximumFractionDigits: 2 })} cm² critical` : 'nothing critical';- // FEM: kleinste Sicherheit, höchste Spannung und größte Verschiebung sagen mehr als die Spanne- // („kritisch“ nur, wenn es so ist: die Zeile ist schmal, und sie ist dann ohnehin rot)- const text = r.fem && p.stress && p.displacement && p.min != null- ? `Safety ${loc(p.min, 2)} · ${loc(p.stress.value, 1)} MPa · ${loc(p.displacement.value, 3)} mm${p.critical > 0 ? ` · ${crit}` : ''}`- : `${range} · ${crit}`;- this.ui.summary.append(el('div', { className: 'rs-row' + (p.critical > 0 ? ' bad' : '') },- el('b', { textContent: p.name }), el('span', { textContent: text })));- }- this.renderFem(r);- this.showProbe(this.pinned, true);+ this.renderBar();+ this.renderTags();}- /** Legende: Verlauf über die Spanne der gezeigten Größe, Grenzwert als Strich. */+ /** Legende senkrecht am Rand: oben das größte, unten das kleinste, der Grenzwert als Strich mit Zahl. */private renderLegend(): void {- this.ui.legend.replaceChildren();- const v = this.d.layer.view;- if (!v || !this.current) return;+ const v = this.d.layer.view, r = this.current;+ this.ui.legendBody.replaceChildren();+ if (!v || !r || !this.active) return;const [lo, hi] = v.range;- const stops = Array.from({ length: 24 }, (_, i) => {- const c = resultColor(lo + ((hi - lo) * i) / 23, v);- return `rgb(${c.map(Math.round).join(',')}) ${((i / 23) * 100).toFixed(1)}%`;+ const y = (x: number) => ((hi - x) / (hi - lo || 1)) * LEGEND_H;+ const stops = Array.from({ length: 31 }, (_, i) => {+ const c = resultColor(hi - ((hi - lo) * i) / 30, v);+ return `rgb(${c.map(Math.round).join(',')}) ${((i / 30) * 100).toFixed(1)}%`;+ });+ const bar = el('div', { className: 'lg-bar' });+ bar.style.background = `linear-gradient(to bottom, ${stops.join(', ')})`;+ const ticks = [hi, lo + (hi - lo) * 0.5, lo].map((x) => {+ const t = el('span', { className: 'lg-t', textContent: withUnit(+x.toPrecision(3), '') });+ t.style.top = `${y(x).toFixed(1)}px`;+ return t;});- const bar = el('div', { className: 'rs-bar' });- bar.style.background = `linear-gradient(to right, ${stops.join(', ')})`;- const mark = el('div', { className: 'rs-mark' });- // Grenzwert außerhalb einer gewählten Spanne: kein Strich am Rand, der dort eine Grenze vortäuschen würde- mark.hidden = v.threshold < lo || v.threshold > hi;- mark.style.left = `${Math.max(0, Math.min(100, ((v.threshold - lo) / (hi - lo || 1)) * 100))}%`;- bar.append(mark);+ this.ui.legendBody.append(bar, ...ticks);+ // Grenzwert außerhalb einer gewählten Spanne oder ohne Grenzwert (Verschiebung): kein Strich, der eine Grenze vortäuschen würde+ if (Number.isFinite(v.threshold) && v.threshold >= lo && v.threshold <= hi) {+ // Schmal: nur die Zahl, das Wort steht im Hinweis und im Menü der Skala+ const word = r.fem ? (this.d.layer.field === 'stress' ? 'allowable' : 'required') : 'limit';+ const thr = el('div', { className: 'lg-thr', title: `${withUnit(v.threshold, v.unit)} ${word}` }, el('i'), el('span', { textContent: withUnit(v.threshold, '') }));+ thr.style.top = `${y(v.threshold).toFixed(1)}px`;+ // Zahlen der Teilung, die unter dem Strich lägen, weichen+ for (const t of ticks) if (Math.abs(parseFloat(t.style.top) - y(v.threshold)) < 14) t.hidden = true;+ this.ui.legendBody.append(thr);+ }+ // Kopf kurz (Einheit, bei der Sicherheit „Safety“), ausgeschrieben im Hinweis und im Menü+ const full = v.unit ? `${v.quantity} (${v.unit})` : v.quantity;+ this.ui.legendTitle.textContent = v.unit || (r.fem ? 'Safety' : v.quantity);+ this.ui.legendTitle.title = full;+ this.ui.legendFull.textContent = full;+ this.ui.scaleMode.textContent = RANGE_LABEL[this.mode];const weakest = this.d.layer.field === 'stress' && this.d.layer.stressLimitMixed ? ' (weakest material)' : '';- // Gewählte Spanne: Rot heißt dort „oberes Ende der Skala“, nicht kritisch. Das steht dabei- const thr = `Limit ${withUnit(v.threshold, v.unit)}${weakest}, ${v.ramp ? 'color across the range' : `critical ${v.bad === 'high' ? 'above' : 'below'}`}`;- this.ui.legend.append(- el('div', { className: 'rs-q', textContent: v.unit ? `${v.quantity} (${v.unit})` : v.quantity }), bar,- el('div', { className: 'rs-scale' }, el('span', { textContent: withUnit(lo, v.unit) }),- el('span', { className: 'rs-thr', textContent: thr }),- el('span', { textContent: withUnit(hi, v.unit) })),- );+ const foot = [+ !Number.isFinite(v.threshold) ? 'No limit, color across the range'+ : v.ramp ? `Color across the range, limit ${withUnit(v.threshold, v.unit)}${weakest}`+ : `Red: ${v.bad === 'high' ? 'above' : 'below'} ${r.fem ? (this.d.layer.field === 'stress' ? 'allowable' : 'required') : 'the limit'}${weakest}`,+ this.d.layer.deformNote(),+ ].filter((x): x is string => !!x);+ this.ui.legendFoot.replaceChildren(...foot.flatMap((t, i) => (i ? [el('br'), t] : [t])));+ this.ui.legend.title = foot.join('\n');+ }++ /** Leiste unten im Bild. Ohne FEM gibt es nur den Namen und das ×. */+ private renderBar(): void {+ const l = this.d.layer, r = this.current;+ const fem = !!r?.fem && this.active;+ this.ui.name.hidden = fem || !r;+ this.ui.name.textContent = r?.title ?? '';+ this.ui.field.hidden = !fem;+ this.ui.deform.hidden = this.ui.deformLabel.hidden = !fem || l.autoScale <= 0;+ this.ui.bcs.hidden = !fem;+ for (const sep of this.ui.bar.querySelectorAll<HTMLElement>('.vsep[data-fem]')) sep.hidden = !fem;+ if (!fem) return;+ const fields: ResultField[] = ['value', ...(l.canStress ? ['stress' as const] : []), ...(l.canDisp ? ['disp' as const] : [])];+ this.ui.field.replaceChildren(...fields.map((f) => {+ const b = el('button', { textContent: FIELD_LABEL[f], className: l.field === f ? 'on' : '' });+ b.setAttribute('role', 'radio');+ b.setAttribute('aria-checked', String(l.field === f));+ b.dataset.field = f;+ b.addEventListener('click', () => { this.field = f; this.applyScale(); this.renderLegend(); this.renderBar(); this.renderTags(); this.d.changed(); });+ return b;+ }));+ const scales: [number, string][] = [[0, 'Off'], [1, '1×']];+ if (l.autoScale > 1) scales.push([l.autoScale, `${fmtScale(l.autoScale)}×`]);+ this.ui.deform.replaceChildren(...scales.map(([s, t]) => {+ const b = el('button', { textContent: t, className: l.scale === s ? 'on' : '', title: s === 0 ? 'Undeformed' : s === 1 ? 'Deformation at true scale' : `Deformation exaggerated ${fmtScale(s)} times so you can see it` });+ b.setAttribute('role', 'radio');+ b.setAttribute('aria-checked', String(l.scale === s));+ b.dataset.scale = String(s);+ b.addEventListener('click', () => { l.setScale(s); this.hideTip(); this.renderBar(); this.renderLegend(); this.renderTags(); });+ return b;+ }));+ this.ui.bcs.setAttribute('aria-pressed', String(l.bcsVisible));}- /** Größe und Spanne an die Ebene geben und die Auswahl in der Karte nachziehen. */+ /**+ * Beschriftungen im Bild: Kraft am Ende jedes Pfeils (nur mit Lastfall), der kleinste Wert und die Stelle, die der Bericht+ * zeigen soll. Ein ausgeblendetes Teil hat keine Beschriftung.+ */+ renderTags(): void {+ const r = this.current, l = this.d.layer;+ if (!this.active || !r || !l.meta) { this.d.viewer.setTags(null); return; }+ const visible = (name: string) => {+ const p = this.d.viewer.partList().find((x) => x.name === name);+ return !p || this.d.viewer.isVisible(p.id);+ };+ const tags: { el: HTMLElement; at: number[] }[] = [];+ if (r.fem && l.bcsVisible) {+ for (const t of l.arrowTails()) {+ const b = r.fem.bcs[t.bc];+ const total = b?.total;+ if (!b || !total) continue;+ tags.push({ el: el('div', { className: 'c3d' }, icon('force', 13, 2.2), el('b', { textContent: `${loc(Math.hypot(total[0], total[1], total[2]), 1)} N` })), at: t.at });+ }+ }+ const spotTag = (part: string, label: string, value: string) => {+ const p = r.parts.find((x) => x.name === part);+ const at = p?.worst?.at;+ if (!p || !at || !visible(part)) return;+ const d = el('span', { className: 'dot' });+ d.style.background = p.critical > 0 ? 'var(--err)' : 'var(--ok)';+ tags.push({ el: el('div', { className: 'c3d pt' }, d, label, el('b', { textContent: value })), at: l.shownAt(part, at) });+ };+ const w = worstOf(r);+ const val = (v: number) => (r.fem ? safety(v) : withUnit(v, r.unit));+ // Der Extremwert der gezeigten Größe: kleinste Sicherheit, höchste Spannung oder größte Verschiebung+ const peak = (key: 'stress' | 'displacement', unit: string, digits: number) => {+ let best: { name: string; value: number; at: number[] } | null = null;+ for (const p of r.parts) { const x = p[key]; if (x && (!best || x.value > best.value)) best = { name: p.name, value: x.value, at: x.at }; }+ if (!best || !visible(best.name)) return;+ const d = el('span', { className: 'dot' });+ d.style.background = 'var(--tx2)';+ tags.push({ el: el('div', { className: 'c3d pt' }, d, 'Max ', el('b', { textContent: `${loc(best.value, digits)} ${unit}` })), at: l.shownAt(best.name, best.at) });+ };+ if (l.field === 'stress') peak('stress', 'MPa', 1);+ else if (l.field === 'disp') peak('displacement', 'mm', 3);+ else if (w) spotTag(w.part, 'Min ', val(w.value));+ if (this.spot && this.spot !== w?.part) {+ const p = r.parts.find((x) => x.name === this.spot);+ const v = p ? (r.bad === 'low' ? p.min : p.max) : undefined;+ if (p && v != null) spotTag(p.name, `${p.name} `, val(v));+ }+ this.d.viewer.setTags(tags);+ }++ /** Bericht „Show the spot“: Blick auf die ungünstigste Stelle des Teils, mit Beschriftung. */+ showSpot(part: string): void {+ const r = this.current, p = r?.parts.find((x) => x.name === part);+ const at = p?.worst?.at;+ if (!r || !p || !at) return;+ this.spot = part;+ // Ausgeblendet bleibt ausgeblendet (der Baum gehört dem Nutzer), die Meldung sagt, warum nichts zu sehen ist+ const ids = this.d.viewer.partList().filter((x) => x.name === part).map((x) => x.id);+ if (ids.length && ids.every((id) => !this.d.viewer.isVisible(id))) this.d.toast(`${part} is hidden. Show it in the structure tree to see the spot.`, 'info');+ const q = this.d.layer.shownAt(part, at);+ this.d.viewer.setPivot(new THREE.Vector3(q[0], q[1], q[2]));+ this.renderTags();+ this.d.changed();+ }++ /** Größe und Spanne an die Ebene geben und die Auswahl in der Legende nachziehen. */private applyScale(): void {const l = this.d.layer, r = this.current;if (!l.meta || !r) return;- const field: ResultField = this.field === 'stress' && l.canStress ? 'stress' : 'value';+ const field: ResultField = this.field === 'stress' && l.canStress ? 'stress' : this.field === 'disp' && l.canDisp ? 'disp' : 'value';let range: [number, number] | null = null;if (this.mode === 'minmax') range = l.dataRange(field);else if (this.mode === 'custom') {@@ -263,9 +397,7 @@ export class ResultTool {range = this.custom.range;}l.setDisplay(field, range);- this.ui.field.hidden = !l.canStress;- this.ui.field.value = field;- this.ui.range.value = this.mode;+ for (const b of this.ui.range.querySelectorAll<HTMLButtonElement>('[data-range]')) b.setAttribute('aria-checked', String(b.dataset.range === this.mode));this.ui.custom.hidden = this.mode !== 'custom';// Beim Tippen nicht überschreiben (aus „1.“ würde „1“)const typing = document.activeElement === this.ui.lo || document.activeElement === this.ui.hi;@@ -277,38 +409,9 @@ export class ResultTool {}}- /** FEM: Lastfall und Hinweise in der Karte, Wahl der Überhöhung. */- private renderFem(r: ResultEntry): void {- const fem = r.fem;- this.ui.femRow.hidden = !fem;- if (!fem) return;- const n = (v: number[]) => `${loc(Math.hypot(v[0], v[1], v[2]), 1)} N`;- for (const b of fem.bcs) {- const what = b.kind === 'fix' ? `Fixed${b.axes && b.axes !== 'xyz' ? ` (${b.axes.toUpperCase().split('').join(', ')} only)` : ''}`- : b.kind === 'force' ? 'Force' : 'Pressure';- const val = b.kind === 'fix' ? (b.reaction ? `reaction force ${n(b.reaction)}` : '')- : b.kind === 'pressure' ? `${loc(b.value ?? 0, 3)} MPa, total ${n(b.total ?? [0, 0, 0])}` : n(b.total ?? [0, 0, 0]);- this.ui.summary.append(el('div', { className: 'rs-row bc' }, el('b', { textContent: what }), el('span', { textContent: `${b.label} · ${val}` })));- }- for (const t of r.notes ?? []) this.ui.summary.append(el('div', { className: 'rs-note', textContent: t }));- const l = this.d.layer;- const opts: [number, string][] = [[0, 'Undeformed'], [1, 'True scale']];- if (l.autoScale > 1) opts.push([l.autoScale, `Exaggerated ${fmtScale(l.autoScale)}×`]);- this.ui.deform.replaceChildren(...opts.map(([v, t]) => el('option', { value: String(v), textContent: t })));- this.ui.deform.value = String(l.scale);- this.ui.bcs.setAttribute('aria-pressed', String(l.bcsVisible));- }-- private showProbe(p: ResultProbe | null, pinned: boolean): void {- const r = this.current;- if (!r) return;- if (!p) { if (!pinned || !this.pinned) this.ui.probe.textContent = this.pinned ? this.probeText(this.pinned, true) : 'Point at the model to see the value there. Click to keep the spot for the agent.'; return; }- this.ui.probe.textContent = this.probeText(p, pinned);- }-/*** Frei über dem Bild? Die Ebenen darüber (Beschriftungen, Malfläche, dieses Schild) lassen den Zeiger durch, das Ziel ist- * dann die 3D-Fläche selbst. Karten, Knöpfe, Würfel und Video sind eigene Elemente und zählen nicht.+ * dann die 3D-Fläche selbst. Baum, Leisten, Würfel und Video sind eigene Elemente und zählen nicht.*/private overImage(t: EventTarget | null): boolean {const v = this.ui.viewerEl;@@ -335,30 +438,32 @@ export class ResultTool {private hideTip(): void { this.tip.hidden = true; }- /** Teil aus- oder eingeblendet: Der Wert unter dem Zeiger gilt nicht mehr, bis sich die Maus wieder bewegt. */- forgetProbe(): void { if (this.active) { this.hideTip(); this.showProbe(null, false); } }+ /** Teil aus- oder eingeblendet: Der Wert unter dem Zeiger gilt nicht mehr, die Beschriftungen folgen. */+ forgetProbe(): void { if (this.active) { this.hideTip(); this.renderTags(); } }- private probeText(p: ResultProbe, pinned: boolean): string {- const r = this.current!;+ /** Gemerkte Stelle als Zeile für den Bericht (null: keine). */+ pickText(): string | null {+ const p = this.pinned, r = this.current;+ if (!p || !r) return null;const what = r.fem ? femAt(p, this.d.layer.field, true) : withUnit(p.value, r.unit);- return `${pinned ? 'Picked' : 'Pointer'}: ${p.name}, ${what} at (${p.point.map((v) => (v + 0).toLocaleString('en-US')).join(', ')})`;+ return `Picked: ${p.name}, ${what} at (${p.point.map((v) => (v + 0).toLocaleString('en-US')).join(', ')})`;}- private async rerun(): Promise<void> {+ async rerun(): Promise<void> {const r = this.current;- if (!r || this.busy) return;- this.busy = true;- this.render();+ if (!r || this.rerunning) return;+ this.rerunning = true;+ this.d.changed();try {const res = await this.d.rerun(r.id);if (!res.ok) this.d.toast(`Could not recalculate: ${res.error ?? 'unknown error'}`, 'error');} finally {- this.busy = false;+ this.rerunning = false;await this.refresh();}}- private agentNote(): string | null {+ agentNote(): string | null {const r = this.current;if (!r) return null;const head = `[Result: "${r.title}" (${r.file}, limit ${dot(r.threshold, r.unit)})`;@@ -375,21 +480,28 @@ export class ResultTool {/** Prüfhilfe. */state() {+ const l = this.d.layer;return {- active: this.active, id: this.current?.id ?? null, stale: this.current?.stale ?? null, options: [...this.ui.select.options].map((o) => o.textContent),- rows: [...this.ui.summary.querySelectorAll('.rs-row')].map((x) => x.textContent), probe: this.ui.probe.textContent, hint: this.ui.hint.textContent,- note: this.agentNote(), meta: this.d.layer.meta ? { threshold: this.d.layer.meta.threshold, unit: this.d.layer.meta.unit } : null,+ active: this.active, id: this.current?.id ?? null, stale: this.current?.stale ?? null, busy: this.rerunning,+ options: this.entries.map((r) => r.title), probe: this.pickText(), note: this.agentNote(),+ meta: l.meta ? { threshold: l.meta.threshold, unit: l.meta.unit } : null,tip: this.tip.hidden ? null : `${this.tipVal.textContent} · ${this.tipName.textContent}`,- scale: { field: this.d.layer.field, mode: this.mode, canStress: this.d.layer.canStress, range: this.d.layer.view?.range ?? null,- threshold: this.d.layer.view?.threshold ?? null, unit: this.d.layer.view?.unit ?? null, legend: this.ui.legend.textContent },- fem: this.ui.femRow.hidden ? null : {- deform: this.ui.deform.value, options: [...this.ui.deform.options].map((o) => o.textContent), bcs: this.ui.bcs.getAttribute('aria-pressed') === 'true',- scale: this.d.layer.scale, notes: [...this.ui.summary.querySelectorAll('.rs-note')].map((x) => x.textContent),- bcRows: [...this.ui.summary.querySelectorAll('.rs-row.bc')].map((x) => x.textContent),- },+ tags: [...this.ui.viewerEl.querySelectorAll('.v-overlay .c3d')].map((x) => x.textContent),+ // Nur was zu sehen ist (ohne FEM fehlen Größe, Verformung und Lastfall)+ bar: this.ui.bar.hidden ? null : [...this.ui.bar.children].filter((c) => !(c as HTMLElement).hidden).map((c) => c.textContent?.trim()).filter(Boolean).join(' · '),+ scale: { field: l.field, mode: this.mode, canStress: l.canStress, canDisp: l.canDisp, range: l.view?.range ?? null,+ threshold: l.view?.threshold ?? null, unit: l.view?.unit ?? null, legend: this.ui.legend.hidden ? '' : `${this.ui.legend.textContent ?? ''} ${this.ui.scaleMenu.textContent ?? ''}`.replace(/\s+/g, ' ').trim() },+ fem: this.current?.fem && this.active ? {+ deform: String(l.scale), options: [...this.ui.deform.querySelectorAll('button')].map((o) => o.textContent),+ fields: [...this.ui.field.querySelectorAll('button')].map((o) => o.textContent), bcs: l.bcsVisible, scale: l.scale,+ } : null,};}/** Prüfhilfe: Stelle anklicken wie mit der Maus. */- testPin(x: number, y: number): ResultProbe | null { this.pinned = this.d.layer.probe(x, y); this.showProbe(this.pinned, true); return this.pinned; }+ testPin(x: number, y: number): ResultProbe | null { this.pinned = this.d.layer.probe(x, y); this.d.changed(); return this.pinned; }+ /** Prüfhilfe: Größe wählen wie in der Leiste. */+ testField(f: ResultField): void { this.ui.field.querySelector<HTMLButtonElement>(`[data-field="${f}"]`)?.click(); }+ /** Prüfhilfe: Überhöhung wählen wie in der Leiste (0, 1 oder die vorgeschlagene). */+ testDeform(s: number): void { this.ui.deform.querySelector<HTMLButtonElement>(`[data-scale="${s}"]`)?.click(); }}diff --git a/app/src/renderer/resultview.ts b/app/src/renderer/resultview.tsindex f2f77b5..d948491 100644--- a/app/src/renderer/resultview.ts+++ b/app/src/renderer/resultview.ts@@ -10,10 +10,14 @@ import type { Viewer } from './viewer';// FEM (E65) bringt dazu je Ecke die Vergleichsspannung (_STRESS) und die Verschiebung (_DISP) mit, und den Lastfall als// eigene Netze (extras.soma.marker): Die Verformung lässt sich überhöht zeigen, Einspannungen und Lasten sind markiert.-interface ResultMesh { mesh: THREE.Mesh; name: string; values: THREE.BufferAttribute; stress?: THREE.BufferAttribute; disp?: THREE.BufferAttribute }+interface ResultMesh {+ mesh: THREE.Mesh; name: string; values: THREE.BufferAttribute; stress?: THREE.BufferAttribute; disp?: THREE.BufferAttribute;+ /** Betrag der Verschiebung je Ecke (mm), aus `disp` beim Laden berechnet. */+ dispMag?: THREE.BufferAttribute;+}/** Verformbare Geometrie: Ausgangslage und Verschiebung je Ecke. */interface Deformable { geo: THREE.BufferGeometry; base: Float32Array; disp: THREE.BufferAttribute }-interface Arrow { obj: THREE.Object3D; base: THREE.Vector3; shift: THREE.Vector3 }+interface Arrow { obj: THREE.Object3D; base: THREE.Vector3; shift: THREE.Vector3; bc: number }export interface ResultProbe {name: string; value: number; point: number[];@@ -21,8 +25,8 @@ export interface ResultProbe {stress?: number; disp?: number;}-/** Gezeigte Größe: der Wert der Auswertung (bei FEM die Sicherheit) oder bei FEM die Vergleichsspannung nach von Mises. */-export type ResultField = 'value' | 'stress';+/** Gezeigte Größe: der Wert der Auswertung (bei FEM die Sicherheit), bei FEM auch die Vergleichsspannung nach von Mises oder der Betrag der Verschiebung. */+export type ResultField = 'value' | 'stress' | 'disp';/** Blau des Lastfalls: keine Statusfarbe, nicht Orange (Aktion) und nicht Violett (Vorschau). */const BC_COLOR = 0x5ea8ff;@@ -52,20 +56,24 @@ export class ResultLayer {get isFem(): boolean { return !!this.meta?.fem; }/** Spannung zeigbar: FEM mit _STRESS an jedem Netz und Werkstoff mit Festigkeit (für die Grenze). */get canStress(): boolean { return this.isFem && this.stressLimit > 0 && this.meshes.length > 0 && this.meshes.every((m) => m.stress); }+ /** Verschiebung zeigbar: FEM mit _DISP an jedem Netz. */+ get canDisp(): boolean { return this.isFem && this.meshes.length > 0 && this.meshes.every((m) => m.dispMag); }/** Grenze der Spannung gilt nur für den schwächsten von mehreren Werkstoffen. */get stressLimitMixed(): boolean { return this.stressMixed; }/*** Was gezeigt wird: Größe, Einheit, Grenze und Spanne der Farbskala. Spannung: kritisch über der zulässigen Spannung, so* bleiben die Farben bei beiden Größen gleich gemeint (Rot heißt zu wenig Sicherheit). Gewählte Spanne: Farbverlauf über die- * Spanne (`ramp`), nicht mehr am Grenzwert ausgerichtet.+ * Spanne (`ramp`), nicht mehr am Grenzwert ausgerichtet. Die Verschiebung hat keinen Grenzwert (NaN): immer ein Verlauf.*/get view(): (ResultMeta & { ramp?: boolean }) | null {const m = this.meta;if (!m) return null;- const base: ResultMeta = this.field === 'stress'+ const base: ResultMeta & { ramp?: boolean } = this.field === 'stress'? { ...m, quantity: 'von Mises stress', unit: 'MPa', bad: 'high', threshold: this.stressLimit, range: this.autoRange('stress') }- : m;+ : this.field === 'disp'+ ? { ...m, quantity: 'Displacement', unit: 'mm', bad: 'high', threshold: NaN, range: this.autoRange('disp'), ramp: true }+ : m;return this.range ? { ...base, range: this.range, ramp: true } : base;}@@ -75,6 +83,7 @@ export class ResultLayer {*/autoRange(field: ResultField): [number, number] {if (field === 'value' || !this.meta) return this.meta ? [...this.meta.range] as [number, number] : [0, 1];+ if (field === 'disp') return [0, +Math.max(this.dataRange('disp')[1], 1e-6).toPrecision(3)];const [, hi] = this.dataRange('stress');return [0, +Math.max(2 * this.stressLimit, Math.min(hi, 4 * this.stressLimit)).toPrecision(3)];}@@ -83,21 +92,28 @@ export class ResultLayer {dataRange(field: ResultField): [number, number] {let lo = Infinity, hi = -Infinity;for (const m of this.meshes) {- const a = field === 'stress' && m.stress ? m.stress : m.values;+ const a = this.attr(m, field);for (let i = 0; i < a.count; i++) { const v = a.getX(i); if (v < lo) lo = v; if (v > hi) hi = v; }}return Number.isFinite(lo) ? [lo, hi] : [0, 1];}+ /** Werte je Ecke für eine Größe (ohne sie: der Wert der Auswertung). */+ private attr(m: ResultMesh, field: ResultField): THREE.BufferAttribute {+ return (field === 'stress' ? m.stress : field === 'disp' ? m.dispMag : undefined) ?? m.values;+ }+/** Größe und Spanne wählen (null: Spanne der Auswertung) und neu einfärben. */setDisplay(field: ResultField, range: [number, number] | null): void {- this.field = field === 'stress' && this.canStress ? 'stress' : 'value';+ this.field = field === 'stress' && this.canStress ? 'stress' : field === 'disp' && this.canDisp ? 'disp' : 'value';this.range = range;this.recolor();}- /** Gezeigter Wert an einer Stelle (Spannung oder der Wert der Auswertung). */- shown(p: ResultProbe): number { return this.field === 'stress' && p.stress != null ? p.stress : p.value; }+ /** Gezeigter Wert an einer Stelle (Spannung, Verschiebung oder der Wert der Auswertung). */+ shown(p: ResultProbe): number {+ return this.field === 'stress' && p.stress != null ? p.stress : this.field === 'disp' && p.disp != null ? p.disp : p.value;+ }async show(glb: ArrayBuffer): Promise<ResultMeta> {const gltf = await new GLTFLoader().parseAsync(glb, '');@@ -142,8 +158,14 @@ export class ResultLayer {vertexColors: true, side: THREE.DoubleSide, roughness: 0.75, metalness: 0,polygonOffset: true, polygonOffsetFactor: 1, polygonOffsetUnits: 1, clippingPlanes: this.viewer.clipPlanes,});- own.push({ mesh: m, name, values, stress: m.geometry.getAttribute('_stress') as THREE.BufferAttribute | undefined,- disp: m.geometry.getAttribute('_disp') as THREE.BufferAttribute | undefined });+ const disp = m.geometry.getAttribute('_disp') as THREE.BufferAttribute | undefined;+ let dispMag: THREE.BufferAttribute | undefined;+ if (disp) {+ const a = new Float32Array(disp.count);+ for (let i = 0; i < disp.count; i++) a[i] = Math.hypot(disp.getX(i), disp.getY(i), disp.getZ(i));+ dispMag = new THREE.BufferAttribute(a, 1);+ }+ own.push({ mesh: m, name, values, stress: m.geometry.getAttribute('_stress') as THREE.BufferAttribute | undefined, disp, dispMag });deformable(m.geometry);} else if ((c as THREE.LineSegments).isLineSegments) {const l = c as THREE.LineSegments;@@ -171,7 +193,7 @@ export class ResultLayer {this.stressLimit = limits.length ? Math.min(...limits) : 0;this.stressMixed = new Set(limits).size > 1;this.range = null;- if (!this.canStress) this.field = 'value';+ if ((this.field === 'stress' && !this.canStress) || (this.field === 'disp' && !this.canDisp)) this.field = 'value';this.recolor();this.viewer.setModelHidden(true);this.viewer.addLayer(this.group);@@ -221,7 +243,7 @@ export class ResultLayer {shift.divideScalar(d.count);});this.group!.add(a);- out.push({ obj: a, base, shift });+ out.push({ obj: a, base, shift, bc: i });});return out;}@@ -246,6 +268,27 @@ export class ResultLayer {this.viewer.standInsMoved();}+ /** Enden der Kraftpfeile (E82, Beschriftung im Bild), so wie sie gerade stehen, mit dem Index der Randbedingung. */+ arrowTails(): { bc: number; at: number[] }[] {+ return this.arrows.map((a) => ({ bc: a.bc, at: a.obj.position.toArray() }));+ }++ /** Wo ein Punkt der Ausgangslage (mm) auf dem Bauteil gerade liegt: verformt gezeigt verschoben wie die nächste Ecke. */+ shownAt(part: string, at: number[]): number[] {+ if (!this.scale) return at;+ const p = new THREE.Vector3(...(at as [number, number, number]));+ let best = Infinity, d: THREE.Vector3 | null = null;+ for (const m of this.meshes) {+ const def = m.name === part && m.disp ? this.deformables.find((x) => x.geo === m.mesh.geometry) : undefined;+ if (!def || !m.disp) continue;+ for (let i = 0; i < m.disp.count; i++) {+ const q = (def.base[i * 3] - p.x) ** 2 + (def.base[i * 3 + 1] - p.y) ** 2 + (def.base[i * 3 + 2] - p.z) ** 2;+ if (q < best) { best = q; d = new THREE.Vector3(m.disp.getX(i), m.disp.getY(i), m.disp.getZ(i)); }+ }+ }+ return d ? p.addScaledVector(d, this.scale).toArray() : at;+ }+/** Lastfall (Einspannungen, Lastflächen, Pfeile) ein- oder ausblenden. */setBcsVisible(on: boolean): void {this.showBcs = on;@@ -267,7 +310,7 @@ export class ResultLayer {if (!view) return;const c = new THREE.Color();for (const m of this.meshes) {- const a = this.field === 'stress' && m.stress ? m.stress : m.values;+ const a = this.attr(m, this.field);const n = a.count;const col = new Float32Array(n * 3);for (let i = 0; i < n; i++) {diff --git a/app/src/renderer/settings.ts b/app/src/renderer/settings.tsindex b0b2ee4..db23289 100644--- a/app/src/renderer/settings.ts+++ b/app/src/renderer/settings.ts@@ -13,8 +13,8 @@ import { CATEGORY_ICON } from './skills';import { el, menus } from './ui';/** Reiter der Einstellungen (E78, E81). */-export type SettingsSection = 'viewer' | 'skills' | 'storage' | 'about';-export const SECTIONS: SettingsSection[] = ['viewer', 'skills', 'storage', 'about'];+export type SettingsSection = 'viewer' | 'keys' | 'skills' | 'storage' | 'about';+export const SECTIONS: SettingsSection[] = ['viewer', 'keys', 'skills', 'storage', 'about'];/** Ein Reiter außer „Skills“: wird beim Zeigen aufgefrischt. */export interface SettingsPage { show(): void }diff --git a/app/src/renderer/settingspages.ts b/app/src/renderer/settingspages.tsindex e6b4f7b..03031f4 100644--- a/app/src/renderer/settingspages.ts+++ b/app/src/renderer/settingspages.ts@@ -2,6 +2,7 @@ import { DECIMALS, NAV_PRESETS, navLegend, type NavPreset, type Projection, typeimport type { AboutInfo, ComponentInfo, SomaApi, StorageArea, StorageEntry, StorageStats } from '../shared/types';import { icon } from './icons';import type { SettingsPage } from './settings';+import { shortcutGroups } from './shortcuts';import { el } from './ui';/**@@ -132,6 +133,19 @@ const AREA: Record<Exclude<StorageEntry['id'], 'appdata'>, { title: string; iconother: { title: 'Other', icon: 'file', desc: () => 'Caches of the display, the settings and the state of the app.' },};+/** Reiter „Shortcuts“: alle Tasten und Mausgesten zum Nachschlagen, die Navigation nach der gewählten Mausbelegung. Nur lesen. */+export class ShortcutsPage implements SettingsPage {+ constructor(private root: HTMLElement, private deps: { current(): SettingsState }) {}++ show(): void {+ const nav = this.deps.current().settings.viewer.navigation;+ const groups = shortcutGroups(nav).map((g) => group(g.title, ...g.items.map((it) => el('div', { className: 'st-key' },+ el('span', { className: 'st-kk' }, ...it.keys.flatMap((k, i) => [i ? el('span', { className: 'plus', textContent: '+' }) : null, el('kbd', { textContent: k })])),+ el('span', { className: 'st-kw', textContent: it.what })))));+ this.root.replaceChildren(...head('Shortcuts', `Keys and mouse gestures of SOMA. Not active while you type in the code, the terminal or a field. Navigation as set under Viewer (${NAV_PRESETS.find((p) => p.id === nav)?.label ?? nav}).`), ...groups);+ }+}+export class StoragePage implements SettingsPage {private stats: StorageStats | null = null;private loading = false;diff --git a/app/src/renderer/shortcuts.ts b/app/src/renderer/shortcuts.tsnew file mode 100644index 0000000..66f5070--- /dev/null+++ b/app/src/renderer/shortcuts.ts@@ -0,0 +1,79 @@+import { navLegend, type NavPreset } from '../shared/settings';++// Übersicht der Tasten und Mausgesten für den Reiter „Shortcuts“ der Einstellungen. Die Tasten selbst sind dort verdrahtet, wo+// sie wirken (main.ts, markup.ts, videoview.ts …). Wer dort eine ändert oder hinzufügt, trägt sie hier nach.++export interface Shortcut { keys: string[]; what: string }+export interface ShortcutGroup { title: string; items: Shortcut[] }++/** Alle Gruppen. Die Navigation im Viewer hängt von der Mausbelegung in den Einstellungen ab (E81). */+export function shortcutGroups(nav: NavPreset): ShortcutGroup[] {+ return [+ {+ title: 'Select and show parts',+ items: [+ { keys: ['Click'], what: 'Select a part, in the model or in the structure tree' },+ { keys: ['Ctrl', 'Click'], what: 'Add a part to the selection or remove it' },+ { keys: ['Shift', 'Click'], what: 'Add to the selection. In the tree: select all parts from the last click to here' },+ { keys: ['Alt', 'Drag'], what: 'Box select in the model. Left to right: parts fully inside. Right to left: parts touching the box. With Shift or Ctrl: add' },+ { keys: ['Right-click'], what: 'Menu for the part or the selection: isolate, hide, transparent, zoom, code, agent' },+ { keys: ['H'], what: 'Hide the selected parts' },+ { keys: ['Shift', 'H'], what: 'Show all parts again' },+ { keys: ['I'], what: 'Isolate: show only the selected parts' },+ { keys: ['T'], what: 'Make the selected parts transparent, or opaque again' },+ { keys: ['Esc'], what: 'Clear the selection' },+ { keys: ['Drag across the eyes'], what: 'In the tree: hide or show several parts in one go (same for the half circles: transparent)' },+ { keys: ['F3'], what: 'Expand or collapse the structure tree' },+ ],+ },+ {+ title: 'View',+ items: [+ ...navLegend(nav).map((n) => ({ keys: [n.how], what: n.label })),+ { keys: ['Double-click'], what: 'Set the pivot to the spot under the mouse' },+ ],+ },+ {+ title: 'Model and window',+ items: [+ { keys: ['Ctrl', 'S'], what: 'Save the model (in the code: save the file and build)' },+ { keys: ['Ctrl', 'Shift', 'S'], what: 'Save as' },+ { keys: ['Ctrl', 'O'], what: 'Open a model' },+ { keys: ['Ctrl', 'N'], what: 'New model' },+ { keys: ['Ctrl', 'B'], what: 'Build now' },+ { keys: ['Ctrl', '1'], what: 'Show or hide the sidebar' },+ { keys: ['Ctrl', '2'], what: 'Show or hide the code' },+ { keys: ['Ctrl', '3'], what: 'Expand or collapse the agent' },+ ],+ },+ {+ title: 'Animation and video',+ items: [+ { keys: ['Space'], what: 'Play or pause' },+ { keys: ['←', '→'], what: 'Video: one frame back or forward' },+ { keys: ['Esc'], what: 'Close the video' },+ ],+ },+ {+ title: 'Tools',+ items: [+ { keys: ['Esc'], what: 'Stop measuring, cancel a preparation' },+ { keys: ['↑', '↓'], what: 'Section: move the plane by 1 mm (Shift: 10 mm, Alt: 0.1 mm)' },+ { keys: ['+', '−', '0'], what: 'PDF and DXF: zoom in, zoom out, fit' },+ { keys: ['F2'], what: 'Files: rename' },+ { keys: ['Del'], what: 'Files: move to the Recycle Bin' },+ ],+ },+ {+ title: 'Markup',+ items: [+ { keys: ['Ctrl', 'Z'], what: 'Undo' },+ { keys: ['Ctrl', 'Y'], what: 'Redo (also Ctrl Shift Z)' },+ { keys: ['Del'], what: 'Delete the selected shape' },+ { keys: ['Shift'], what: 'While drawing: square, circle, 15° steps. While scaling: keep the aspect ratio' },+ { keys: ['Alt'], what: 'While dragging: ignore the grid' },+ { keys: ['Esc'], what: 'Deselect the shape, then discard the markup (press twice)' },+ ],+ },+ ];+}diff --git a/app/src/renderer/style.css b/app/src/renderer/style.cssindex c41b330..f1612e0 100644--- a/app/src/renderer/style.css+++ b/app/src/renderer/style.css@@ -92,14 +92,20 @@ code { font-family:var(--mono); font-size:.95em; }/* ---- Gerüst ---------------------------------------------------------------------------------------------------- */#body { flex:1; display:flex; min-height:0; }#rail { width:60px; flex-shrink:0; display:flex; flex-direction:column; align-items:center; gap:4px; padding:8px 0; background:var(--s1); border-right:1px solid var(--line); }-#rail button { width:50px; height:52px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; border-radius:8px; color:var(--tx2); }+#rail button { position:relative; width:50px; height:52px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; border-radius:8px; color:var(--tx2); }#rail button span { font-size:10.5px; }#rail button:hover:not(:disabled) { background:var(--s2); color:var(--tx); }#rail button[aria-pressed=true] { background:var(--s3); color:var(--acc-tx); }#rail button:disabled { color:#4d555f; }+/* Gruppen der Leiste (E82): Arbeit am Modell, Ergebnisse des Agenten, Regeln für den Agenten */+.rail-sep { width:32px; height:1px; background:#3d444e; margin:8px 0; flex-shrink:0; }+/* Punkt am Reiter: Neues vom Agenten, noch nicht angesehen */+#rail .nd { position:absolute; top:7px; right:10px; width:7px; height:7px; border-radius:50%; background:var(--acc); box-shadow:0 0 0 2px var(--s1); }+#rail button[aria-pressed=true] .nd { box-shadow:0 0 0 2px var(--s3); }.splitter { width:4px; margin:0 -2px; flex-shrink:0; cursor:col-resize; position:relative; z-index:5; }.splitter:hover, .splitter.drag { background:var(--acc-line); }+#side.wide { width:max(var(--side, 272px), 352px); }#side { width:var(--side, 272px); flex-shrink:0; display:flex; flex-direction:column; min-width:0; background:var(--s1); border-right:1px solid var(--line); position:relative; }#editor { width:var(--editor, 520px); flex-shrink:0; display:flex; flex-direction:column; min-width:0; background:var(--term); border-right:1px solid var(--line); }.side-hd .hd-count { margin-left:6px; font-size:12px; }@@ -420,56 +426,85 @@ code { font-family:var(--mono); font-size:.95em; }@keyframes vb-run { from { left:-35%; } to { left:100%; } }.float { position:absolute; z-index:2; background:rgba(24,27,31,.95); border:1px solid var(--line2); border-radius:10px; box-shadow:var(--shadow); }-/* Bauteile (Entwurf 2): Baum in der Seitenleiste. Kompakte Zeilen, die Knöpfe erscheinen beim Überfahren- oder wenn sie etwas anzeigen (ausgeblendet, transparent). */-.ptree { flex:1; overflow:auto; padding:6px 0 10px; }-.row { display:flex; align-items:center; height:26px; padding:0 6px 0 4px; margin:0 6px; border-radius:6px; }-.row:hover { background:var(--s3); }-.row .nm { flex:1; min-width:0; display:flex; align-items:center; gap:9px; height:26px; padding:0 6px; border-radius:6px; text-align:left; }-.row .eye { visibility:hidden; }-.row:hover .eye, .row .eye:focus-visible, .row .eye.gh.on, .row .eye.gh.partly, .row.off .eye:not(.gh) { visibility:visible; }-.row .pname { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }-.row.sel { background:var(--acc-tint); }-.row.sel .nm { color:var(--acc-tx); font-weight:500; }-.row.off .nm { color:var(--tx3); }-.row .eye { width:24px; height:24px; display:flex; align-items:center; justify-content:center; border-radius:6px; color:var(--tx3); }-.row .eye:hover { background:var(--s3); color:var(--tx); }-.row .eye.gh.on { color:var(--acc-tx); }-.row .eye.gh.partly { color:var(--acc-tx); opacity:.45; } /* nur ein Teil der Gruppe ist transparent */-.row.gr .nm { gap:5px; padding-left:4px; }-.row.gr .chev { display:flex; color:var(--tx3); transition:transform .12s; }-.row.gr .chev.shut { transform:rotate(-90deg); }-.row.gr .gname { font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }-.row.gr .gcount { font-size:11px; color:var(--tx3); margin-left:2px; }+/* Strukturbaum ganz oben links im Viewer (E82, tree.ts). Ohne Hintergrund wie in CATIA: nur Schrift, Striche und Symbole, mit+ dunklem Rand, damit sie über jedem Teil und jeder Ergebnisfarbe lesbar bleiben. Nur die Zeile unter der Maus hellt auf.+ Je Zeile erst die Baumstriche, dann Pfeil (Gruppe), Auge und Halbkreis, dann der Name. Höchstens halb so hoch wie das Bild. */+.tree { --trl:rgba(230,232,235,.3); position:absolute; left:12px; top:12px; z-index:4; display:flex; flex-direction:column; max-height:calc(50% - 12px);+ font-size:12.5px; color:var(--tx); font-variant-numeric:tabular-nums; white-space:nowrap;+ text-shadow:0 0 1px #0a0b0d, 0 0 2px #0a0b0d, 0 0 4px rgba(10,11,13,.9), 0 0 8px rgba(10,11,13,.6); }+.tree svg.ic { filter:drop-shadow(0 0 1px #0a0b0d) drop-shadow(0 0 2px #0a0b0d) drop-shadow(0 0 5px rgba(10,11,13,.7)); }+.tree.open { width:max-content; min-width:230px; max-width:min(340px, 46%); }+.tr-hd { display:flex; align-items:center; gap:2px; height:28px; flex-shrink:0; }+.tr-toggle { display:flex; align-items:center; gap:6px; height:28px; padding:0 8px 0 4px; border-radius:6px; min-width:0; }+.tr-toggle:hover { background:rgba(255,255,255,.09); }+.tr-toggle .chev { width:14px; display:flex; justify-content:center; color:var(--tx2); }+.tr-toggle .ico { display:flex; color:var(--tx2); }+.tr-toggle b { font-weight:500; overflow:hidden; text-overflow:ellipsis; max-width:260px; }+.tr-toggle .n { color:var(--tx2); font-size:12px; }+.tr-hd .sp { flex:1; }+.tree .hb { width:24px; height:24px; display:flex; align-items:center; justify-content:center; border-radius:5px; color:var(--tx2); flex-shrink:0; }+.tree .hb:hover { background:rgba(255,255,255,.09); color:var(--tx); }+.tr-search { display:flex; align-items:center; gap:7px; height:30px; flex-shrink:0; margin:0 0 4px; padding:0 3px 0 8px; border:1px solid var(--acc-line); border-radius:6px;+ background:var(--bg); color:var(--tx3); text-shadow:none; }+.tr-search svg.ic { filter:none; }+.tr-search input { flex:1; min-width:60px; height:26px; border:0; outline:0; background:none; color:var(--tx); font:inherit; padding:0; }+.tr-search input::-webkit-search-cancel-button { display:none; }+.tr-hits { font-size:12px; color:var(--tx3); }+.tr-rows { flex:1 1 auto; min-height:0; overflow:auto; padding:0 0 2px; }+/* Schlanke Scrollleisten ohne Pfeile im Baum und in den Reitern Analysis und Animation. Im Baum kaum zu sehen, solange die Maus+ nicht darüber ist: Er soll so wenig wie möglich im Weg sein */+.tr-rows::-webkit-scrollbar, .cx-scroll::-webkit-scrollbar, .al::-webkit-scrollbar { width:6px; height:6px; }+.tr-rows::-webkit-scrollbar-button, .cx-scroll::-webkit-scrollbar-button, .al::-webkit-scrollbar-button { display:none; width:0; height:0; }+.tr-rows::-webkit-scrollbar-track, .cx-scroll::-webkit-scrollbar-track, .al::-webkit-scrollbar-track { background:transparent; }+.tr-rows::-webkit-scrollbar-thumb { border-radius:3px; background:rgba(230,232,235,.14); }+.tree:hover .tr-rows::-webkit-scrollbar-thumb { background:rgba(230,232,235,.32); }+.cx-scroll::-webkit-scrollbar-thumb, .al::-webkit-scrollbar-thumb { border-radius:3px; background:var(--line2); }+.cx-scroll::-webkit-scrollbar-thumb:hover, .al::-webkit-scrollbar-thumb:hover, .tr-rows::-webkit-scrollbar-thumb:hover { background:#4a525d; }+.tr-row { display:flex; align-items:center; height:24px; border-radius:5px; padding:0 8px 0 4px; }+.tr-row:hover { background:rgba(255,255,255,.09); }+.tr-row:hover .tg { opacity:1; }+/* Baumstriche je Ebene: v läuft weiter, t zweigt ab, l zweigt als letzter ab, h führt bei Teilen bis zu den Knöpfen */+.tr-row .br { display:flex; align-self:stretch; flex-shrink:0; }+.tr-row .br i { position:relative; width:14px; }+.tr-row .br i::before, .tr-row .br i::after { box-shadow:0 0 0 1px rgba(10,11,13,.35); }+.tr-row .br i.v::before, .tr-row .br i.t::before { content:''; position:absolute; left:6px; top:0; bottom:0; width:1px; background:var(--trl); }+.tr-row .br i.l::before { content:''; position:absolute; left:6px; top:0; height:12px; width:1px; background:var(--trl); }+.tr-row .br i.t::after, .tr-row .br i.l::after { content:''; position:absolute; left:6px; right:0; top:12px; height:1px; background:var(--trl); }+.tr-row .br i.h::after { content:''; position:absolute; left:0; right:3px; top:12px; height:1px; background:var(--trl); }+.tr-row .chev { width:14px; height:22px; display:flex; align-items:center; justify-content:center; color:var(--tx2); flex-shrink:0; }+/* Knöpfe immer zu sehen, aber leise. Hell ist nur, was gerade wirkt: ausgeblendet oder transparent (orange) */+.tr-row .tg { width:20px; height:22px; display:flex; align-items:center; justify-content:center; border-radius:5px; color:var(--tx2); opacity:.6; flex-shrink:0; }+.tr-row .tg:hover { background:rgba(255,255,255,.12); color:var(--tx); }+.tr-row .tg.gh { margin-right:5px; }+.tr-row .tg.eye.on { opacity:1; color:var(--tx); }+.tr-row .tg.gh.on { opacity:1; color:var(--acc-tx); }+.tr-row .tg.gh.partly { opacity:.8; color:var(--acc-tx); } /* nur ein Teil der Gruppe ist transparent */+.tr-row .nm { overflow:hidden; text-overflow:ellipsis; min-width:0; text-align:left; height:22px; }+.tr-row.gr .nm { font-weight:500; }+.tr-row .cnt { margin-left:6px; color:var(--tx2); font-size:12px; }+.tr-row.off .nm { color:var(--tx3); }+.tr-row.sel .nm { color:var(--acc-tx); font-weight:500; }+.tr-hint { padding:4px 8px; color:var(--tx2); }+.tr-ft { display:flex; align-items:center; gap:6px; height:26px; flex-shrink:0; padding:0 4px; font-size:12px; color:var(--tx2); }+.tr-ft button { margin-left:auto; height:22px; padding:0 8px; border-radius:5px; color:var(--acc-tx); }+.tr-ft button:hover { background:rgba(255,255,255,.09); }.sw { width:10px; height:10px; border-radius:3px; flex-shrink:0; display:inline-block; box-shadow:inset 0 0 0 1px rgba(255,255,255,.18); }-.sw.ref { background:transparent !important; border:1px dashed var(--tx3); box-shadow:none; }-.grp { padding:12px 16px 4px; font-size:11px; letter-spacing:.06em; color:var(--tx3); }-.ptree .hint { color:var(--tx3); padding:8px 14px; }-/* Obere Reihe (Entwurf 2): links der Umschalter (was der Viewer zeigt), in der Mitte die Werkzeuge, rechts Platz für den Würfel */+/* Obere Reihe (Entwurf 2, E82): links Platz für den Baum, in der Mitte die Werkzeuge, rechts Platz für den Würfel */.vtop { position:absolute; left:12px; right:12px; top:12px; z-index:3; display:flex; align-items:flex-start; gap:12px; pointer-events:none; }.vtop > * { pointer-events:auto; }.vtop > .float { position:relative; }.vtop .cubespace { width:120px; flex-shrink:0; pointer-events:none; }-.switcher { display:flex; align-items:center; height:40px; padding:0 4px 0 0; white-space:nowrap; min-width:0; }-.switcher .sb { display:flex; align-items:center; gap:8px; height:38px; padding:0 10px 0 12px; border-radius:9px; min-width:0; }-.switcher .sb:hover, .switcher .sb[aria-expanded=true] { background:var(--s3); }-.switcher .sb b { overflow:hidden; text-overflow:ellipsis; max-width:220px; }-.switcher.result .sb b { min-width:64px; }-.switcher .vico { color:var(--tx2); display:flex; }-.switcher.result .vico { color:var(--acc-tx); }-.switcher.vio { border-color:rgba(154,166,255,.55); background:rgba(26,28,42,.97); }-.switcher.vio .vico { color:var(--vio); }-.switcher .vs { width:1px; height:18px; background:var(--line2); margin:0 2px; }-.newbadge { display:flex; align-items:center; gap:5px; height:20px; padding:0 8px; border-radius:10px; background:var(--acc-tint); color:var(--acc-tx); font-size:11px; font-weight:500; }-.newbadge::before { content:''; width:6px; height:6px; border-radius:50%; background:var(--acc); }-@container viewer (max-width: 620px) { .switcher #view-sub { display:none; } }+.vtop .treespace { flex-shrink:0; pointer-events:none; }.dock { display:flex; align-items:center; gap:2px; padding:4px; }.dock button { display:flex; align-items:center; gap:7px; height:32px; padding:0 10px; border-radius:7px; white-space:nowrap; }.dock button:hover:not(:disabled), .dock button[aria-expanded=true] { background:var(--s3); }.dock button:disabled { color:#5d6671; }.vsep { width:1px; height:20px; background:var(--line2); margin:0 3px; flex-shrink:0; }@container viewer (max-width: 720px) { .dock .lbl { display:none; } .dock button { padding:0 8px; gap:3px; } }+/* Neben dem aufgeklappten Baum wird es eng: nur Symbole (main.ts fitDock) */+.dock.compact .lbl { display:none; }+.dock.compact button { padding:0 9px; gap:3px; }.cube { position:absolute; top:12px; right:14px; z-index:2; display:flex; flex-direction:column; align-items:center; gap:8px; }.cube-view { width:116px; height:116px; }@@ -512,6 +547,9 @@ code { font-family:var(--mono); font-size:.95em; }.mc-ent b { color:var(--acc-tx); }.mc-ent span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }.v-overlay { position:absolute; inset:0; pointer-events:none; z-index:1; overflow:hidden; }+/* Rahmenauswahl (Alt + links ziehen): durchgezogen von links nach rechts (ganz darin), gestrichelt von rechts nach links (angeschnitten) */+.v-box { position:absolute; z-index:2; pointer-events:none; border:1px solid var(--acc); background:rgba(242,154,56,.08); }+.v-box.cross { border-style:dashed; background:rgba(242,154,56,.05); }/* Schnitt: Karte im Stapel unten links */.sectcard { overflow:hidden; }@@ -539,10 +577,10 @@ code { font-family:var(--mono); font-size:.95em; }.peek .ph { display:flex; justify-content:space-between; gap:10px; padding:0 10px 3px; font-size:11px; color:var(--tx3); }.sc-actions { display:flex; flex-wrap:wrap; gap:8px; padding:10px; }.sc-actions .btn { flex:1 1 auto; justify-content:center; }-/* Sehr schmaler Viewer (Dateien, Code und Agent offen): Umschalter und Werkzeuge links untereinander, der Würfel behält seinen Platz */+/* Sehr schmaler Viewer (Dateien, Code und Agent offen): die Werkzeuge untereinander links neben dem Würfel, links bleibt der Baum */@container viewer (max-width: 560px) {- .vtop { flex-direction:column; align-items:flex-start; gap:8px; right:auto; }- .vtop > .grow, .vtop .cubespace { display:none; }+ .vtop { flex-direction:column; align-items:flex-end; gap:8px; left:auto; right:142px; }+ .vtop > .grow, .vtop .cubespace, .vtop .treespace { display:none; }.vtop .dock { flex-direction:column; padding:3px; }.vtop .dock .vsep { width:20px; height:1px; margin:3px 0; }}@@ -578,38 +616,168 @@ code { font-family:var(--mono); font-size:.95em; }.v-paint { pointer-events:none; }/* Karten unten links statt der Auswahlkarte (wie beim Messen). Klicks wählen weiter Bauteile. */#viewer.animating #selcard, #viewer.analyzing #selcard { display:none; }-.ancard { overflow:hidden; }-.rscard { overflow:hidden; }-.an-select { flex:1; min-width:0; height:26px; margin-left:4px; padding:0 6px; border-radius:6px; border:1px solid var(--line2); background:var(--term); color:var(--tx); font:inherit; font-size:12.5px; }-.an-select:disabled { opacity:1; border-color:transparent; background:transparent; appearance:none; padding-left:2px; color:var(--tx2); }-.an-transport { display:flex; align-items:center; gap:8px; padding:2px 12px 4px 8px; }-.an-transport input[type=range], .vv-bar input[type=range] { flex:1; min-width:0; accent-color:var(--acc); height:18px; }-.an-play { width:32px; height:32px; border-radius:8px; background:var(--acc-tint); color:var(--acc-tx); display:flex; align-items:center; justify-content:center; }-.an-play:disabled { background:transparent; color:#5d6671; }.an-time { font:12px var(--mono); color:var(--tx2); white-space:nowrap; min-width:92px; text-align:right; }-.an-opts { display:flex; align-items:center; gap:6px; padding:2px 12px 4px; }-.an-opts .btn[aria-pressed=true] { background:var(--acc-tint); color:var(--acc-tx); border-color:var(--acc-line); }-.an-speed { height:26px; padding:0 4px; border-radius:6px; border:1px solid var(--line2); background:var(--term); color:var(--tx); font:12px var(--mono); }-.rs-legend { padding:2px 14px 6px; }-.rs-q { font-size:12px; color:var(--tx2); margin-bottom:5px; }-.rs-bar { position:relative; height:12px; border-radius:3px; }-.rs-mark { position:absolute; top:-3px; bottom:-3px; width:2px; margin-left:-1px; background:var(--tx); border-radius:1px; }-.rs-scale { display:flex; justify-content:space-between; gap:8px; margin-top:4px; font:11px var(--mono); color:var(--tx3); }-.rs-scale .rs-thr { color:var(--tx2); font-family:var(--sans); }-.rs-summary { padding:2px 0 2px; max-height:120px; overflow:auto; }-.rs-row { display:flex; gap:8px; padding:2px 14px; font-size:12px; color:var(--tx2); min-width:0; }-.rs-row b { color:var(--tx); font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:40%; }-.rs-row span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }-.rs-row.bad span { color:var(--err); }-/* FEM (E65): Lastfall in Blau wie die Markierungen im Bild, Hinweise umbrechend und leiser */-.rs-fem select { font-family:var(--sans); }-.rs-opts { flex-wrap:wrap; row-gap:6px; }-.rs-custom { display:flex; align-items:center; gap:4px; font-size:12px; color:var(--tx3); }-.rs-num { width:64px; }-.rs-num.bad { border-color:var(--err); }-.rs-row.bc b { color:var(--mk-blue); font-weight:500; }-.rs-note { padding:2px 14px; font-size:11.5px; line-height:1.35; color:var(--tx3); }-.rs-probe { margin:4px 12px 2px; padding:6px 8px; border-radius:6px; background:var(--term); font-size:12px; color:var(--tx2); min-height:28px; }+.vv-bar input[type=range] { flex:1; min-width:0; accent-color:var(--acc); height:18px; }++/* Im Bild (E82): Legende senkrecht am rechten Rand unter dem Würfel, Darstellung und Abspielen in einer Leiste unten.+ Beschriftungen (Kraft, kleinster Wert) stehen an ihrem Punkt im Raum. */+/* Schmal (E82, Wunsch des Nutzers): Kopf kurz, Verlauf mit drei Zahlen und dem Grenzwert, darunter nichts. Die Skala stellt der+ Knopf unter dem Kopf ein (Menü #menu-scale mit Größe ausgeschrieben, Spanne, eigenen Grenzen und was die Farben heißen). */+/* Unten rechts über der Leiste der Analyse, damit die Mitte des Bilds frei bleibt (Wunsch des Nutzers) */+.lg { right:14px; bottom:66px; width:auto; padding:8px 8px 10px; z-index:3; display:flex; flex-direction:column; align-items:stretch; }+.lg-hd { font-weight:500; font-size:12px; text-align:center; max-width:76px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }+.lg-sub { display:flex; align-items:center; justify-content:center; gap:2px; height:22px; margin:5px 0 10px; padding:0 4px 0 6px; border:1px solid var(--line2);+ border-radius:5px; background:var(--term); color:var(--tx2); font-size:11px; white-space:nowrap; }+.lg-sub:hover, .lg-sub[aria-expanded=true] { border-color:var(--acc-line); color:var(--acc-tx); }+.lg-body { position:relative; width:58px; height:160px; }+.lg-bar { position:absolute; left:2px; top:0; width:10px; height:100%; border-radius:3px; box-shadow:inset 0 0 0 1px rgba(255,255,255,.08); }+.lg-t { position:absolute; left:18px; transform:translateY(-50%); font-size:11px; color:var(--tx3); white-space:nowrap; font-variant-numeric:tabular-nums; }+.lg-thr { position:absolute; left:-2px; right:0; height:0; }+.lg-thr i { position:absolute; left:0; top:-1px; width:18px; height:2px; border-radius:1px; background:#f4f5f6; box-shadow:0 0 0 1px rgba(0,0,0,.4); }+.lg-thr span { position:absolute; left:20px; top:-8px; font-size:11.5px; font-weight:600; color:var(--tx); white-space:nowrap; }+.scalemenu { width:250px; }+.scalemenu .sm-q { padding:0 10px 8px; font-weight:500; }+.scalemenu .seg { margin:0 6px 8px; }+.scalemenu .seg button[aria-checked=true] { background:var(--acc-tint); color:var(--acc-tx); }+.scalemenu .rs-custom { display:flex; align-items:center; gap:6px; margin:0 10px 8px; font-size:12px; color:var(--tx3); }+.scalemenu .rs-num { width:80px; height:26px; padding:0 6px; border-radius:5px; border:1px solid var(--line2); background:var(--term); color:var(--tx); font:12px var(--mono); }+.scalemenu .rs-num.bad { border-color:var(--err); }+@container viewer (max-height: 520px) { .lg-body { height:100px; } }+.dbar { left:50%; bottom:14px; transform:translateX(-50%); display:flex; align-items:center; gap:8px; padding:5px 6px 5px 8px; white-space:nowrap; z-index:3; max-width:calc(100% - 24px); }+.dbar .dl { font-size:12px; color:var(--tx3); margin-left:2px; }+.dbar .dl.strong { color:var(--tx); font-size:12.5px; max-width:280px; overflow:hidden; text-overflow:ellipsis; }+.dbar .seg { display:flex; margin:0; padding:0; gap:0; border:1px solid var(--line2); border-radius:7px; overflow:hidden; flex-shrink:0; background:none; }+.dbar .seg button { flex:none; height:28px; padding:0 10px; font-size:12px; font-weight:400; color:var(--tx2); border-radius:0; box-shadow:none; }+.dbar .seg button + button { border-left:1px solid var(--line2); }+.dbar .seg button:hover { background:var(--s3); color:var(--tx); }+.dbar .seg button.on { background:var(--acc-tint); color:var(--acc-tx); font-weight:500; }+.tgl { display:flex; align-items:center; gap:6px; height:30px; padding:0 10px; border-radius:7px; font-size:12px; color:var(--tx2); border:1px solid var(--line2); white-space:nowrap; flex-shrink:0; }+.tgl:hover:not(:disabled) { background:var(--s3); color:var(--tx); }+.tgl[aria-pressed=true] { background:var(--acc-tint); color:var(--acc-tx); border-color:var(--acc-line); font-weight:500; }+.tgl:disabled { color:#5d6671; }+.c3d { position:absolute; left:0; top:0; display:flex; align-items:center; gap:6px; height:24px; margin:-12px 0 0 14px; padding:0 9px 0 8px; border-radius:12px;+ background:rgba(18,20,23,.92); border:1px solid var(--line2); font-size:12px; color:var(--tx2); white-space:nowrap; font-variant-numeric:tabular-nums; }+.c3d b { font-weight:500; color:var(--tx); }+.c3d svg.ic { color:var(--mk-blue); }+.c3d .dot { width:6px; height:6px; }+.c3d.pt { margin:-34px 0 0 10px; }+.c3d.pt::before { content:''; position:absolute; left:-10px; top:22px; width:7px; height:7px; border-radius:50%; border:1.8px solid #fff; box-shadow:0 0 0 1px rgba(0,0,0,.5); }+.tbar { left:16px; right:16px; bottom:14px; display:flex; align-items:center; gap:10px; padding:5px 8px 5px 5px; z-index:3; font-variant-numeric:tabular-nums; }+.tbar .play { width:32px; height:32px; border-radius:7px; background:var(--s3); color:var(--tx); display:flex; align-items:center; justify-content:center; flex-shrink:0; }+.tbar .play:hover:not(:disabled) { background:#2c323b; }+.tbar .play:disabled { color:#5d6671; background:transparent; }+.tbar .tm { font-size:12px; color:var(--tx2); white-space:nowrap; min-width:38px; }+.tbar .scrub { position:relative; flex:1; height:24px; min-width:120px; }+.tbar .scrub input { position:absolute; inset:0; width:100%; margin:0; appearance:none; background:transparent; cursor:pointer; z-index:1; }+.tbar .scrub input::-webkit-slider-runnable-track { height:3px; border-radius:2px; background:linear-gradient(to right, var(--acc) var(--done, 0%), var(--line2) var(--done, 0%)); }+.tbar .scrub input::-webkit-slider-thumb { appearance:none; width:13px; height:13px; margin-top:-5px; border-radius:50%; background:#f4f5f6; box-shadow:0 0 0 3px rgba(242,154,56,.3); }+.tbar .scrub input:disabled { cursor:default; }+.tbar .ticks { position:absolute; left:6px; right:6px; top:0; bottom:0; pointer-events:none; }+.tbar .ticks .cm { position:absolute; top:7px; width:2px; height:11px; margin-left:-1px; border-radius:1px; background:#5d6671; }+.tbar .sel { height:28px; padding:0 4px 0 6px; border:1px solid var(--line2); border-radius:6px; background:var(--term); color:var(--tx2); font:12px var(--sans); }+@container viewer (max-width: 760px) { .tbar .tgl { padding:0 8px; font-size:0; gap:0; } .tbar .tgl svg.ic { margin:0; } }+/* Unten liegen die Leisten der Analyse und Animation: Karten (Messen, Schnitt, Auswahl) rücken darüber */+#viewer.analyzing .cards, #viewer.animating .cards { bottom:66px; }++/* ---- Reiter Analysis und Animation (E82): Liste und ruhiger Bericht ------------------------------------------ */+.cx { font-variant-numeric:tabular-nums; }+.side-hd .back { display:flex; align-items:center; gap:5px; height:28px; padding:0 8px 0 4px; margin-left:-10px; border-radius:6px; color:var(--tx2); font-weight:500; }+.side-hd .back:hover { background:var(--s3); color:var(--tx); }+.side-hd .back .cnt { margin-left:2px; color:var(--tx3); font-weight:400; }+.al { flex:1; overflow:auto; padding:6px 0 12px; }+.al-sh { display:flex; align-items:center; gap:6px; height:30px; padding:8px 14px 0 18px; font-size:11px; letter-spacing:.07em; color:var(--tx3); }+.al-sh .cnt { letter-spacing:0; }+.al-sh .r { margin-left:auto; letter-spacing:0; font:11px var(--mono); }+.al-row { display:grid; grid-template-columns:8px 1fr auto; align-items:start; gap:0 12px; width:calc(100% - 12px); margin:0 6px; padding:9px 10px 9px 12px; border-radius:7px; text-align:left; }+.al-row:hover { background:var(--s3); }+.al-row .dot { width:7px; height:7px; margin-top:6px; }+.al-row .ic { color:var(--tx3); margin-top:2px; margin-left:-4px; display:flex; }+.al-row .t { font-size:13px; line-height:1.35; color:var(--tx); overflow-wrap:anywhere; }+.al-row .m { font-size:12px; color:var(--tx3); margin-top:2px; }+.al-row .m .w { color:var(--warn); }+.al-row .tag { margin-left:2px; }+.al-row .v { text-align:right; font-size:13px; color:var(--tx); white-space:nowrap; }+.al-row .v span { display:block; font-size:12px; color:var(--tx3); margin-top:2px; }+.al-row.cur { background:var(--acc-tint); }+.al-row.ic3 { grid-template-columns:16px 1fr auto; }+.al-empty { padding:10px 18px 2px; color:var(--tx2); }+.al-err { display:flex; gap:8px; margin:6px 18px; font-size:12px; line-height:1.4; color:var(--tx2); }+.al-err svg.ic { color:var(--warn); margin-top:1px; }+.al-note { margin:10px 18px 0; padding-top:12px; border-top:1px solid var(--line); font-size:12px; line-height:1.45; color:var(--tx3); }+.cx-scroll { flex:1; min-height:0; overflow:auto; }+.cx-head { padding:16px 18px 0; }+.cx-title { margin:0; font-size:14px; line-height:1.35; font-weight:600; color:var(--tx); overflow-wrap:anywhere; }+.cx-meta { margin-top:3px; font-size:12px; color:var(--tx3); }+.cx-meta .w { color:var(--warn); }+.cx-gap { height:14px; }+.cx-sum { padding:18px 18px 16px; }+.cx-num { display:flex; align-items:center; gap:12px; }+.cx-num .n { font-size:30px; line-height:1; font-weight:500; color:var(--tx); letter-spacing:-.01em; white-space:nowrap; }+.cx-num .n small { font-size:14px; color:var(--tx2); margin-left:3px; font-weight:400; letter-spacing:0; }+.cx-num .t { font-size:12.5px; line-height:1.35; color:var(--tx2); }+.cx-num .t span { color:var(--tx3); }+.cx-dim .cx-num, .cx-dim .cx-st, .cx-dim .cx-pr { opacity:.45; }+.cx-st { display:flex; align-items:center; gap:8px; margin-top:12px; font-size:13px; color:var(--tx); }+.cx-st svg.bad { color:var(--err); } .cx-st svg.ok { color:var(--ok); }+.cx-pr { display:flex; align-items:center; gap:9px; height:28px; margin:0 -8px; padding:0 4px 0 30px; border-radius:6px; font-size:12.5px; color:var(--tx2); cursor:pointer; }+.cx-pr .dot { width:6px; height:6px; }+.cx-pr .nm { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; }+.cx-pr .a { color:var(--tx3); margin-left:auto; white-space:nowrap; }+.cx-pr .v { color:var(--tx); min-width:36px; text-align:right; }+.cx-pr .go { width:22px; height:22px; display:flex; align-items:center; justify-content:center; color:var(--tx3); visibility:hidden; border-radius:5px; }+.cx-pr:hover { background:var(--s3); } .cx-pr:hover .go, .cx-pr .go:focus-visible { visibility:visible; color:var(--tx); }+.cx-warn { display:flex; gap:8px; align-items:flex-start; margin-top:10px; font-size:12px; line-height:1.4; color:var(--tx2); }+.cx-warn svg.ic { color:var(--warn); margin-top:1px; }+.cx-warn .lnk { color:var(--tx3); border-bottom:1px dotted var(--tx3); font-size:12px; }+.cx-warn .lnk:hover { color:var(--tx); }+.cx-line { display:flex; gap:8px; align-items:center; margin:14px 18px 0; font-size:12px; line-height:1.4; color:var(--tx2); }+.cx-line svg.ic { color:var(--warn); flex-shrink:0; }+.cx-line.info svg.ic { color:var(--tx3); }+.cx-line button { margin-left:auto; color:var(--acc-tx); font-size:12px; white-space:nowrap; }+.cx-prog { position:relative; height:2px; margin:14px 18px 0; background:var(--s3); border-radius:1px; overflow:hidden; }+.cx-prog i { position:absolute; top:0; bottom:0; width:35%; background:var(--acc); animation:vb-run 1.4s ease-in-out infinite; }+.cx-sec { border-top:1px solid var(--line); padding:4px 0 8px; }+.cx-sh { display:flex; align-items:center; gap:6px; height:32px; padding:0 14px 0 18px; font-size:11px; letter-spacing:.07em; color:var(--tx3); }+.cx-sh .r { margin-left:auto; letter-spacing:0; font-size:12px; }+.cx-sh .cnt { letter-spacing:0; }+.cx-row { display:grid; grid-template-columns:64px 1fr 14px; align-items:center; gap:10px; width:calc(100% - 12px); min-height:30px; margin:0 6px; padding:0 8px 0 12px; border-radius:6px; font-size:13px; text-align:left; }+.cx-row:hover { background:var(--s3); }+.cx-row .l { color:var(--tx3); font-size:12.5px; }+.cx-row .v { color:var(--tx); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }+.cx-row .v span { color:var(--tx3); }+.cx-row .ch { color:var(--tx3); display:flex; transition:transform .1s; }+.cx-row.open .ch { transform:rotate(90deg); }+.cx-det { display:grid; grid-template-columns:auto 1fr; gap:5px 14px; margin:2px 18px 10px 92px; font-size:12px; color:var(--tx2); }+.cx-det.wide { margin-left:36px; }+.cx-det dt { color:var(--tx3); } .cx-det dd { margin:0; overflow-wrap:anywhere; }+.cx-det .okc { color:var(--ok); } .cx-det .wc { color:var(--warn); }+.cx-det .sub { grid-column:1 / -1; color:var(--tx); margin-top:4px; }+.cx-det .sub span { color:var(--tx3); }+.cx-tbl { width:calc(100% - 36px); margin:0 18px; border-collapse:collapse; font-size:12.5px; table-layout:fixed; }+.cx-tbl th { font-weight:400; font-size:11.5px; color:var(--tx3); text-align:right; padding:0 0 6px 8px; white-space:nowrap; }+.cx-tbl th.l { text-align:left; padding-left:0; width:46%; }+.cx-tbl td { height:28px; padding:0 0 0 8px; text-align:right; color:var(--tx2); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }+.cx-tbl td.nm { text-align:left; padding-left:0; color:var(--tx); }+.cx-tbl td.nm .dot { width:6px; height:6px; margin-right:8px; vertical-align:1px; }+.cx-fold { display:flex; align-items:center; gap:6px; width:100%; height:36px; padding:0 14px 0 18px; border-top:1px solid var(--line); font-size:11px; letter-spacing:.07em; color:var(--tx3); text-align:left; }+.cx-fold:hover { color:var(--tx2); }+.cx-fold .chev { display:flex; }+.cx-fold .r { margin-left:auto; letter-spacing:0; font-size:12px; }+.cx-p { display:flex; gap:9px; margin:2px 18px 10px; font-size:12px; line-height:1.45; color:var(--tx2); }+.cx-p svg.ic { margin-top:2px; }+.cx-p.w svg.ic { color:var(--warn); } .cx-p.i svg.ic { color:var(--tx3); }+.cx-empty { padding:2px 18px 6px; font-size:12px; color:var(--tx3); }+.cx-foot { border-top:1px solid var(--line); flex-shrink:0; background:var(--s1); }+.cx-pick { padding:10px 14px 0; font-size:12px; line-height:1.4; color:var(--tx2); overflow-wrap:anywhere; }+.cx-acts { display:flex; gap:8px; padding:12px; }+.cx-acts .btn { flex:1; justify-content:center; }+.cx-seq { display:grid; grid-template-columns:44px 1fr; align-items:center; gap:10px; width:calc(100% - 12px); min-height:30px; margin:0 6px; padding:4px 10px 4px 12px; border-radius:6px; font-size:13px; color:var(--tx2); text-align:left; }+.cx-seq:hover { background:var(--s3); }+.cx-seq .t { font-size:12px; color:var(--tx3); }+.cx-seq.cur { background:var(--acc-tint); color:var(--tx); } .cx-seq.cur .t { color:var(--acc-tx); }+.cx-file { display:grid; grid-template-columns:16px 1fr auto; align-items:center; gap:10px; width:calc(100% - 12px); height:30px; margin:0 6px; padding:0 10px 0 12px; border-radius:6px; font-size:13px; color:var(--tx); text-align:left; }+.cx-file:hover { background:var(--s3); }+.cx-file svg.ic { color:var(--tx3); } .cx-file .s { font-size:12px; color:var(--tx3); }/* Fadenkreuz über dem Bild wie beim Messen (dort setzt der Viewer es selbst auf die 3D-Fläche). Karten und Knöpfe behalten ihren Zeiger. */#viewer.analyzing > canvas { cursor:crosshair; }/* Schild am Zeiger: wie die Messbeschriftung (.v-label), aber neutral, denn Orange hieße Auswahl. Unter den Karten, Klicks gehen durch. */@@ -711,11 +879,6 @@ code { font-family:var(--mono); font-size:.95em; }.mi .k { margin-left:auto; padding-left:16px; color:var(--tx3); font-size:12px; }.mi .sub { color:var(--tx3); font-size:12px; overflow:hidden; text-overflow:ellipsis; }.mi.cur span:nth-child(2) { color:var(--acc-tx); }-#menu-view { width:360px; max-width:360px; }-#menu-view .vl { overflow:hidden; text-overflow:ellipsis; }-#menu-view .k { display:flex; align-items:center; gap:6px; }-#menu-view .k .dot { width:7px; height:7px; }-.mh .src { margin-left:6px; font-family:var(--mono); letter-spacing:0; }.mi .tag { font-size:10.5px; padding:1px 6px; border-radius:4px; }.tag.acc { background:var(--acc-tint); color:var(--acc-tx); }.mi .chk { width:15px; display:flex; color:var(--acc-tx); visibility:hidden; }@@ -873,6 +1036,12 @@ code { font-family:var(--mono); font-size:.95em; }.st-h2 { margin:0; font-size:16px; font-weight:600; color:var(--tx); }.st-lead { margin:4px 0 0; color:var(--tx3); font-size:12.5px; line-height:1.5; }.st-group { margin-top:26px; }+/* Reiter Shortcuts: Tasten links als Kappen, rechts was sie tun */+.st-key { display:grid; grid-template-columns:220px 1fr; gap:16px; align-items:baseline; padding:8px 0; border-bottom:1px solid var(--line); font-size:12.5px; }+.st-kk { display:flex; flex-wrap:wrap; align-items:center; gap:4px; }+.st-kk kbd { display:inline-flex; align-items:center; height:22px; padding:0 7px; border:1px solid var(--line2); border-bottom-width:2px; border-radius:5px; background:var(--s2); color:var(--tx); font:12px var(--sans); white-space:nowrap; }+.st-kk .plus { color:var(--tx3); font-size:11px; }+.st-kw { color:var(--tx2); line-height:1.45; }.st-gh { font-size:11px; letter-spacing:.06em; text-transform:uppercase; color:var(--tx3); padding-bottom:6px; border-bottom:1px solid var(--line); }.st-field { display:flex; align-items:flex-start; gap:28px; padding:12px 0; border-bottom:1px solid var(--line); }.st-fl { flex:1; min-width:0; display:flex; flex-direction:column; gap:3px; }diff --git a/app/src/renderer/tree.ts b/app/src/renderer/tree.tsnew file mode 100644index 0000000..1fb45ab--- /dev/null+++ b/app/src/renderer/tree.ts@@ -0,0 +1,316 @@+import { icon } from './icons';+import { el } from './ui';++/** `group`: Pfad der Gruppe mit „/“, z. B. „Gehäuse/Schrauben“, oder null. */+export interface PartRow { id: string; name: string; role: string; color: string; group: string | null }++/** Klick auf einen Namen: allein auswählen, mit Strg dazu oder heraus, mit Shift den Bereich bis hierher (`ids`). */+export type TreeSelect = { how: 'replace' | 'toggle'; id: string } | { how: 'range'; id: string; ids: string[] };++interface Hooks {+ select(s: TreeSelect): void;+ setVisible(ids: string[], on: boolean): void;+ isVisible(id: string): boolean;+ setGhost(ids: string[], on: boolean): void;+ isGhost(id: string): boolean;+ showAll(): void;+ context(id: string, x: number, y: number): void;+ groupContext(ids: string[], name: string, x: number, y: number): void;+ /** Auf- oder zugeklappt: Die Werkzeuge oben in der Mitte rücken zur Seite oder zeigen nur Symbole. */+ resized(): void;+}++/** Gruppe im Baum. `items` in der Reihenfolge, in der sie im Modell zuerst vorkommen (Gruppen und Teile gemischt). */+interface GroupNode { key: string; name: string; items: ({ group: GroupNode } | { part: PartRow })[] }++/** Schlüssel der Gruppe der Referenzen (E34). Sie steht am Ende. */+const REFS = 'ref';++/**+ * Strukturbaum ganz oben links im Viewer (E82, wie in CATIA): ohne Hintergrund, nur Schrift, Striche und Symbole mit dunklem+ * Rand. Eingeklappt steht nur der Name des Modells da, aufgeklappt die Gruppen und Teile mit Baumstrichen und direkt vor jedem+ * Namen Auge (ausblenden) und Halbkreis (transparent). Derselbe Baum gilt in Modell, Analyse und Animation, der Zustand+ * (aus- und eingeblendet, transparent) liegt im Viewer und bleibt beim Wechsel. Mehrfachauswahl mit Strg und Shift wie im+ * Viewer. Mit gedrückter Maus über die Augen (oder Halbkreise) fahren schaltet alle überfahrenen Zeilen gleich (wie die Ebenen+ * in Photoshop), so blendet man mehrere Teile aus, ohne die ganze Gruppe.+ */+export class StructureTree {+ private parts: PartRow[] = [];+ /** Nur diese Teile zeigen (Analyse: die gerechneten Körper), null: alle. */+ private only: Set<string> | null = null;+ private selected = new Set<string>();+ /** Zuletzt ohne Shift angeklicktes Teil: Anfang eines Bereichs mit Shift-Klick. */+ private anchor: string | null = null;+ /** Ziehen über Augen oder Halbkreise: welche Spalte, welcher Zustand, welche Zeilen schon geschaltet sind. */+ private painting: { kind: 'eye' | 'gh'; on: boolean; done: Set<string> } | null = null;+ private open = false;+ private searching = false;+ private filter = '';+ private placeholder = '';+ private title = '';+ /**+ * Aufgeklappte Gruppen. Alle beginnen zugeklappt: Aufklappen zeigt eine Ebene, die nächste öffnet der Nutzer bei Bedarf+ * (bei großen Baugruppen sähe man sonst alles auf einmal).+ */+ private expanded = new Set<string>();+ private readonly head = el('div', { className: 'tr-hd' });+ private readonly search = el('div', { className: 'tr-search', hidden: true });+ private readonly input = el('input', { type: 'search', placeholder: 'Search part', ariaLabel: 'Search part', spellcheck: false });+ private readonly hits = el('span', { className: 'tr-hits' });+ private readonly rowsEl = el('div', { className: 'tr-rows', role: 'tree' });+ private readonly foot = el('div', { className: 'tr-ft', hidden: true });++ constructor(private readonly root: HTMLElement, private readonly hooks: Hooks) {+ const clear = el('button', { className: 'hb', title: 'Close the search (Escape)', ariaLabel: 'Close the search' }, icon('x', 13, 2));+ clear.addEventListener('click', () => this.setSearching(false));+ this.search.append(icon('search', 14, 1.9), this.input, this.hits, clear);+ this.input.addEventListener('input', () => { this.filter = this.input.value.trim().toLowerCase(); this.render(); });+ this.input.addEventListener('keydown', (e) => { if (e.key === 'Escape') { e.stopPropagation(); this.setSearching(false); } });+ root.replaceChildren(this.head, this.search, this.rowsEl, this.foot);+ window.addEventListener('pointerup', () => { this.painting = null; });+ window.addEventListener('pointercancel', () => { this.painting = null; });+ this.render();+ }++ /** Name des Modells in der obersten Zeile. */+ setTitle(name: string): void { this.title = name; this.render(); }++ /** Hinweis statt Liste, z. B. während des ersten Builds. */+ message(text: string): void { this.placeholder = text; this.parts = []; this.render(); }++ set(parts: PartRow[], selected: string[]): void { this.parts = parts; this.selected = new Set(selected); this.placeholder = ''; this.render(); }++ /** Auswahl im Modell: Zeilen markieren, bei zugeklappter Gruppe die Gruppe, und die erste in den sichtbaren Bereich holen. */+ select(ids: string[]): void {+ this.selected = new Set(ids);+ if (ids.length === 1) this.anchor = ids[0];+ this.render();+ this.rowsEl.querySelector<HTMLElement>('.tr-row.sel')?.scrollIntoView({ block: 'nearest' });+ }++ /** Nur die Teile mit diesen Namen zeigen (null: alle). */+ limit(names: string[] | null): void { this.only = names ? new Set(names) : null; this.render(); }++ get isOpen(): boolean { return this.open; }++ setOpen(on: boolean): void {+ if (on === this.open) return;+ this.open = on;+ if (!on) this.setSearching(false, false);+ this.render();+ this.hooks.resized();+ }++ /** Namen aller gezeigten Teile in der Reihenfolge des Baums, auch zugeklappt (Prüfhilfe und Tests). */+ names(): string[] { return this.shown().map((p) => p.name); }++ private shown(): PartRow[] {+ const own = this.parts.filter((p) => p.role !== 'reference' && (!this.only || this.only.has(p.name)));+ const refs = this.parts.filter((p) => p.role === 'reference' && (!this.only || this.only.has(p.name)));+ return [...StructureTree.flat(StructureTree.build('own', own)), ...StructureTree.flat(StructureTree.build(REFS, refs))];+ }++ private setSearching(on: boolean, render = true): void {+ this.searching = on;+ this.search.hidden = !on;+ this.head.hidden = on;+ if (!on) { this.input.value = ''; this.filter = ''; }+ if (render) this.render();+ if (on) this.input.focus();+ }++ render(): void {+ const shown = this.parts.filter((p) => !this.only || this.only.has(p.name));+ const hidden = shown.filter((p) => !this.hooks.isVisible(p.id)).length;+ this.root.classList.toggle('open', this.open);+ this.renderHead(shown.length, hidden);+ this.rowsEl.hidden = !this.open;+ this.foot.hidden = !this.open || !hidden;+ if (!this.open) return;+ const showAll = el('button', { textContent: 'Show all', title: 'Show all hidden parts again' });+ showAll.addEventListener('click', () => { this.hooks.showAll(); this.render(); });+ this.foot.replaceChildren(icon('eyeoff', 13, 1.8), el('span', { textContent: `${hidden} hidden` }), showAll);+ if (!shown.length) {+ this.rowsEl.replaceChildren(el('div', { className: 'tr-hint', textContent: this.placeholder || 'No parts yet.' }));+ this.hits.textContent = '';+ return;+ }+ const match = (p: PartRow) => !this.filter || p.name.toLowerCase().includes(this.filter) || (p.group ?? '').toLowerCase().includes(this.filter);+ const own = StructureTree.build('own', shown.filter((p) => p.role !== 'reference' && match(p)));+ const refs = StructureTree.build(REFS, shown.filter((p) => p.role === 'reference' && match(p)));+ // Die Referenzen hängen als eigene Gruppe am Ende des Baums, statt unter einer eigenen Überschrift+ if (refs.items.length) own.items.push({ group: { ...refs, name: 'References' } });+ const rows = this.rows(own, []);+ this.hits.textContent = this.filter ? `${StructureTree.ids(own).length} of ${shown.length}` : '';+ if (!rows.length) rows.push(el('div', { className: 'tr-hint', textContent: 'No part matches the search.' }));+ this.rowsEl.replaceChildren(...rows);+ }++ private renderHead(count: number, hidden: number): void {+ const toggle = el('button', { className: 'tr-toggle', title: this.open ? 'Collapse the structure tree (F3)' : 'Show the parts of the model (F3)' },+ el('span', { className: 'chev' }, icon(this.open ? 'down' : 'right', 13, 2)), el('span', { className: 'ico' }, icon('tree', 15, 1.8)),+ el('b', { textContent: this.title || 'Model' }),+ // Eingeklappt sagt die Zeile, ob etwas ausgeblendet ist. Aufgeklappt steht es im Fuß+ !this.open && hidden ? el('span', { className: 'n', textContent: `· ${hidden} hidden` }) : null);+ toggle.setAttribute('aria-expanded', String(this.open));+ toggle.addEventListener('click', () => this.setOpen(!this.open));+ const kids: HTMLElement[] = [toggle];+ if (this.open && count) {+ const find = el('button', { className: 'hb', title: 'Search parts', ariaLabel: 'Search parts' }, icon('search', 14, 1.9));+ find.addEventListener('click', () => this.setSearching(true));+ kids.push(el('span', { className: 'sp' }), find);+ }+ this.head.replaceChildren(...kids);+ }++ private static build(key: string, parts: PartRow[]): GroupNode {+ const root: GroupNode = { key, name: '', items: [] };+ for (const p of parts) {+ let node = root;+ for (const seg of (p.group ?? '').split('/').filter(Boolean)) {+ let next = node.items.find((x): x is { group: GroupNode } => 'group' in x && x.group.name === seg)?.group;+ if (!next) { next = { key: `${node.key}/${seg}`, name: seg, items: [] }; node.items.push({ group: next }); }+ node = next;+ }+ node.items.push({ part: p });+ }+ return root;+ }++ private static flat(node: GroupNode): PartRow[] {+ return node.items.flatMap((x) => ('part' in x ? [x.part] : StructureTree.flat(x.group)));+ }++ private static ids(node: GroupNode): string[] { return StructureTree.flat(node).map((p) => p.id); }++ /** `anc`: je Ebene darüber, ob dort noch etwas folgt (dann läuft der senkrechte Strich weiter). */+ private rows(node: GroupNode, anc: boolean[]): HTMLElement[] {+ const out: HTMLElement[] = [];+ node.items.forEach((it, i) => {+ const last = i === node.items.length - 1;+ if ('part' in it) { out.push(this.row(it.part, anc, last)); return; }+ const g = it.group;+ // Beim Suchen immer aufgeklappt, sonst sähe man die Treffer nicht+ const open = !!this.filter || this.expanded.has(g.key);+ out.push(this.groupRow(g, anc, last, open));+ if (open) out.push(...this.rows(g, [...anc, !last]));+ });+ return out;+ }++ /** Baumstriche: weiterlaufende Striche der Ebenen darüber, dann der Abzweig, bei Teilen bis an die Knöpfe heran. */+ private static branches(anc: boolean[], last: boolean, part: boolean): HTMLElement {+ const br = el('span', { className: 'br' });+ for (const more of anc) br.append(el('i', { className: more ? 'v' : '' }));+ br.append(el('i', { className: last ? 'l' : 't' }));+ if (part) br.append(el('i', { className: 'h' }));+ return br;+ }++ private groupRow(g: GroupNode, anc: boolean[], last: boolean, open: boolean): HTMLElement {+ const ids = StructureTree.ids(g);+ const anyVisible = ids.some((id) => this.hooks.isVisible(id));+ const ghosts = ids.filter((id) => this.hooks.isGhost(id)).length;+ const toggle = () => { if (open) this.expanded.delete(g.key); else this.expanded.add(g.key); this.render(); };+ // Ausgewähltes Teil in der zugeklappten Gruppe: Die Gruppe trägt die Markierung+ const holdsSel = !open && ids.some((id) => this.selected.has(id));+ const chev = el('button', { className: 'chev', title: open ? 'Collapse group' : 'Expand group', ariaLabel: `${open ? 'Collapse' : 'Expand'} group ${g.name}` }, icon(open ? 'down' : 'right', 12, 2));+ chev.setAttribute('aria-expanded', String(open));+ chev.addEventListener('click', toggle);+ const name = el('button', { className: 'nm', textContent: g.name, title: open ? 'Collapse group' : 'Expand group' });+ name.addEventListener('click', toggle);+ const row = el('div', { className: 'tr-row gr' + (anyVisible ? '' : ' off') + (holdsSel ? ' sel' : '') }, StructureTree.branches(anc, last, false), chev,+ this.eyeButton(`group ${g.name}`, g.key, anyVisible, (hide) => this.hooks.setVisible(ids, !hide)),+ this.ghostButton(`group ${g.name}`, g.key, ghosts === ids.length, ghosts > 0 && ghosts < ids.length, (on) => this.hooks.setGhost(ids, on)),+ name, el('span', { className: 'cnt', textContent: String(ids.length) }));+ row.setAttribute('role', 'treeitem');+ row.dataset.group = g.key;+ row.addEventListener('contextmenu', (e) => { e.preventDefault(); this.hooks.groupContext(ids, g.name, e.clientX, e.clientY); });+ return row;+ }++ private row(p: PartRow, anc: boolean[], last: boolean): HTMLElement {+ const visible = this.hooks.isVisible(p.id);+ const ghost = this.hooks.isGhost(p.id);+ const name = el('button', { className: 'nm', textContent: p.name, title: `${p.name}: select and show the code location. Ctrl adds or removes, Shift selects a range. Right-click for more.` });+ name.addEventListener('click', (e) => this.clickName(p.id, e));+ const row = el('div', { className: 'tr-row' + (this.selected.has(p.id) ? ' sel' : '') + (visible ? '' : ' off') }, StructureTree.branches(anc, last, true),+ this.eyeButton(p.name, p.id, visible, (hide) => this.hooks.setVisible([p.id], !hide)),+ this.ghostButton(p.name, p.id, ghost, false, (on) => this.hooks.setGhost([p.id], on)), name);+ row.setAttribute('role', 'treeitem');+ row.dataset.id = p.id;+ row.addEventListener('contextmenu', (e) => { e.preventDefault(); this.hooks.context(p.id, e.clientX, e.clientY); });+ return row;+ }++ /** Klick auf einen Namen: Strg schaltet das Teil in der Auswahl um, Shift wählt die sichtbaren Teile vom letzten Klick bis hier. */+ private clickName(id: string, e: MouseEvent): void {+ if (e.shiftKey && this.anchor) {+ const order = [...this.rowsEl.querySelectorAll<HTMLElement>('.tr-row[data-id]')].map((r) => r.dataset.id!);+ const a = order.indexOf(this.anchor), b = order.indexOf(id);+ if (a >= 0 && b >= 0) { this.hooks.select({ how: 'range', id, ids: order.slice(Math.min(a, b), Math.max(a, b) + 1) }); return; }+ }+ this.anchor = id;+ this.hooks.select({ how: e.ctrlKey || e.metaKey ? 'toggle' : 'replace', id });+ }++ /**+ * Schalter für Auge und Halbkreis. Drücken schaltet die Zeile um, Weiterziehen mit gedrückter Maus schaltet jede überfahrene+ * Zeile derselben Spalte in denselben Zustand. `key`: Teil oder Gruppe (jede Zeile nur einmal je Zug). Tastatur: Klick.+ */+ private paintable(b: HTMLButtonElement, kind: 'eye' | 'gh', key: string, state: boolean, act: (on: boolean) => void): HTMLButtonElement {+ b.dataset.paint = kind;+ b.addEventListener('pointerdown', (e) => {+ if (e.button !== 0) return;+ e.preventDefault(); // kein Markieren von Text beim Ziehen+ this.painting = { kind, on: !state, done: new Set([key]) };+ act(!state);+ this.render();+ });+ b.addEventListener('pointerover', (e) => {+ const p = this.painting;+ if (!p || p.kind !== kind || p.done.has(key) || !(e.buttons & 1)) return;+ p.done.add(key);+ if (state !== p.on) { act(p.on); this.render(); }+ });+ b.addEventListener('click', (e) => { if (e.detail === 0) { act(!state); this.render(); } });+ return b;+ }++ /** Auge: hell, wenn es wirkt (ausgeblendet, durchgestrichen), sonst gedämpft. `act(true)`: ausblenden. */+ private eyeButton(what: string, key: string, visible: boolean, act: (hide: boolean) => void): HTMLButtonElement {+ const b = el('button', { className: 'tg eye' + (visible ? '' : ' on'), title: visible ? 'Hide (drag across eyes: several)' : 'Show (drag across eyes: several)' }, icon(visible ? 'eye' : 'eyeoff', 14, 1.8));+ b.setAttribute('aria-label', `${visible ? 'Hide' : 'Show'} ${what}`);+ return this.paintable(b, 'eye', key, !visible, act);+ }++ /** Transparent schalten, an: orange. `partly`: nur ein Teil der Gruppe ist transparent. */+ private ghostButton(what: string, key: string, on: boolean, partly: boolean, act: (on: boolean) => void): HTMLButtonElement {+ const b = el('button', { className: 'tg gh' + (on ? ' on' : partly ? ' partly' : ''), title: on ? 'Not transparent' : 'Make transparent' }, icon('ghost', 14, 1.8));+ b.setAttribute('aria-label', `${on ? 'Make opaque' : 'Make transparent'}: ${what}`);+ b.setAttribute('aria-pressed', String(on));+ return this.paintable(b, 'gh', key, on, act);+ }++ /** Prüfhilfe: alle Gruppen aufklappen. */+ expandAll(): void {+ const walk = (n: GroupNode) => n.items.forEach((x) => { if ('group' in x) { this.expanded.add(x.group.key); walk(x.group); } });+ walk(StructureTree.build('own', this.parts.filter((p) => p.role !== 'reference')));+ walk(StructureTree.build(REFS, this.parts.filter((p) => p.role === 'reference')));+ this.expanded.add(REFS);+ this.render();+ }++ /** Prüfhilfe: Zustand des Baums mit den Zeilen, wie sie zu sehen sind. */+ state() {+ return {+ open: this.open, searching: this.searching, title: this.title, names: this.names(),+ head: this.head.textContent, hits: this.hits.textContent, foot: this.foot.hidden ? '' : this.foot.textContent,+ rows: [...this.rowsEl.querySelectorAll<HTMLElement>('.tr-row')].map((r) => ({+ name: r.querySelector('.nm')?.textContent ?? '', group: r.classList.contains('gr'), depth: r.querySelectorAll('.br i').length - (r.classList.contains('gr') ? 1 : 2),+ hidden: r.classList.contains('off'), ghost: !!r.querySelector('.gh.on'), partly: !!r.querySelector('.gh.partly'), sel: r.classList.contains('sel'),+ count: r.querySelector('.cnt')?.textContent ?? null,+ })),+ };+ }+}diff --git a/app/src/renderer/viewer.ts b/app/src/renderer/viewer.tsindex ebd9bd0..ba03f3a 100644--- a/app/src/renderer/viewer.ts+++ b/app/src/renderer/viewer.ts@@ -153,6 +153,10 @@ export class Viewer {private wire = false;private ghost = false;private selectedId: string | null = null;+ /** Mehrfachauswahl (Strg/Shift-Klick, Rahmen, Baum): alle leuchten orange, `selectedId` ist das zuletzt gewählte. */+ private selectedIds = new Set<string>();+ /** Rahmenauswahl mit Alt + links ziehen: Startpunkt und das Rechteck im Bild. */+ private box: { x: number; y: number; el: HTMLElement; id: number } | null = null;private mode: 'select' | 'measure' = 'select';/** Hervorhebung unter dem Zeiger (Messen) und Markierungen der Messung. */private hover = new THREE.Group();@@ -162,6 +166,8 @@ export class Viewer {/** HTML-Ebene über dem Bild: Messpunkte und Beschriftung, bei jedem Zeichnen neu positioniert. */private overlay: HTMLElement;private overlayItems: { el: HTMLElement; at: THREE.Vector3 }[] = [];+ /** Beschriftungen eines Werkzeugs an Punkten im Raum (E82: Kraft und kleinster Wert einer Analyse), neben der Messung. */+ private tagItems: { el: HTMLElement; at: THREE.Vector3 }[] = [];/** Mitte und Radius aller Bauteile, für die Schnittebenen der Kamera. */private center = new THREE.Vector3();private radius = 1;@@ -200,7 +206,11 @@ export class Viewer {/** 2D-Fläche über dem Bild für Untertitel, Beschriftungen und Legende (E58). */private paint: HTMLCanvasElement;private painter: OverlayPainter | null = null;- onPick: (r: PickResult | null) => void = () => {};+ onPick: (r: PickResult | null, mods: { shift: boolean; ctrl: boolean }) => void = () => {};+ /** Rechtsklick ins Bild ohne Ziehen: Bauteil darunter (null: daneben) und die Stelle für das Menü. */+ onContext: (partId: string | null, x: number, y: number) => void = () => {};+ /** Rahmenauswahl fertig: Bauteile im Rahmen, `add` mit Shift oder Strg (zur Auswahl dazu). */+ onBox: (ids: string[], add: boolean) => void = () => {};/** Klick im Messmodus. null: daneben geklickt. */onMeasurePick: (h: ProbeHit | null) => void = () => {};/** Klick im Messmodus auf die Schnittfläche selbst (die hat keine exakte Geometrie). */@@ -297,6 +307,7 @@ export class Viewer {this.clearGroup(this.hover);this.hoverKey = '';if (this.selectedId && !this.parts.has(this.selectedId)) this.selectedId = null;+ for (const id of [...this.selectedIds]) if (!this.parts.has(id)) this.selectedIds.delete(id);this.applySelection();this.updateExtent();if (!this.hasFitted && this.parts.size) { this.setView('iso'); this.hasFitted = true; }@@ -595,6 +606,12 @@ export class Viewer {*/private routeButton(e: PointerEvent): void {if (e.pointerType === 'touch' || e.target !== this.renderer.domElement) return;+ // Alt + links ziehen: Rahmenauswahl, in jeder Mausbelegung frei. Die Kamera bleibt dabei stehen+ if (e.altKey && e.button === 0 && !this.modelHidden && this.mode === 'select' && !this.planePick) {+ this.controls.mouseButtons = { LEFT: NAV_NONE, MIDDLE: NAV_NONE, RIGHT: NAV_NONE };+ this.startBox(e);+ return;+ }const button = NAV_BUTTON[e.button];if (!button) return;const held = e.ctrlKey || e.metaKey || e.shiftKey;@@ -747,10 +764,11 @@ export class Viewer {// Vertritt eine Ebene das Modell, wählt ein Klick kein Bauteil: Er gehört dort der Ebene (Wert eines Ergebnisses merken)const hit = this.modelHidden ? undefined : this.firstHit();this.highlight.clear();- if (!hit) { this.selectedId = null; this.applySelection(); this.requestRender(); return null; }+ if (!hit) { this.selectedId = null; this.selectedIds.clear(); this.applySelection(); this.requestRender(); return null; }const part = this.partOf(hit.object)!;const face = hit.faceIndex != null ? Viewer.faceOfTriangle(part.meta.faces, hit.faceIndex) : null;this.selectedId = part.meta.partId;+ this.selectedIds = new Set([part.meta.partId]);this.applySelection();if (face && face.triCount) this.highlightFace(part, face);this.requestRender();@@ -799,7 +817,19 @@ export class Viewer {const el = this.renderer.domElement;let down: [number, number] | null = null;// Ausgewählt wird nur mit der linken Taste: Mitte und rechts drehen oder verschieben je nach Belegung (E81)- el.addEventListener('pointerdown', (e) => { down = e.button === 0 ? [e.clientX, e.clientY] : null; });+ let downR: [number, number] | null = null;+ el.addEventListener('pointerdown', (e) => {+ down = e.button === 0 && !e.altKey ? [e.clientX, e.clientY] : null;+ downR = e.button === 2 ? [e.clientX, e.clientY] : null;+ });+ // Rechtsklick ohne Ziehen öffnet das Menü (rechts ziehen verschiebt oder dreht je nach Belegung)+ el.addEventListener('contextmenu', (e) => e.preventDefault());+ el.addEventListener('pointerup', (e) => {+ if (e.button !== 2 || !downR || Math.hypot(e.clientX - downR[0], e.clientY - downR[1]) > 4) return;+ downR = null;+ if (this.mode !== 'select' || this.planePick) return;+ this.onContext(this.partAt(e.clientX, e.clientY), e.clientX, e.clientY);+ });el.addEventListener('pointerup', (e) => {if (!down || e.button !== 0 || Math.hypot(e.clientX - down[0], e.clientY - down[1]) > 4) return; // Ziehen ist kein Klickif (this.planePick) { const cb = this.planePick; this.pickPlane(null); cb(this.planeAt(e.clientX, e.clientY)); return; }@@ -809,7 +839,7 @@ export class Viewer {return;}const r = el.getBoundingClientRect();- this.onPick(this.pickAt(((e.clientX - r.left) / r.width) * 2 - 1, -((e.clientY - r.top) / r.height) * 2 + 1));+ this.onPick(this.pickAt(((e.clientX - r.left) / r.width) * 2 - 1, -((e.clientY - r.top) / r.height) * 2 + 1), { shift: e.shiftKey, ctrl: e.ctrlKey || e.metaKey });});// Messen: Element unter dem Zeiger hervorheben (höchstens einmal pro Bild berechnet)let queued: [number, number] | null = null;@@ -1130,11 +1160,19 @@ export class Viewer {}}+ /** Beschriftungen an Punkten (mm) ins Bild setzen, null: keine. Die Elemente baut der Aufrufer, hier werden sie nur verschoben. */+ setTags(items: { el: HTMLElement; at: number[] }[] | null): void {+ for (const t of this.tagItems) t.el.remove();+ this.tagItems = (items ?? []).map((t) => ({ el: t.el, at: new THREE.Vector3(...(t.at as [number, number, number])) }));+ for (const t of this.tagItems) this.overlay.appendChild(t.el);+ this.requestRender();+ }+private placeOverlay(): void {- if (!this.overlayItems.length) return;+ if (!this.overlayItems.length && !this.tagItems.length) return;const w = this.container.clientWidth, h = this.container.clientHeight;const v = new THREE.Vector3();- for (const it of this.overlayItems) {+ for (const it of [...this.overlayItems, ...this.tagItems]) {v.copy(it.at).project(this.camera);const off = v.z > 1 || v.x < -1.2 || v.x > 1.2 || v.y < -1.2 || v.y > 1.2;it.el.hidden = off;@@ -1142,14 +1180,123 @@ export class Viewer {}}- select(id: string | null): void { this.selectedId = id; this.highlight.clear(); this.applySelection(); this.requestRender(); }+ select(id: string | null): void { this.setSelection(id ? [id] : [], id); }++ /** Mehrere Bauteile auswählen. `primary`: das zuletzt gewählte (Auswahlkarte, Code). Die Fläche bleibt nur bei ihm markiert. */+ setSelection(ids: string[], primary: string | null): void {+ if (primary !== this.selectedId || ids.length !== 1) this.highlight.clear();+ this.selectedIds = new Set(ids.filter((id) => this.parts.has(id)));+ this.selectedId = primary && this.selectedIds.has(primary) ? primary : null;+ this.applySelection();+ this.requestRender();+ }++ get selectionIds(): string[] { return [...this.selectedIds]; }++ /** Bauteil unter dem Zeiger (Rechtsklick), auch wenn eine Ergebnisebene das Modell vertritt. Ändert die Auswahl nicht. */+ partAt(clientX: number, clientY: number): string | null {+ const r = this.renderer.domElement.getBoundingClientRect();+ if (!r.width || !r.height) return null;+ if (this.modelHidden) {+ const hit = this.pickLayer(clientX, clientY);+ return hit ? this.standIns.find((s) => s.mesh === hit.object)?.part?.meta.partId ?? null : null;+ }+ this.camera.updateMatrixWorld();+ this.raycaster.setFromCamera(new THREE.Vector2(((clientX - r.left) / r.width) * 2 - 1, -((clientY - r.top) / r.height) * 2 + 1), this.camera);+ const hit = this.firstHit();+ return hit ? this.partOf(hit.object)?.meta.partId ?? null : null;+ }++ // ---- Rahmenauswahl (Alt + links ziehen) -------------------------------------------------------------------------++ private startBox(e: PointerEvent): void {+ const r = this.container.getBoundingClientRect();+ const box = document.createElement('div');+ box.className = 'v-box';+ this.container.appendChild(box);+ this.box = { x: e.clientX - r.left, y: e.clientY - r.top, el: box, id: e.pointerId };+ const canvas = this.renderer.domElement;+ try { canvas.setPointerCapture(e.pointerId); } catch { /* Zeiger ohne Fang (synthetisch): der Rahmen geht trotzdem */ }+ const move = (ev: PointerEvent) => this.drawBox(ev.clientX - r.left, ev.clientY - r.top);+ const up = (ev: PointerEvent) => {+ canvas.removeEventListener('pointermove', move);+ canvas.removeEventListener('pointerup', up);+ canvas.removeEventListener('pointercancel', up);+ const b = this.box;+ this.box = null;+ box.remove();+ if (!b || ev.type === 'pointercancel') return;+ const x1 = ev.clientX - r.left, y1 = ev.clientY - r.top;+ if (Math.hypot(x1 - b.x, y1 - b.y) < 4) return;+ // Von links nach rechts: nur Teile ganz im Rahmen. Von rechts nach links: auch angeschnittene (wie in CAD üblich)+ this.onBox(this.partsInRect(Math.min(b.x, x1), Math.min(b.y, y1), Math.max(b.x, x1), Math.max(b.y, y1), x1 < b.x), ev.shiftKey || ev.ctrlKey || ev.metaKey);+ };+ canvas.addEventListener('pointermove', move);+ canvas.addEventListener('pointerup', up);+ canvas.addEventListener('pointercancel', up);+ this.drawBox(this.box.x, this.box.y);+ }++ private drawBox(x: number, y: number): void {+ const b = this.box;+ if (!b) return;+ b.el.style.left = `${Math.min(b.x, x)}px`;+ b.el.style.top = `${Math.min(b.y, y)}px`;+ b.el.style.width = `${Math.abs(x - b.x)}px`;+ b.el.style.height = `${Math.abs(y - b.y)}px`;+ b.el.classList.toggle('cross', x < b.x);+ }++ /**+ * Sichtbare Bauteile im Rechteck (Pixel im Viewer). Geprüft werden die Ecken der Netze (bei großen Netzen eine Auswahl):+ * `crossing` reicht eine Ecke im Rahmen, sonst müssen alle darin liegen. Angeschnitten zählt zusätzlich, was Strahlen auf+ * einem Raster im Rahmen treffen (eine große Fläche ohne Ecke im Rahmen).+ */+ partsInRect(x0: number, y0: number, x1: number, y1: number, crossing: boolean): string[] {+ const w = this.container.clientWidth, h = this.container.clientHeight;+ this.camera.updateMatrixWorld();+ const v = new THREE.Vector3();+ const out = new Set<string>();+ for (const [id, p] of this.parts) {+ if (!p.group.visible) continue;+ let any = false, all = true, n = 0;+ for (const m of p.meshes) {+ const pos = m.geometry.getAttribute('position') as THREE.BufferAttribute | undefined;+ if (!pos) continue;+ m.updateMatrixWorld();+ const step = Math.max(1, Math.floor(pos.count / 3000));+ for (let i = 0; i < pos.count; i += step) {+ v.fromBufferAttribute(pos, i).applyMatrix4(m.matrixWorld).project(this.camera);+ const sx = ((v.x + 1) / 2) * w, sy = ((1 - v.y) / 2) * h;+ const inside = v.z <= 1 && sx >= x0 && sx <= x1 && sy >= y0 && sy <= y1;+ n++;+ if (inside) any = true; else all = false;+ if (crossing && any) break;+ if (!crossing && !all) break;+ }+ if ((crossing && any) || (!crossing && !all)) break;+ }+ if (n && (crossing ? any : all)) out.add(id);+ }+ if (crossing) {+ const steps = 12;+ for (let i = 0; i <= steps; i++) for (let j = 0; j <= steps; j++) {+ const sx = x0 + ((x1 - x0) * i) / steps, sy = y0 + ((y1 - y0) * j) / steps;+ this.raycaster.setFromCamera(new THREE.Vector2((sx / w) * 2 - 1, -(sy / h) * 2 + 1), this.camera);+ const hit = this.firstHit();+ const id = hit ? this.partOf(hit.object)?.meta.partId : undefined;+ if (id) out.add(id);+ }+ }+ return [...this.parts.keys()].filter((id) => out.has(id));+ }/** Das ausgewählte Bauteil leuchtet leicht orange (Farbe der Auswahl in der ganzen Oberfläche). */private applySelection(): void {for (const [id, p] of this.parts) {for (const m of p.meshes) {const mat = m.material as THREE.MeshStandardMaterial;- mat.emissive?.setHex(id === this.selectedId ? 0x5a2e00 : 0x000000);+ mat.emissive?.setHex(this.selectedIds.has(id) ? 0x5a2e00 : 0x000000);// Hervorhebung einer Animation (E58): Flächenfarbe deutlich nach Orange ziehen. Nur Leuchten färbte ein blaues Teil violett// (Violett heißt in der Oberfläche Vorschau)// (Material.clone() macht aus einer Farbe in userData ein einfaches Objekt: dann neu merken)@@ -1199,8 +1346,9 @@ export class Viewer {* damit das Bild aussieht wie der Viewer. Die Auswahl fehlt im Bild: Sie ist Orange wie der Stift und würde die Markierung verschlucken.*/snapshot(): HTMLCanvasElement {- const sel = this.selectedId;+ const sel = this.selectedId, sels = this.selectedIds;this.selectedId = null;+ this.selectedIds = new Set();this.applySelection();this.highlight.visible = false;this.hover.visible = false; // Messlinien ohne ihre Beschriftung wären im Bild nur verwirrend@@ -1212,6 +1360,7 @@ export class Viewer {const c = document.createElement('canvas');try { this.paintSnapshot(c); } finally {this.selectedId = sel;+ this.selectedIds = sels;this.applySelection();this.highlight.visible = !this.modelHidden;this.hover.visible = true;diff --git a/app/src/shared/types.ts b/app/src/shared/types.tsindex dfb9d91..a1d4996 100644--- a/app/src/shared/types.ts+++ b/app/src/shared/types.ts@@ -293,7 +293,10 @@ export interface ResultPart {worst?: { value: number; at: number[] }; overlap?: number; contact?: number;/** Nur FEM: höchste Vergleichsspannung (MPa), größte Verschiebung (mm), Werkstoff. */stress?: { value: number; at: number[] }; displacement?: { value: number; at: number[] };- material?: { name: string; E: number; strength: number; note?: string | null };+ /** Werkstoff. Querdehnzahl `nu` und Dichte (g/cm³) für den Bericht (E82), sie fehlen bei älteren Ergebnissen. */+ material?: { name: string; E: number; strength: number; nu?: number; density?: number; note?: string | null };+ /** Nur FEM mit Netzprüfung: höchste Spannung mit dem gröberen Netz und die Änderung zum feinen (0.2 = 20 %). */+ coarse?: { stress: number; change: number };}/** Randbedingung einer FEM-Studie (soma analyze fem): fest, Kraft oder Druck auf Flächen eines Teils. */export interface FemBc {@@ -302,7 +305,10 @@ export interface FemBc {}export interface FemInfo {study: string; bcs: FemBc[]; applied: number[]; reaction: number[]; maxDisp: number; diag: number;- mesh: { size: number; elements: number; dofs: number; solver: string };+ /** `auto`: Die Studie gibt keine Netzgröße vor (fehlt bei älteren Ergebnissen). */+ mesh: { size: number; elements: number; dofs: number; solver: string; nodes?: number; auto?: boolean };+ /** Abweichung des Gleichgewichts (0.001 = 0.1 %), gröberes Netz der Prüfung, Schwerkraft (m/s², null: ohne). */+ balance?: number; coarse?: { size: number; elements: number } | null; gravity?: number[] | null;}export interface ResultMeta {id: string; kind: string; title: string; quantity: string; unit: string;@@ -312,6 +318,8 @@ export interface ResultMeta {/** Werte in diesem Band gelten als Berührung, nicht als kritisch (Abstand). */neutral?: [number, number] | null;parts: ResultPart[]; summary: string; created: number; command: string[];+ /** Rechenzeit in Sekunden. */+ seconds?: number;/** Hinweise der Auswertung (FEM: Netzabhängigkeit, große Verformung, Werkstoff). */notes?: string[];fem?: FemInfo | null;diff --git a/app/test/animation.mjs b/app/test/animation.mjsindex b5f4c11..5a0f03b 100644--- a/app/test/animation.mjs+++ b/app/test/animation.mjs@@ -1,7 +1,8 @@// Test von Animation, Analyse, soma render und Video (E58): Animationsdateien bauen (auch über den Watcher), Ablauf als Text,// Kollisionsprüfung, Fehler mit Datei und Zeile, Abspielen im Viewer (Lage, Hervorhebung, Kamera), Ausschluss mit Explosion// und Messen, soma render über die App (Bild, Übersicht, Video mit Untertiteln), Fehler der Verbindung, Video abspielen und-// Standbild markieren, Auswertungen (Überhang, Wandstärke, Abstand) mit Anzeige, Wert unter dem Zeiger und Neu berechnen.+// Standbild markieren, Auswertungen (Überhang, Wandstärke, Abstand) mit Anzeige, Wert unter dem Zeiger und Neu berechnen,+// die Reiter Animation und Analysis mit Liste, Schritten und Bericht (E82).// Aufruf: npm run test:animation (baut vorher). SMOKE_VISIBLE=offscreen SMOKE_SHOTS=1 legt Bilder ab.import { spawnSync } from 'node:child_process';import fs from 'node:fs';@@ -139,20 +140,33 @@ try {await waitFor('Fehler weg', () => window.soma.anim.list().then((x) => x.errors.length === 0), 20000).catch(() => {});check('Gelöschte Datei: Ihr Fehler verschwindet aus der Liste', (await list()).errors.length === 0);- // 4) Abspielen im Viewer. Animationen und Analysen wählt man im Umschalter oben links (Entwurf 2), `pickView` klickt den- // Eintrag, dessen Text `label` enthält (eine Zahl: der n-te Eintrag, 0 ist „Modell“)- const pickView = async (label) => {- await ev(() => window.__t.openViewMenu());- await ev((l) => { const items = [...document.querySelectorAll('#menu-view .mi')]; (typeof l === 'number' ? items[l] : items.find((b) => b.textContent.includes(l))).click(); }, label);+ // 4) Abspielen im Viewer. Animationen und Analysen stehen in eigenen Reitern (E82): Der Reiter zeigt beim ersten Mal die erste,+ // `showAnim` wählt wie ein Klick in der Liste+ await ev(() => window.__t.refreshViewLists());+ check('Neue Animationen vom Agenten: Punkt am Reiter Animation', (await ev(() => window.__t.rail())).anim, JSON.stringify(await ev(() => window.__t.rail())));+ await ev(() => window.__t.showPanel('anim'));+ await waitFor('Animation geladen', () => window.__t.anim().name !== null && window.__t.animPanel().mode === 'report', 20000);+ check('Reiter Animation: Punkt weg, Bericht der gezeigten', !(await ev(() => window.__t.rail())).anim, JSON.stringify(await ev(() => window.__t.animPanel())));+ await domClick('btn-am-back');+ let ap = await ev(() => window.__t.animPanel());+ check('Liste: beide Animationen, die gezeigte markiert', ap.mode === 'list' && ap.list.length === 2 && ap.list.filter((x) => x.cur).length === 1, JSON.stringify(ap.list));+ const showAnim = async (id) => {+ await ev((i) => window.__t.animShow(i), id);+ await waitFor(`Animation ${id}`, () => window.__t.anim().active && window.__t.anim().name !== null, 20000);};- await pickView('Deckel öffnen');- await waitFor('Animation geladen', () => window.__t.anim().name !== null, 20000);- await ev(() => { const s = document.getElementById('anim-select'); s.value = 'deckel-oeffnen'; s.dispatchEvent(new Event('change')); });+ await ev(() => document.querySelector('#am-rows .al-row[data-id="deckel-oeffnen"]').click());await waitFor('Deckel öffnen gewählt', () => window.__t.anim().name === 'Deckel öffnen', 10000);let s = await ev(() => window.__t.anim());- check('Karte „Animation“: zwei zur Auswahl, Dauer 8 s, Kamera folgt (eigene Kamera), Hinweis mit Datei', s.active && s.options.length === 2 && near(s.duration, 8)- && s.follow && s.hint.startsWith('animations/deckel.py, line 4') && s.time === '0.00 / 8.00 s'- && JSON.stringify(await ev(() => window.__t.viewSwitch())) === '{"name":"Deckel öffnen","sub":"","unseen":0,"closable":true}', JSON.stringify(s));+ ap = await ev(() => window.__t.animPanel());+ check('Leiste unten: zwei Animationen, Dauer 8 s, Kamera folgt (eigene Kamera), Zeit 0.0 s', s.active && s.options.length === 2 && near(s.duration, 8)+ && s.follow && s.time === '0.0 s', JSON.stringify(s));+ check('Reiter Animation: Name, Dauer und bewegte Teile, Schritt aus dem Untertitel', ap.mode === 'report' && ap.title === 'Deckel öffnen'+ && ap.meta === 'Animation · 8.0 s · 1 part move' && ap.steps.length === 1 && ap.steps[0].text === '1.0 sDer Deckel öffnet bis 110°' && !ap.steps[0].cur, JSON.stringify(ap));+ await ev(() => document.querySelector('#am-body .cx-seq').click());+ ap = await ev(() => window.__t.animPanel());+ check('Klick auf den Schritt springt zu 1 s, der Schritt ist hervorgehoben', near((await ev(() => window.__t.anim())).t, 1) && ap.steps[0].cur, JSON.stringify(ap.steps));+ check('Baum in der Animation: alle Teile des Modells', (await ev(() => window.__t.tree())).names.length === 7);+ await ev(() => window.__t.animSeek(0));await ev(() => window.__t.animSeek(3));let pose = await ev((id) => window.__t.viewer.partPose(id), ids.Lid);const q = [-Math.sin(55 * Math.PI / 180), 0, 0, Math.cos(55 * Math.PI / 180)];@@ -185,7 +199,7 @@ try {pose = await ev((id) => window.__t.viewer.partPose(id), ids.Lid);check('Explosion beendet die Animation (Deckel ohne Drehung, Hervorhebung weg)', !s.active && pose.quaternion[3] === 1&& (await ev(() => window.__t.viewer.animViewState())).highlight.length === 0, JSON.stringify(pose));- await pickView('Deckel öffnen');+ await showAnim('deckel-oeffnen');await waitFor('Animation wieder an', () => window.__t.anim().active && window.__t.anim().name === 'Deckel öffnen', 10000);check('Animation beendet die Explosion', !(await ev(() => window.__t.explode())).active);await domClick('btn-measure');@@ -255,9 +269,14 @@ try {await domClick('btn-video-close');check('Schließen: Player weg', !(await ev(() => window.__t.video())).open);- // 9) Knopf „Video erzeugen“ in der Animation- await pickView('Deckel öffnen');+ // 9) Knopf „Video erzeugen“ im Reiter Animation, das Video steht danach darunter+ await ev(() => window.__t.showPanel('anim'));+ await showAnim('deckel-oeffnen');await waitFor('Animation an', () => window.__t.anim().active && !!window.__t.anim().name, 10000);+ await ev(() => window.__t.refreshViewLists());+ ap = await ev(() => window.__t.animPanel());+ check('Reiter Animation: Video der Animation (renders/deckel-oeffnen.mp4) unter VIDEOS', ap.videos.some((x) => x.startsWith('deckel-oeffnen.mp4')), JSON.stringify(ap.videos));+ await shot('anim-3-reiter');fs.rmSync(mp4);await domClick('btn-anim-video');await waitFor('Video erzeugt und geöffnet', () => window.__t.video().open && window.__t.video().file === 'renders/deckel-oeffnen.mp4', 120000).catch(() => {});@@ -276,15 +295,18 @@ try {check('Abstand: Stift mit 0,2 mm Spalt kritisch, Störer überschneidet sich, Deckel liegt nur auf', r.status === 0&& /Stift: [^\n]*below 0\.50 mm/.test(r.stdout) && /Störer: -[^\n]*overlap/.test(r.stdout) && /Lid: [^\n]*nothing below 0\.50 mm[^\n]*contact/.test(r.stdout),r.stdout + r.stderr);- await pickView(1); // erste Analyse über den Umschalter oben links+ await ev(() => window.__t.showPanel('analysis')); // zeigt das neuesteawait waitFor('Ergebnis geladen', () => window.__t.result().id !== null, 20000);- await ev(() => { const s = document.getElementById('result-select'); s.value = 'thickness'; s.dispatchEvent(new Event('change')); });- await waitFor('Wandstärke gewählt', () => window.__t.result().id === 'thickness', 10000);+ await ev(() => window.__t.resultShow('thickness'));+ await waitFor('Wandstärke gewählt', () => window.__t.result().id === 'thickness' && window.__t.analysis().title === 'Wall thickness', 10000);let rs = await ev(() => window.__t.result());+ let an = await ev(() => window.__t.analysis());vs = await ev(() => window.__t.viewer.animViewState());- check('Karte „Analyse“: drei Ergebnisse, Wandstärke je Bauteil, Lasche kritisch, Modell tritt zurück', rs.active && rs.options.length === 3- && rs.rows.some((x) => x.startsWith('Lasche') && x.includes('critical') && !x.includes('nothing')) && rs.rows.some((x) => x.startsWith('Body') && x.includes('nothing critical'))- && vs.modelHidden && !rs.stale, JSON.stringify(rs.rows));+ check('Analyse: drei Ergebnisse, Bericht mit kleinster Wandstärke 1 mm unter 1,2 mm, Lasche kritisch, Body nicht, Modell tritt zurück', rs.active && rs.options.length === 3+ && an.number === '1mm' && / below the limit$/.test(an.status) && an.critical.some((x) => x.startsWith('Lasche')) && !an.critical.some((x) => x.startsWith('Body'))+ && an.table.some((row) => row[0] === 'Lasche' && row[3] !== '–') && an.table.some((row) => row[0] === 'Body' && row[3] === '–')+ && vs.modelHidden && !rs.stale, JSON.stringify(an));+ check('Leiste unten ohne FEM: nur der Name und das ×', rs.bar === 'Wall thickness' && !rs.fem, JSON.stringify(rs.bar));await ev(() => window.__t.viewer.setView('front'));await sleep(300);const at = await ev(() => window.__t.viewer.screenAt([0, -40.5, 6]));@@ -299,12 +321,14 @@ try {// Code ändern: Ergebnis veraltet, „Neu berechnen“ wertet das neue Modell ausfs.writeFileSync(path.join(dir, 'model.py'), MODEL(2.0));await waitFor('neuer Build', () => window.__t.status().state === 'ok' && window.__t.result().stale === true, 60000).catch(() => {});- rs = await ev(() => window.__t.result());- check('Nach Codeänderung: Ergebnis als veraltet gekennzeichnet', rs.stale && rs.hint.startsWith('Older than the code'), rs.hint);+ await ev(() => window.__t.refreshViewLists());+ an = await ev(() => window.__t.analysis());+ check('Nach Codeänderung: Ergebnis als veraltet gekennzeichnet', an.meta.includes('older than the code') && an.stale?.startsWith('Values belong to the model'), JSON.stringify(an));await domClick('btn-result-rerun');- await waitFor('neu berechnet', () => window.__t.result().stale === false, 90000).catch(() => {});- rs = await ev(() => window.__t.result());- check('„Neu berechnen“: Lasche jetzt 2 mm, nichts kritisch', !rs.stale && rs.rows.some((x) => x.startsWith('Lasche') && x.includes('nothing critical')), JSON.stringify(rs.rows));+ await waitFor('neu berechnet', () => window.__t.result().stale === false && !window.__t.result().busy, 90000).catch(() => {});+ an = await ev(() => window.__t.analysis());+ check('„Neu berechnen“: Lasche jetzt 2 mm, nichts kritisch', !an.stale && !an.critical.some((x) => x.startsWith('Lasche'))+ && an.table.some((row) => row[0] === 'Lasche' && row[1] === '2' && row[3] === '–'), JSON.stringify(an));await domClick('btn-result-close');check('Analyse aus: Modell wieder sichtbar', !(await ev(() => window.__t.viewer.animViewState())).modelHidden);diff --git a/app/test/fasteners.mjs b/app/test/fasteners.mjsindex 6380d50..9b99312 100644--- a/app/test/fasteners.mjs+++ b/app/test/fasteners.mjs@@ -259,12 +259,12 @@ try {check('Rollen: Normteile "hardware", Gehäuse und Deckel "part"', parts.filter((p) => p.role === 'hardware').length === 10 && byName['Gehäuse']?.role === 'part'&& byName['Schraube 1']?.group === 'Normteile/Schrauben', parts.map((p) => `${p.name}:${p.role}`).join(' ').slice(0, 100));- const outline = await ev(() => [...document.querySelectorAll('#tab-model .row, #tab-model .grp')].map((r) => (r.classList.contains('grp') ? '#' : '')- + ((r.querySelector('.gname') ?? r.querySelector('.pname'))?.textContent ?? r.textContent)).join(' '));- check('Bauteilbaum: Normteile als Gruppe bei den eigenen Teilen, keine Referenzen-Überschrift', outline.includes('Normteile') && outline.includes('Einsätze')- && !outline.includes('#REFERENCES'), outline.slice(0, 120));+ await ev(() => { window.__t.treeOpen(true); window.__t.treeExpandAll(); });+ const outline = (await ev(() => window.__t.tree())).rows.map((x) => x.name).join(' ');+ check('Strukturbaum: Normteile als Gruppe bei den eigenen Teilen, keine Gruppe References', outline.includes('Normteile') && outline.includes('Einsätze')+ && !outline.includes('References'), outline.slice(0, 120));- await ev(() => [...document.querySelectorAll('#tab-model .row:not(.gr)')].find((r) => r.querySelector('.pname')?.textContent === 'Schraube 1').querySelector('.nm').click());+ await ev(() => [...document.querySelectorAll('#tree .tr-row:not(.gr)')].find((r) => r.querySelector('.nm')?.textContent === 'Schraube 1').querySelector('.nm').click());await waitFor('Auswahl', () => window.__t.info() !== '', 5000).catch(() => {});const info = await ev(() => window.__t.info());check('Auswahl einer Schraube: Name mit „(purchased part)“, Codestelle wie bei eigenen Teilen', info.startsWith('Schraube 1 (purchased part)'), info.slice(0, 60));diff --git a/app/test/fem.mjs b/app/test/fem.mjsindex 82967ee..672d03d 100644--- a/app/test/fem.mjs+++ b/app/test/fem.mjs@@ -1,6 +1,7 @@// Test der FEM-Auswertung (E65): soma analyze fem mit einer Studie in analyses/, Vergleich mit der Balkenformel, verschmolzene// Teile mit eigenem Werkstoff, Druck, Eigengewicht und near=, Fehlermeldungen (Lagerung, Bauteil, Selektor, kein fix), Anzeige in-// der App (Karte mit Lastfall, Überhöhung, Wert unter dem Zeiger in Ausgangslage, An Agent geben), soma render --result,+// der App (Reiter Analysis mit Bericht, Leiste und Legende im Bild, Beschriftungen, Überhöhung, Wert unter dem Zeiger in+// Ausgangslage, An Agent geben, E82), soma render --result,// veraltet nach Änderung der Studie, Neu berechnen und das Beispiel aus dem Skill.// Aufruf: node test/run-all.mjs fem (baut vorher mit npm run build). SMOKE_VISIBLE=offscreen SMOKE_SHOTS=1 legt Bilder ab.import { spawnSync } from 'node:child_process';@@ -109,17 +110,46 @@ try {check('Ohne Studie: Hinweis auf die Datei', r.status === 1 && (r.stderr + r.stdout).includes('needs the file with the load case'), r.stderr + r.stdout);check('Fehler legen keine Ergebnisse an', !fs.existsSync(path.join(dir, '.soma', 'results', 'kaputt.glb')) && !fs.existsSync(path.join(dir, '.soma', 'results', 'lose.glb')));- // 4) Anzeige in der App: Karte mit Lastfall und Überhöhung, Wert unter dem Zeiger in Ausgangslage- await ev(() => window.__t.openViewMenu());- await ev(() => { [...document.querySelectorAll('#menu-view .mi')].find((b) => b.textContent.includes('Balken unter Last')).click(); });- await waitFor('FEM-Ergebnis geladen', () => window.__t.result().id === 'balken', 20000);+ // 4) Anzeige in der App (E82): Punkt am Reiter, Reiter Analysis zeigt das neueste, Liste, Bericht, Leiste und Legende im Bild+ await ev(() => window.__t.refreshViewLists());+ check('Neue Analysen vom Agenten: Punkt am Reiter Analysis, keiner an Animation', (await ev(() => window.__t.rail())).analysis+ && !(await ev(() => window.__t.rail())).anim, JSON.stringify(await ev(() => window.__t.rail())));+ await ev(() => window.__t.showPanel('analysis'));+ await waitFor('neuestes Ergebnis gezeigt', () => window.__t.result().id === 'winkel' && window.__t.analysis().mode === 'report', 20000);+ let an = await ev(() => window.__t.analysis());+ check('Reiter Analysis: zeigt beim ersten Mal das neueste (Winkel) mit Bericht, Punkt am Reiter weg', an.title === 'Winkel'+ && an.meta.startsWith('FEM · ') && !(await ev(() => window.__t.rail())).analysis, JSON.stringify(an));+ check('Bericht Winkel: Druck, Schwerkraft und zwei Werkstoffe als Annahmen', an.inputs.some((x) => x.startsWith('Pressure0.2 MPa'))+ && an.inputs.some((x) => x.startsWith('Gravity9.81 m/s²')) && an.inputs.some((x) => x.startsWith('MaterialAluminium 6082 · Steel S235')), JSON.stringify(an.inputs));+ await domClick('btn-an-back');+ an = await ev(() => window.__t.analysis());+ check('Liste: alle Analysen, die gezeigte markiert, die andere „new“', an.mode === 'list' && an.list.length === 2+ && an.list.find((x) => x.id === 'winkel')?.cur && !an.list.find((x) => x.id === 'winkel')?.isNew && an.list.find((x) => x.id === 'balken')?.isNew, JSON.stringify(an.list));+ await ev(() => document.querySelector('#an-rows .al-row[data-id="balken"]').click());+ await waitFor('FEM-Ergebnis geladen', () => window.__t.result().id === 'balken' && window.__t.analysis().title === 'Balken unter Last', 20000);let rs = await ev(() => window.__t.result());+ an = await ev(() => window.__t.analysis());// Überhöhung: 5 % von 101 mm / 0,286 mm = 17,7, auf eine runde Zahl abgerundet 10- check('Karte: Sicherheit, Spannung, Verschiebung je Teil, Lastfall in zwei Zeilen, verformt 10-fach', rs.active && rs.fem- && rs.rows.some((x) => x.startsWith('Balken') && /Safety \d+\.\d+ · 30(\.\d)? MPa · 0\.28\d mm$/.test(x))- && rs.fem.bcRows.length === 2 && rs.fem.bcRows[0].startsWith('Fixed') && rs.fem.bcRows[0].includes('reaction force 50 N') && rs.fem.bcRows[1].startsWith('Force')- && rs.fem.scale === 10 && rs.fem.options.includes('Exaggerated 10×') && rs.fem.bcs === true && rs.meta.unit === '', JSON.stringify(rs));- check('Hinweis in der Karte nennt den Befehl mit der Studie', rs.hint.startsWith('soma analyze fem analyses/balken.py'), rs.hint);+ check('Bericht: eine Zahl groß (Sicherheit über 2), hält, Lager und Kraft, Werkstoff, Netz, Tabelle mit 30 MPa und 0,28 mm', /^\d+(\.\d+)?$/.test(an.number)+ && Number(an.number) > 2 && an.status === 'Holds the required safety' && an.critical.length === 0+ && an.inputs.some((x) => x.startsWith('SupportFixed · Balken')) && an.inputs.some((x) => x.startsWith('Force50 N downward · Balken'))+ && an.inputs.some((x) => x.startsWith('MaterialAluminium 6082')) && an.inputs.some((x) => /^Mesh[\d.]+ mm · [\d,]+ elements/.test(x))+ && an.table.some((row) => row[0] === 'Balken' && near(Number(row[2]), 30, 4) && /^0\.28\d$/.test(row[3])), JSON.stringify(an));+ await ev(() => { window.__t.analysisToggle('bc0'); window.__t.analysisToggle('mat'); window.__t.analysisToggle('mesh'); window.__t.analysisToggle('calc'); });+ an = await ev(() => window.__t.analysis());+ check('Aufgeklappt: Lagerkraft 50 N nach oben im Gleichgewicht, E-Modul, Querdehnzahl, Dichte, Netz aus der Modellgröße, Löser', an.details.some((x) => x.includes('Reaction50 N upward') && x.includes('in equilibrium'))+ && an.details.some((x) => x.includes('E modulus70 GPa') && x.includes('Poisson ν0.33') && x.includes('Density2.7 g/cm³') && x.includes('allowable 125 MPa'))+ && an.details.some((x) => x.includes('automatic from the model size') && x.includes('coarser mesh'))+ && an.details.some((x) => x.includes('Studyanalyses/balken.py') && x.includes('Commandsoma analyze fem analyses/balken.py')), JSON.stringify(an.details));+ check('Im Bild: Sicherheit, Spannung, Verschiebung wählbar, verformt 10-fach, Lastfall an, Kraft und kleinster Wert beschriftet', rs.active && rs.fem+ && rs.fem.fields.join() === 'Safety factor,Stress,Displacement' && rs.fem.scale === 10 && rs.fem.options.join() === 'Off,1×,10×' && rs.fem.bcs === true+ && rs.meta.unit === '' && rs.tags.some((x) => x === '50 N') && rs.tags.some((x) => x.startsWith('Min ')) && rs.scale.legend.startsWith('Safety Auto') && rs.scale.legend.includes('Safety factor'), JSON.stringify(rs));+ check('Legende schmal (höchstens 90 px), die Skala stellt das Menü hinter dem Knopf „Auto“ ein', await ev(() => document.getElementById('result-legend').offsetWidth <= 90)+ && await ev(() => { document.getElementById('btn-result-scale').click(); return !document.getElementById('menu-scale').hidden; }), String(await ev(() => document.getElementById('result-legend').offsetWidth)));+ await shot('fem-1b-skala');+ await ev(() => document.body.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true })));+ const tr = await ev(() => window.__t.tree());+ check('Baum in der Analyse: nur die gerechneten Körper', JSON.stringify(tr.names) === '["Balken"]', JSON.stringify(tr.names));await ev(() => window.__t.viewer.setView('front'));await sleep(300);// Vorderseite am Ende: um 10 x 0,28 mm nach unten verschoben gezeichnet, der Wert nennt die Stelle im unverformten Modell@@ -128,24 +158,25 @@ try {check('Klick auf das verformte Balkenende: Stelle in Ausgangslage, Verschiebung um 0,28 mm, Spannung klein', pin?.name === 'Balken'&& near(pin.point[0], 97, 1) && near(pin.point[2], 0, 1.2) && near(pin.disp, 0.28, 0.03) && pin.stress < 5 && pin.value > 20, JSON.stringify(pin));rs = await ev(() => window.__t.result());+ check('Gemerkte Stelle steht im Bericht', (await ev(() => window.__t.analysis())).pick?.startsWith('Picked: Balken, Safety '), (await ev(() => window.__t.analysis())).pick);check('An Agent geben: Sicherheit, Spannung und Verschiebung', /^\[Result: "Balken unter Last" \(\.soma\/results\/balken\.glb, limit 2\.00\), part "Balken": safety factor (over 99|\d+\.\d\d) \(\d+\.\d MPa, displacement 0\.2\d\d mm\) at \(/.test(rs.note), rs.note);await ev(() => window.__t.viewer.setView('iso'));await shot('fem-1');- await ev(() => { const s = document.getElementById('result-deform'); s.value = '0'; s.dispatchEvent(new Event('change')); });+ await ev(() => window.__t.resultDeform(0));await domClick('btn-result-bcs');rs = await ev(() => window.__t.result());- check('Unverformt und Lastfall aus', rs.fem.scale === 0 && rs.fem.bcs === false, JSON.stringify(rs.fem));+ check('Unverformt und Lastfall aus, ohne Beschriftung der Kraft', rs.fem.scale === 0 && rs.fem.bcs === false && !rs.tags.includes('50 N'), JSON.stringify(rs));await domClick('btn-result-bcs');// Farbskala: Spannung statt Sicherheit (Grenze 250 / 2 = 125 MPa, kritisch darüber), Spanne Min bis Max und eigene- const pick = (id, v) => ev((a) => { const s = document.getElementById(a.id); s.value = a.v; s.dispatchEvent(new Event('change')); }, { id, v });+ const pick = (id, v) => ev((a) => document.querySelector(`#${a.id} [data-range="${a.v}"]`).click(), { id, v });check('Skala automatisch: Sicherheit, Spanne der Auswertung', rs.scale.field === 'value' && rs.scale.mode === 'auto' && rs.scale.canStress&& rs.scale.range[0] === 0 && rs.scale.threshold === 2, JSON.stringify(rs.scale));- await pick('result-field', 'stress');+ await ev(() => window.__t.resultField('stress'));rs = await ev(() => window.__t.result());check('Spannung: MPa, Grenze 125 MPa kritisch darüber, Skala 0 bis 250', rs.scale.field === 'stress' && rs.scale.unit === 'MPa'&& rs.scale.threshold === 125 && rs.scale.range.join() === '0,250' && rs.scale.legend.includes('von Mises stress (MPa)')- && rs.scale.legend.includes('Limit 125 MPa, critical above'), JSON.stringify(rs.scale));+ && rs.scale.legend.includes('Red: above allowable'), JSON.stringify(rs.scale));await ev(() => window.__t.viewer.setView('front'));await sleep(300);const pin2 = await ev((p) => window.__t.resultPin(p.x, p.y), at);@@ -166,20 +197,27 @@ try {await typeIn('result-lo', '10');rs = await ev(() => window.__t.result());// Farben über die Spanne: Das untere Ende ist grau, das obere rot, obwohl der Grenzwert weit darüber liegt- const ends = await ev(() => getComputedStyle(document.querySelector('#result-legend .rs-bar')).backgroundImage.match(/rgb\([^)]*\)/g));+ // Die Legende steht senkrecht: oben das obere Ende der Spanne+ const ends = await ev(() => getComputedStyle(document.querySelector('#result-legend .lg-bar')).backgroundImage.match(/rgb\([^)]*\)/g));check('Eigene Skala 10 bis 40 MPa gilt sofort, Farbe über die Spanne bis Rot, Grenze außerhalb ohne Strich', rs.scale.range.join() === '10,40'- && rs.scale.legend.includes('color across the range') && ends.at(-1) === 'rgb(240, 116, 112)'- && await ev(() => document.querySelector('#result-legend .rs-mark').hidden), JSON.stringify(rs.scale) + ends?.join(' '));+ && rs.scale.legend.includes('Color across the range') && ends[0] === 'rgb(240, 116, 112)'+ && await ev(() => !document.querySelector('#result-legend .lg-thr')), JSON.stringify(rs.scale) + ends?.join(' '));await shot('fem-2');await typeIn('result-lo', '50');rs = await ev(() => window.__t.result());check('Von größer als bis: rot umrandet, Skala bleibt', rs.scale.range.join() === '10,40' && await ev(() => document.getElementById('result-lo').classList.contains('bad')), JSON.stringify(rs.scale));await typeIn('result-lo', '10');- await pick('result-field', 'value');+ await ev(() => window.__t.resultField('value'));rs = await ev(() => window.__t.result());check('Zurück zur Sicherheit: eigene Skala neu aus deren Spanne', rs.scale.field === 'value' && rs.scale.range[0] === 0 && rs.scale.threshold === 2&& await ev(() => document.getElementById('result-hi').value) === String(rs.scale.range[1]), JSON.stringify(rs.scale));await pick('result-range', 'auto');+ await ev(() => window.__t.resultField('disp'));+ rs = await ev(() => window.__t.result());+ check('Verschiebung: mm, ohne Grenzwert, Skala 0 bis zur größten (0,286 mm)', rs.scale.field === 'disp' && rs.scale.unit === 'mm' && rs.scale.threshold === null+ && rs.scale.range[0] === 0 && near(rs.scale.range[1], 0.286, 0.01) && rs.scale.legend.includes('No limit'), JSON.stringify(rs.scale));+ await shot('fem-2b-verschiebung');+ await ev(() => window.__t.resultField('value'));// 5) soma render --result: Bild mit Legender = soma(['render', '--result', 'balken']);@@ -190,25 +228,28 @@ try {study('balken', BALKEN(100));const stale = await ev(() => window.soma.results.list().then((l) => l.find((x) => x.id === 'balken')?.stale));check('Geänderte Studie: Ergebnis veraltet', stale === true, String(stale));- await ev(() => window.__t.resultRefresh?.());+ await ev(() => window.__t.refreshViewLists());+ an = await ev(() => window.__t.analysis());+ check('Bericht: „older than the code“ und Zeile mit Neu berechnen', an.meta.includes('older than the code') && an.stale?.startsWith('Values belong to the model as it was at'), JSON.stringify(an));+ await shot('fem-4-veraltet');await domClick('btn-result-rerun');- await waitFor('neu berechnet', () => window.__t.result().stale === false && window.__t.result().fem?.bcRows?.[0]?.includes('100 N'), 120000).catch(() => {});- rs = await ev(() => window.__t.result());- check('Neu berechnen: Lagerkraft jetzt 100 N, Verschiebung doppelt', !rs.stale && rs.fem?.bcRows[0].includes('reaction force 100 N')- && rs.rows.some((x) => x.startsWith('Balken') && /0\.5[67]\d mm/.test(x)), JSON.stringify(rs));+ await waitFor('neu berechnet', () => window.__t.result().stale === false && window.__t.analysis().details.some((x) => x.includes('Reaction100 N')), 120000).catch(() => {});+ an = await ev(() => window.__t.analysis());+ check('Neu berechnen: Lagerkraft jetzt 100 N, Verschiebung doppelt', !an.stale && an.details.some((x) => x.includes('Reaction100 N upward'))+ && an.table.some((row) => row[0] === 'Balken' && /^0\.5[67]\d$/.test(row[3])), JSON.stringify(an));await domClick('btn-result-close');- check('Analyse aus: Modell wieder sichtbar', !(await ev(() => window.__t.viewer.animViewState())).modelHidden);+ check('× in der Leiste: Analyse aus, Modell wieder sichtbar, Baum mit allen Teilen, Bericht wird zur Liste', !(await ev(() => window.__t.viewer.animViewState())).modelHidden+ && (await ev(() => window.__t.tree())).names.length === 4 && (await ev(() => window.__t.analysis())).mode === 'list');// Schnitt durch verschmolzene Teile: Jedes Netz ist für sich geschlossen, auch an der Fläche, an der die Wand auf dem Fuß// steht. Sonst füllt der Deckel des Schnitts auch Stellen, an denen der Blick durch diese Fläche geht- await ev(() => window.__t.openViewMenu());- await ev(() => { [...document.querySelectorAll('#menu-view .mi')].find((b) => b.textContent.includes('Winkel')).click(); });+ await ev(() => window.__t.resultShow('winkel'));await waitFor('Ergebnis Winkel geladen', () => window.__t.result().id === 'winkel', 20000);const scaleW = (await ev(() => window.__t.result())).fem.scale;// Waagerecht durch die Wand bei z = 40, behalten wird darunter: Die Kontur folgt der Überhöhung (die Wand kippt nach −X)await ev(() => window.__t.viewer.setSection({ normal: [0, 0, -1], constant: 40 }));const boxBent = (await ev(() => window.__t.viewer.sectionState())).contourBox;- await pick('result-deform', '0');+ await ev(() => window.__t.resultDeform(0));const boxFlat = (await ev(() => window.__t.viewer.sectionState())).contourBox;check('Schnitt im Ergebnis: Kontur folgt der Überhöhung (verformt nach −X, unverformt bis x = 30)', scaleW > 0 && near(boxFlat?.[1][0], 30, 0.05)&& boxBent?.[1][0] < 29.5, JSON.stringify({ scaleW, boxBent, boxFlat }));diff --git a/app/test/groups.mjs b/app/test/groups.mjsindex 6558b05..870b220 100644--- a/app/test/groups.mjs+++ b/app/test/groups.mjs@@ -1,6 +1,6 @@-// Test für Gruppen und Transparenz: Gruppen aus add_part(group=…) und aus einer importierten STEP-Baugruppe, Baum in der-// Bauteilkarte, Aus-/Einblenden und Transparenz je Teil und Gruppe, Klick durch ein transparentes Teil, Gruppen in der-// Ausgabe-STEP. Aufruf: npm run test:groups (baut vorher). SMOKE_VISIBLE=offscreen SMOKE_SHOTS=1 legt Bilder ab.+// Test für Gruppen und Transparenz: Gruppen aus add_part(group=…) und aus einer importierten STEP-Baugruppe, Strukturbaum im+// Viewer (E82) mit Baumstrichen, Referenzen als zugeklappte Gruppe am Ende, Aus-/Einblenden und Transparenz je Teil und Gruppe,+// „hidden“ im Kopf und im Fuß, Suche, F3, Klick durch ein transparentes Teil, Gruppen in der Ausgabe-STEP. Aufruf: npm run test:groups (baut vorher). SMOKE_VISIBLE=offscreen SMOKE_SHOTS=1 legt Bilder ab.import { spawnSync } from 'node:child_process';import fs from 'node:fs';import path from 'node:path';@@ -56,38 +56,57 @@ try {const status = await ev(() => window.__t.status());check('Build mit Gruppen und importierter Baugruppe: 6 Bauteile', (await ev(() => window.__t.partCount())) === 6, `${status.text} ${status.detail} ${status.viewerMsg ?? ''}`.slice(0, 90));- // 1) Baum in der Bauteilkarte- const rows = () => ev(() => [...document.querySelectorAll('#tab-model .row, #tab-model .grp')].map((r) => ({- kind: r.classList.contains('grp') ? 'section' : r.classList.contains('gr') ? 'group' : 'part',- name: (r.querySelector('.gname') ?? r.querySelector('.pname'))?.textContent ?? r.textContent, pad: parseInt(r.style.paddingLeft || '0', 10),- })));+ // 1) Strukturbaum im Viewer (E82): beginnt eingeklappt mit dem Namen des Modells, F3 klappt ihn auf+ let tr = await ev(() => window.__t.tree());+ check('Baum beginnt eingeklappt: nur der Name des Modells, keine Zeilen', !tr.open && tr.rows.length === 0 && tr.head === proj.name, JSON.stringify(tr.head));+ await ev(() => document.body.dispatchEvent(new KeyboardEvent('keydown', { key: 'F3', bubbles: true })));+ tr = await ev(() => window.__t.tree());+ check('F3 klappt den Baum auf', tr.open && tr.rows.length > 0);+ const rows = async () => (await ev(() => window.__t.tree())).rows.map((x) => ({ kind: x.group ? 'group' : 'part', name: x.name, depth: x.depth }));+ const outlineOf = (r) => r.map((x) => `${x.kind === 'group' ? '+' : '-'}${x.name}@${x.depth}`).join(' ');let r = await rows();- const outline = r.map((x) => `${x.kind === 'group' ? '+' : x.kind === 'section' ? '#' : '-'}${x.name}@${x.pad}`).join(' ');- check('Baum: Gehäuse › Boden, Deckel, Schrauben › Schraube, dann REFERENCES › Platine › Leiterplatte, Stecker › USB_C, Pinleiste',- outline === '+Gehäuse@4 -Boden@18 -Deckel@18 +Schrauben@18 -Schraube@32 #REFERENCES@0 +Platine@4 -Leiterplatte@18 +Stecker@18 -USB_C@32 -Pinleiste@32', outline);+ check('Aufgeklappt zeigt der Baum nur die oberste Ebene: Gehäuse und References, zugeklappt', outlineOf(r) === '+Gehäuse@0 +References@0', outlineOf(r));+ const groupRow = (name) => `[...document.querySelectorAll('#tree .tr-row.gr')].find((r) => r.querySelector('.nm').textContent === ${JSON.stringify(name)})`;+ const partRow = (name) => `[...document.querySelectorAll('#tree .tr-row:not(.gr)')].find((r) => r.querySelector('.nm')?.textContent === ${JSON.stringify(name)})`;+ await ev(`(${groupRow('Gehäuse')}).querySelector('.chev').click()`);+ r = await rows();+ check('Gehäuse aufgeklappt: eine Ebene, Schrauben bleibt zu', outlineOf(r) === '+Gehäuse@0 -Boden@1 -Deckel@1 +Schrauben@1 +References@0', outlineOf(r));+ for (const g of ['Schrauben', 'References', 'Platine', 'Stecker']) await ev(`(${groupRow(g)}).querySelector('.chev').click()`);+ r = await rows();+ const outline = outlineOf(r);+ check('References aufgeklappt: Platine › Leiterplatte, Stecker › USB_C, Pinleiste',+ outline === '+Gehäuse@0 -Boden@1 -Deckel@1 +Schrauben@1 -Schraube@2 +References@0 +Platine@1 -Leiterplatte@2 +Stecker@2 -USB_C@3 -Pinleiste@3', outline);+ const branches = await ev(() => [...document.querySelectorAll('#tree .tr-row')].map((row) => [...row.querySelectorAll('.br i')].map((i) => i.className || '_').join('')));+ check('Baumstriche: Abzweig, letzter Abzweig, weiterlaufend, bei Teilen bis an die Knöpfe', branches[1] === 'vth' && branches[3] === 'vl' && branches[4] === 'v_lh' && branches[5] === 'l' && branches[10] === '___lh', branches.join(' '));const parts = await ev(() => Object.fromEntries(window.__t.parts().map((p) => [p.name, p])));const green = parts.Leiterplatte?.color ?? '#000';const [cr, cg, cb] = [1, 3, 5].map((i) => parseInt(green.slice(i, i + 2), 16));check('Namen und Farben kommen aus der STEP-Datei (Leiterplatte grün, Stecker in Gruppe „Platine/Stecker")', cg > cr && cg > cb && parts.USB_C?.group === 'Platine/Stecker', `${green} ${parts.USB_C?.group}`);await shot('15-gruppen');- const groupRow = (name) => `[...document.querySelectorAll('#tab-model .row.gr')].find((r) => r.querySelector('.gname').textContent === ${JSON.stringify(name)})`;- const partRow = (name) => `[...document.querySelectorAll('#tab-model .row:not(.gr)')].find((r) => r.querySelector('.pname')?.textContent === ${JSON.stringify(name)})`;const clickIn = (rowExpr, sel) => ev(`(${rowExpr}).querySelector(${JSON.stringify(sel)}).click()`);const ids = (names) => names.map((n) => parts[n].id);const visible = (names) => ev((l) => l.map((id) => window.__t.viewer.isVisible(id)), ids(names));const ghosted = (names) => ev((l) => l.map((id) => window.__t.viewer.isGhosted(id)), ids(names));// 2) Gruppe aus- und einblenden- await clickIn(groupRow('Gehäuse'), '.eye:not(.gh)');+ await clickIn(groupRow('Gehäuse'), '.eye');+ tr = await ev(() => window.__t.tree());check('Auge der Gruppe „Gehäuse" blendet alle drei Teile aus, auch in der Untergruppe', (await visible(['Boden', 'Deckel', 'Schraube'])).every((v) => !v) && (await visible(['Leiterplatte']))[0]);- await clickIn(groupRow('Gehäuse'), '.eye:not(.gh)');- check('Noch einmal: alle wieder da', (await visible(['Boden', 'Deckel', 'Schraube'])).every(Boolean));+ check('Ausgeblendet: Namen grau, Fuß „3 hidden“ mit Show all', tr.rows.filter((x) => x.hidden).map((x) => x.name).join() === 'Gehäuse,Boden,Deckel,Schrauben,Schraube'+ && tr.foot === '3 hiddenShow all', JSON.stringify(tr.foot));+ await ev(() => window.__t.treeOpen(false));+ tr = await ev(() => window.__t.tree());+ check('Eingeklappt: „· 3 hidden“ neben dem Namen', tr.head === `${proj.name}· 3 hidden`, tr.head);+ await shot('15a-baum-zu');+ await ev(() => window.__t.treeOpen(true));+ await ev(() => document.querySelector('#tree .tr-ft button').click());+ check('Show all im Fuß: alle wieder da, Fuß weg', (await visible(['Boden', 'Deckel', 'Schraube'])).every(Boolean) && (await ev(() => window.__t.tree())).foot === '');// 3) Zuklappenawait clickIn(groupRow('Gehäuse'), '.nm');r = await rows();- check('Gruppe zuklappen: ihre Teile verschwinden aus der Liste, sichtbar bleiben sie im Modell', !r.some((x) => ['Boden', 'Deckel', 'Schraube', 'Schrauben'].includes(x.name)) && (await visible(['Boden']))[0]);+ check('Gruppe zuklappen: ihre Teile verschwinden aus dem Baum, sichtbar bleiben sie im Modell', !r.some((x) => ['Boden', 'Deckel', 'Schraube', 'Schrauben'].includes(x.name)) && (await visible(['Boden']))[0]);await clickIn(groupRow('Gehäuse'), '.nm');// 4) Transparenz: Von oben liegt der Deckel über der Platine. Deckend trifft der Klick den Deckel, transparent die Platine.@@ -103,6 +122,12 @@ try {&& await ev(`(${partRow('Deckel')}).querySelector('.gh').getAttribute('aria-pressed') === 'true'`), JSON.stringify(look));await page.click(center.x, center.y);await waitFor('Auswahl Platine', () => window.__t.info().startsWith('Leiterplatte'), 5000).catch(() => {});+ tr = await ev(() => window.__t.tree());+ check('Klick ins Modell markiert das Teil im Baum', tr.rows.find((x) => x.name === 'Leiterplatte')?.sel && tr.rows.filter((x) => x.sel).length === 1, JSON.stringify(tr.rows.filter((x) => x.sel)));+ await ev(`(${groupRow('Platine')}).querySelector('.chev').click()`);+ tr = await ev(() => window.__t.tree());+ check('Gruppe zugeklappt: Die Gruppe trägt die Markierung', tr.rows.find((x) => x.name === 'Platine')?.sel && tr.rows.filter((x) => x.sel).length === 1, JSON.stringify(tr.rows.filter((x) => x.sel)));+ await ev(`(${groupRow('Platine')}).querySelector('.chev').click()`);check('Transparent: derselbe Klick geht durch den Deckel und trifft die Leiterplatte', (await ev(() => window.__t.info())).startsWith('Leiterplatte'), (await ev(() => window.__t.info())).slice(0, 30));check('Auswahltext für den Agenten nennt die Gruppe', /part "Leiterplatte" in group "Platine"/.test(await ev(() => window.__t.selectionText())), (await ev(() => window.__t.selectionText())).slice(0, 70));await clickIn(groupRow('Stecker'), '.gh');@@ -121,10 +146,87 @@ try {await ev(() => window.__t.viewer.showAll());// 6) Suche findet Teile samt ihren Gruppen- await ev(() => { document.getElementById('btn-parts-search').click(); const f = document.getElementById('parts-filter'); f.value = 'usb'; f.dispatchEvent(new Event('input')); });+ await ev(() => { document.querySelector('#tree .tr-hd .hb').click(); const f = document.querySelector('#tree .tr-search input'); f.value = 'usb'; f.dispatchEvent(new Event('input')); });r = await rows();- check('Suche „usb": USB_C mit seinen Gruppen Platine und Stecker', r.filter((x) => x.kind !== 'section').map((x) => x.name).join(',') === 'Platine,Stecker,USB_C', r.map((x) => x.name).join(','));- await ev(() => document.getElementById('btn-parts-search').click());+ tr = await ev(() => window.__t.tree());+ check('Suche „usb": USB_C mit seinen Gruppen (auch zugeklappte gehen auf), „1 of 6“', r.map((x) => x.name).join(',') === 'References,Platine,Stecker,USB_C'+ && tr.hits === '1 of 6' && tr.searching, r.map((x) => x.name).join(',') + ' ' + tr.hits);+ await shot('16b-baum-suche');+ await ev(() => document.querySelector('#tree .tr-search .hb').click());+ check('Suche schließen: Kopf wieder da, alle Zeilen', !(await ev(() => window.__t.tree())).searching && (await rows()).length === 11);++ // 6b) Mehrfachauswahl im Baum (Strg, Shift), Tasten H, Shift H, I, T, Esc, Ziehen über die Augen, Rahmenauswahl mit Alt und+ // Rechtsklick ins Bild+ const nameClick = (name, mods = {}) => ev(`(${partRow(name)}).querySelector('.nm').dispatchEvent(new MouseEvent('click', { bubbles: true, ...${JSON.stringify(mods)} }))`);+ const key = (k, mods = {}) => ev(`document.body.dispatchEvent(new KeyboardEvent('keydown', { key: ${JSON.stringify(k)}, bubbles: true, cancelable: true, ...${JSON.stringify(mods)} }))`);+ const pickedNames = () => ev(() => window.__t.picked());+ await nameClick('Boden');+ await nameClick('Schraube', { ctrlKey: true });+ tr = await ev(() => window.__t.tree());+ check('Strg+Klick im Baum: zwei Teile ausgewählt, beide markiert, Karte „2 parts selected“', JSON.stringify(await pickedNames()) === '["Boden","Schraube"]'+ && tr.rows.filter((x) => x.sel).map((x) => x.name).join() === 'Boden,Schraube' && (await ev(() => window.__t.info())).startsWith('2 parts selected'), JSON.stringify(await pickedNames()));+ await nameClick('Boden');+ await nameClick('Leiterplatte', { shiftKey: true });+ check('Shift+Klick: Bereich vom letzten Klick bis hier, über Gruppen hinweg', JSON.stringify(await pickedNames()) === '["Boden","Deckel","Schraube","Leiterplatte"]', JSON.stringify(await pickedNames()));+ await key('h');+ check('H blendet die Auswahl aus und hebt sie auf', (await visible(['Boden', 'Deckel', 'Schraube', 'Leiterplatte'])).every((v) => !v) && (await visible(['USB_C']))[0]+ && (await pickedNames()).length === 0);+ await key('H', { shiftKey: true });+ check('Shift+H blendet alles wieder ein', (await visible(['Boden', 'Deckel', 'Schraube', 'Leiterplatte', 'USB_C', 'Pinleiste'])).every(Boolean));+ await nameClick('Boden');+ await nameClick('Deckel', { ctrlKey: true });+ await key('i');+ check('I isoliert die Auswahl', (await visible(['Boden', 'Deckel'])).every(Boolean) && (await visible(['Schraube', 'Leiterplatte', 'USB_C'])).every((v) => !v));+ await key('H', { shiftKey: true });+ await key('t');+ const ghostOn = await ghosted(['Boden', 'Deckel']);+ await key('t');+ check('T schaltet die Auswahl transparent und wieder deckend', ghostOn.every(Boolean) && (await ghosted(['Boden', 'Deckel'])).every((v) => !v), JSON.stringify(ghostOn));+ await key('Escape');+ check('Esc hebt die Auswahl auf', (await pickedNames()).length === 0 && !(await ev(() => window.__t.tree())).rows.some((x) => x.sel));+ // Mit gedrückter Maus über die Augen: Jede überfahrene Zeile wird wie die erste geschaltet, die Gruppe nicht+ await ev(`(${partRow('Boden')}).querySelector('.eye').dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, button: 0, buttons: 1 }))`);+ for (const n of ['Deckel', 'Schraube']) await ev(`(${partRow(n)}).querySelector('.eye').dispatchEvent(new PointerEvent('pointerover', { bubbles: true, buttons: 1 }))`);+ await ev(() => window.dispatchEvent(new PointerEvent('pointerup', { button: 0 })));+ await ev(`(${partRow('Leiterplatte')}).querySelector('.eye').dispatchEvent(new PointerEvent('pointerover', { bubbles: true, buttons: 0 }))`);+ check('Über die Augen ziehen: Boden, Deckel und Schraube aus, Leiterplatte (nach dem Loslassen) nicht', (await visible(['Boden', 'Deckel', 'Schraube'])).every((v) => !v)+ && (await visible(['Leiterplatte']))[0], JSON.stringify(await visible(['Boden', 'Deckel', 'Schraube', 'Leiterplatte'])));+ await key('H', { shiftKey: true });+ // Rahmenauswahl: Alt + links ziehen über das ganze Modell (von links nach rechts: ganz darin), die Kamera bleibt stehen+ await ev(() => window.__t.viewer.setView('top'));+ await sleep(200);+ const a = await ev(() => window.__t.viewer.screenAt([-45, 32, 0]));+ const b = await ev(() => window.__t.viewer.screenAt([45, -32, 0]));+ const cam0 = JSON.stringify((await ev(() => window.__t.viewer.viewState())).dir);+ const drag = (from, to, mods) => ev(({ from, to, mods }) => {+ const c = document.querySelector('#viewer > canvas');+ const r = c.getBoundingClientRect();+ const at = (p, type, buttons) => c.dispatchEvent(new PointerEvent(type, { bubbles: true, cancelable: true, button: 0, buttons, pointerId: 1, clientX: r.left + p.x, clientY: r.top + p.y, altKey: true, ...mods }));+ at(from, 'pointerdown', 1);+ at({ x: (from.x + to.x) / 2, y: (from.y + to.y) / 2 }, 'pointermove', 1);+ at(to, 'pointermove', 1);+ at(to, 'pointerup', 0);+ }, { from, to, mods });+ await drag(a, b, {});+ check('Alt + ziehen von links nach rechts: alle sechs Teile im Rahmen ausgewählt, Kamera unverändert', (await pickedNames()).length === 6+ && JSON.stringify((await ev(() => window.__t.viewer.viewState())).dir) === cam0, JSON.stringify(await pickedNames()));+ const mid = await ev(() => window.__t.viewer.screenAt([0, 0, 8.8]));+ await drag({ x: mid.x + 6, y: mid.y - 6 }, { x: mid.x - 6, y: mid.y + 6 }, {});+ const crossed = await pickedNames();+ check('Von rechts nach links, kleiner Rahmen mitten auf dem Deckel: angeschnittene Teile zählen (Deckel)', crossed.includes('Deckel') && !crossed.includes('USB_C'), JSON.stringify(crossed));+ await drag(a, b, {});+ // Rechtsklick ins Bild auf ein ausgewähltes Teil: Menü für die ganze Auswahl+ await ev((p) => {+ const c = document.querySelector('#viewer > canvas');+ const r = c.getBoundingClientRect();+ for (const type of ['pointerdown', 'pointerup']) c.dispatchEvent(new PointerEvent(type, { bubbles: true, button: 2, buttons: type === 'pointerdown' ? 2 : 0, pointerId: 1, clientX: r.left + p.x, clientY: r.top + p.y }));+ }, mid);+ const ctx = await ev(() => ({ open: !document.getElementById('menu-ctx').hidden, text: [...document.querySelectorAll('#menu-ctx .mh, #menu-ctx .mi')].map((x) => x.textContent) }));+ check('Rechtsklick ins Bild auf die Auswahl: Menü „6 parts selected“ mit Isolate, Hide und Tasten', ctx.open && ctx.text[0] === '6 parts selected'+ && ctx.text.some((x) => x.startsWith('Isolate 6 parts') && x.endsWith('I')) && ctx.text.some((x) => x.startsWith('Hide 6 parts') && x.endsWith('H')), JSON.stringify(ctx));+ await shot('16c-auswahl-menue');+ await key('Escape');+ await key('Escape');// 7) Ausgabe-STEP: Gruppen als Unterbaugruppen, Referenzen unter „Reference" (bis E73 „Referenz")const tree = py(`diff --git a/app/test/settings.mjs b/app/test/settings.mjsindex 05d8e41..08e673e 100644--- a/app/test/settings.mjs+++ b/app/test/settings.mjs@@ -86,7 +86,7 @@ try {await waitFor('Einstellungen offen', () => window.__t.settings().open, 5000);const nav = await ev(() => [...document.querySelectorAll('#st-nav button')].map((b) => `${b.dataset.sec}:${b.textContent.trim()}`));const st0 = await ev(() => window.__t.settings());- check('Einstellungen: Reiter Viewer, Skills, Storage, About, ohne Ziel offen im Reiter Viewer', JSON.stringify(nav) === '["viewer:Viewer","skills:Skills","storage:Storage","about:About"]'+ check('Einstellungen: Reiter Viewer, Shortcuts, Skills, Storage, About, ohne Ziel offen im Reiter Viewer', JSON.stringify(nav) === '["viewer:Viewer","keys:Shortcuts","skills:Skills","storage:Storage","about:About"]'&& st0.section === 'viewer' && await ev(() => !document.getElementById('st-viewer').hidden && document.getElementById('st-skills').hidden), nav.join(','));let pv = (await pages()).viewer.text;let cam = await vs();@@ -231,6 +231,12 @@ try {fs.writeFileSync(path.join(ud, 'previews', fakeId, 'abc1234', 'model.glb'), Buffer.alloc(1024 * 1024));fs.mkdirSync(path.join(ud, 'previews', proj2.id, 'def5678'), { recursive: true });fs.writeFileSync(path.join(ud, 'previews', proj2.id, 'def5678', 'model.glb'), Buffer.alloc(2048));+ await ev(() => window.__t.settingsShow('keys'));+ const keys = await ev(() => document.getElementById('st-keys').textContent);+ check('Reiter Shortcuts: Tasten für Auswahl (H, I, T, Alt + Drag), Navigation nach der gewählten Mausbelegung', !(await ev(() => document.getElementById('st-keys').hidden))+ && keys.includes('Isolate: show only the selected parts') && keys.includes('Alt+DragBox select') && keys.includes('Shift+HShow all parts again')+ && keys.includes('Navigation as set under Viewer (SolidWorks)') && keys.includes('middle dragRotate'), keys.slice(0, 300));+ await shot('settings-1b-shortcuts');await ev(() => window.__t.settingsShow('storage'));await waitFor('Speicherplatz berechnet', () => { const s = window.__t.settingsPages().storage; return !s.loading && !!s.stats; }, 30000);let sp = (await pages()).storage;diff --git a/app/test/smoke.mjs b/app/test/smoke.mjsindex 871fe29..e9f133c 100644--- a/app/test/smoke.mjs+++ b/app/test/smoke.mjs@@ -33,7 +33,7 @@ try {const versionUi = await ev(() => ({ start: document.getElementById('start-version').textContent, logo: document.getElementById('btn-home').title }));check('Version (E68): in project.json, auf der Startseite und am Logo', JSON.parse(fs.readFileSync(path.join(proj.dir, '.soma', 'project.json'), 'utf8')).app_version === appVersion&& versionUi.start === appVersion && versionUi.logo === `Start page · SOMA ${appVersion}`, `${appVersion} ${JSON.stringify(versionUi)}`);- check('Erster Build automatisch, 2 Bauteile in der Bauteilkarte', JSON.stringify(await ev(() => window.__t.treeNames())) === '["Body","Lid"]');+ check('Erster Build automatisch, 2 Bauteile im Strukturbaum', JSON.stringify(await ev(() => window.__t.treeNames())) === '["Body","Lid"]');check('Nach dem Build kein Fehlerhinweis', (await status()).viewerMsg === '', (await status()).text);const okStatus = await status();check('Build-Anzeige oben: „Built · 2 parts"', okStatus.text === 'Built' && okStatus.detail.startsWith('2 parts'), `${okStatus.text} ${okStatus.detail}`);@@ -55,14 +55,24 @@ try {await shot('1-arbeitsbereich');- check('Seitenleiste zeigt beim ersten Start die Bauteile, Code ist zu (Entwurf 2)', JSON.stringify(await ev(() => window.__t.layout())) === '{"side":"parts","code":false,"agent":true}',+ check('Seitenleiste beim ersten Start zu, Code zu: Die Bauteile stehen im Baum im Viewer (E82)', JSON.stringify(await ev(() => window.__t.layout())) === '{"side":null,"code":false,"agent":true}',JSON.stringify(await ev(() => window.__t.layout())));+ const rail = await ev(() => [...document.querySelectorAll('#rail > *')].map((x) => (x.classList.contains('rail-sep') ? '|' : x.dataset?.panel ?? '')).filter(Boolean).join(' '));+ check('Leiste in drei Gruppen: Parameters, Files | Analysis, Animation | Skills, kein Reiter Parts', rail === 'params files | analysis anim | skills', rail);+ let tree = await ev(() => window.__t.tree());+ check('Strukturbaum oben links: eingeklappt nur der Name des Modells', !tree.open && tree.head === proj.name && tree.rows.length === 0, JSON.stringify(tree.head));+ await ev(() => window.__t.treeOpen(true));+ tree = await ev(() => window.__t.tree());+ check('Aufgeklappt: Body und Lid, Lid als Auswahl orange, Auge und Halbkreis je Zeile', tree.rows.map((x) => x.name).join() === 'Body,Lid'+ && tree.rows.find((x) => x.name === 'Lid')?.sel && await ev(() => document.querySelectorAll('#tree .tr-row .tg').length === 4), JSON.stringify(tree.rows));+ await shot('1b-baum');+ await ev(() => window.__t.treeOpen(false));// Code als eigene Spalte und Dateien gleichzeitig (Entwurf 2)await domClick('btn-sel-code');await waitFor('Code-Spalte', () => window.__t.codeText().includes('add_part("Lid"'), 10000).catch(() => {});- check('„Code" in der Auswahlkarte zeigt model.py in der Code-Spalte, die Bauteile bleiben offen', (await ev(() => window.__t.codeText())).includes('add_part("Lid"')- && JSON.stringify(await ev(() => window.__t.layout())) === '{"side":"parts","code":true,"agent":true}');+ check('„Code" in der Auswahlkarte zeigt model.py in der Code-Spalte, die Seitenleiste bleibt zu', (await ev(() => window.__t.codeText())).includes('add_part("Lid"')+ && JSON.stringify(await ev(() => window.__t.layout())) === '{"side":null,"code":true,"agent":true}');await shot('2-code');await ev(() => window.__t.showPanel('files'));await waitFor('Dateiliste', () => window.__t.fileRows().includes('model.py'), 10000).catch(() => {});@@ -77,7 +87,7 @@ try {await ev(() => document.dispatchEvent(new KeyboardEvent('keydown', { key: '1', ctrlKey: true, bubbles: true })));const lay2 = await ev(() => window.__t.layout());check('Spalten-Schalter oben: Code und Seitenleiste zu, Strg 1 bringt die letzte Ansicht (Dateien) wieder', !lay.code && lay.side === null && lay2.side === 'files', `${JSON.stringify(lay)} ${JSON.stringify(lay2)}`);- await ev(() => window.__t.showPanel('parts'));+ await ev(() => window.__t.showPanel(null));// Export mit Dateidialog (statt nach exports/): ein Bauteil aus der Auswahlkarte, alle Bauteile in einen Ordnerconst expDir = fs.mkdtempSync(path.join(os.tmpdir(), 'soma-export-test-'));@@ -250,20 +260,11 @@ try {await ev(() => document.body.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true })));check('Escape ohne Zeichnung schließt die Zeichenfläche, es entsteht keine Datei', again && !(await ev(() => window.__t.markup().active)) && fs.readdirSync(fbDir).length === 1);- // Ziehen ins Terminal ersetzt die Übergabeleiste (Entwurf 2): Bauteil aus der Seitenleiste fallen lassen- const dropOver = await ev(() => {- const dt = new DataTransfer();- dt.setData('application/x-soma-part', window.__t.parts().find((p) => p.name === 'Body').id);- const pane = [...document.querySelectorAll('#term-panes .term-pane')].find((x) => !x.hidden) ?? document.getElementById('term-panes');- pane.dispatchEvent(new DragEvent('dragover', { dataTransfer: dt, bubbles: true, cancelable: true }));- const over = document.getElementById('term-panes').classList.contains('dropping');- pane.dispatchEvent(new DragEvent('drop', { dataTransfer: dt, bubbles: true, cancelable: true }));- return over;- });- await waitFor('Verweis im Terminal', (id) => window.__t.termText(id).includes('[Selection: part "Body"'), 10000, tid).catch(() => {});- check('Bauteil ins Terminal gezogen: Hinweis beim Darüberziehen, Verweis in der Eingabe, keine Übergabeleiste mehr', dropOver && !(await ev(() => document.getElementById('handoff')))- && (await ev((id) => window.__t.termText(id), tid)).includes('[Selection: part "Body"'));- await ev((id) => window.soma.term.write(id, '\x03'), tid);+ // Bauteile gehen über „Send to agent“ in der Auswahlkarte an den Agenten, die Zeilen des Baums lassen sich nicht mehr ziehen (E82)+ await ev(() => window.__t.treeOpen(true));+ check('Zeilen des Strukturbaums sind nicht ziehbar, keine Übergabeleiste', await ev(() => [...document.querySelectorAll('#tree .tr-row')].every((r) => !r.draggable))+ && !(await ev(() => document.getElementById('handoff'))));+ await ev(() => window.__t.treeOpen(false));// Dateibaum: Markierungen sichtbar, anlegen, umbenennen, löschen über Menü und Tastenawait ev(() => window.__t.showPanel('files'));