From 6698d8690ae9c53d649ee147d9ffb2958a64cb54 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 14 Nov 2026 01:32:48 +0000 Subject: [PATCH] [252] Englisch: Geschoss = floor durchgehend; Tab immer Befehlszeile, Ctrl+Tab/Ctrl+Umschalt+Tab durch die Ansichts-Reiter --- TODO.md | 1 + e2e/tabKey252.spec.ts | 33 +++++++++++++++++++ src/i18n/de.ts | 2 ++ src/i18n/en.ts | 50 +++++++++++++++-------------- src/state/keyboardShortcuts.test.ts | 18 +++++++++++ src/state/keyboardShortcuts.ts | 12 +++++++ src/state/shortcutOverview.test.ts | 10 ++++-- src/state/shortcutOverview.ts | 18 ++++++++--- src/state/tabNavigation.ts | 12 ++++++- src/state/useKeyboardShortcuts.ts | 15 +++++++-- src/state/viewTabs.test.ts | 20 ++++++++++++ src/state/viewTabs.ts | 12 +++++++ 12 files changed, 169 insertions(+), 34 deletions(-) create mode 100644 e2e/tabKey252.spec.ts diff --git a/TODO.md b/TODO.md index 92036ba4..f45aeef4 100644 --- a/TODO.md +++ b/TODO.md @@ -1253,6 +1253,7 @@ Einzeilig mit ID, Titel, Datum (2026). Kleine Reste erledigter Punkte (z. B. [T7 exakte Durchdringung, [61] Zuordnung per Hand, [63] Profil je Kante, [70] Flächentabelle als Layout-Element, [80] Einzelplan-PDF ohne Ebenen, [82] Legende per Ziehen) stehen im Archiv beim jeweiligen Eintrag. +- [252] Englisch „Geschoss“ = **floor** durchgehend (`en.ts`: storey/storeys → floor/floors; IFC-Schema-Namen und Bezeichner unberührt), Tab immer Befehlszeile (Ctrl+Tab / Ctrl+Umschalt+Tab = Ansichts-Reiter zyklisch, fest verdrahtet, auf dem Mac Ctrl; in Overlay-Dialogen bleibt Tab bei deren Feldern; `tabKeyAction`, `cycleTab`, Kürzel-Übersicht de/en, e2e `tabKey252.spec.ts`) (14.11.; nicht auf dem Mac geprüft, e2e nicht gelaufen, falls nicht anders vermerkt) - [244] Darstellungsarten-Menü im 3D übersichtlicher (13.11., Wunsch Maintainer, folgt auf [240]): gemeinsames `Dropdown` rückwärtskompatibel erweitert (optionale `group`, `icon`, `hint`, `shortcut` je Option; `optionRows`/`DropdownRows` exportiert, Überschriften und Trennlinien, Zweitzeile + Tooltip, Kürzel rechts). 3D-Menü (`renderModeOptions` in `TopBar.tsx`): Linien (Drahtgitter, Kanten, Nur Konturen) · Flächen (Schattiert, mit Kanten, Texturiert, Weiss) · Rendern (Pathtracing) mit Material-Symbols-Icons und Erklärung („Pathtracing: Physikalisch, rechnet fortlaufend“); de + en. Kürzel gibt es für die Stile keine. 2D-Plan (Farbig/Tusche) unverändert. Geprüft: tsc, vitest `src/ui src/i18n src/viewport`, e2e overridesTab, roomStamp218, viewTemplates, [212]-Pathtracer-Test (Chromium, Port 5194), Screenshots hell/dunkel vorher/nachher. Nicht in der Tauri-App/macOS geprüft. - [245] Begehen wie im Architektur-Walkthrough (13.11., Wunsch Maintainer; zu [213]). Nur TS/Viewport. `viewport/walkCollision.ts`: Raster (Zelle 2 m, Grundrissebene) aus `projectToModel3d(…, { forWalk: true })` (ohne Türflügel/Rahmen/Handläufe): Wände als Kapseln entlang der Achse mit Löchern (Loch bis zur Wand-UK = Tür, frei; Loch mit Brüstung = Fenster, Glasebene sperrt), Decken-/Trittkanten und senkrechte Netz-Dreiecke (Stützen, Körper) als Hindernisse, Oberseiten von Decken/Tritten und flache Dreiecke (Gelände, Dächer, Rampen) als Boden. Person: Zylinder r 0.25 m, 1.8 m hoch, Stufen bis 0.25 m; Bewegung in Teilschritten, hinausgeschoben (gleitet an Wänden). `walk.ts::stepWalkCollide`: Fusshöhe folgt dem Boden (ein Boden-Test je Bild, Aufstieg geglättet, Absturz sanft mit Fallgrenze 5 m/s), Q/E ändern die Augenhöhe (0.5–2.3 m); Takt läuft weiter, bis die Höhe angekommen ist. G = Geist (Kollision/Bodenfolge aus), auch als Knopf neben „Begehen“ und in der Tastenhilfe. Tests: `walkCollision.test.ts` (Wand, Gleiten, Tür/Fenster, Stufe 0.4/0.2, Treppe, Kante), `ViewportToolbar3d.test.ts`, e2e `walk.spec.ts`. Offen: Decken-Unterseiten begrenzen den Kopf nicht (kein Löcher-Test der Decken: Treppenhaus würde sonst klemmen); Wände mit Formöffnung als volle Box; Fenster mit Brüstung 0 gelten als Tür; keine echte 3D-Anzeige im Container: Bewegung nur per Test belegt, nicht am Mac/in der Tauri-App gesehen. - [246] Kamerafahrt (13.11., Folge aus [213]; nur TS, Chromium; Mac/Tauri nicht geprüft): Knopf „▶ Kamerafahrt“ in der Kamera-Gruppe (Panel „Ausschnitte“) fährt im 3D-Viewport in Listenreihenfolge durch die Kameras (Catmull-Rom „flüssig“ oder „geglättet“ mit Smoothstep, Bildwinkel linear, Dauer je Abschnitt Vorgabe 4 s; Esc oder Klick bricht ab; Kameras bleiben unverändert, kein Op); „Video …“ öffnet den Dialog mit Dauer, Interpolation, Format (WebM, MP4 nur wenn `MediaRecorder` es kann), Auflösung = Viewport, 30 Bilder/s, Fortschritt und Abbruch, Speichern über `saveBinaryFile`. Code: `viewport/cameraTour.ts` (Interpolation), `cameraTourPlayer.ts`, `videoRecorder.ts`, `state/cameraTourActions.ts`, `ui/CameraTourDialog.tsx` + `cameraTourDialogState.ts`; Tests vitest je Modul, e2e `cameraTour.spec.ts`. Offen: Aufnahme unter Tauri/WKWebView (fehlt `MediaRecorder` auf dem Canvas, meldet der Dialog per `notify`), Bildinhalt der Aufnahme nicht gesehen (headless WebGPU leer), im Stil Pathtracing nur Vorschau-Qualität. diff --git a/e2e/tabKey252.spec.ts b/e2e/tabKey252.spec.ts new file mode 100644 index 00000000..5c6add49 --- /dev/null +++ b/e2e/tabKey252.spec.ts @@ -0,0 +1,33 @@ +// [252] Tab bleibt immer für die Befehlszeile (auch bei Fokus auf einem Panel-Knopf); Ctrl+Tab / Ctrl+Umschalt+Tab +// springt zyklisch durch die Ansichts-Reiter. +import { commandInput, discardIfAsked, drawingTabs, expect, fileMenu, openTab, test } from "./app"; + +test("Tab fokussiert die Befehlszeile, Ctrl+Tab wechselt die Reiter", async ({ page }) => { + test.setTimeout(150_000); + await page.goto("/?dossierTest"); + await page.getByRole("button", { name: /Neues Projekt/ }).first().click(); + await expect(page.getByRole("group", { name: "Befehlszeile" })).toBeVisible(); + await fileMenu(page, /Musterhaus \(komplex\)/); + await discardIfAsked(page); + await expect(page.locator(".project-name")).toHaveText("Musterhaus komplex", { timeout: 30_000 }); + + // Tab aus einem Panel-Knopf landet in der Befehlszeile. + await page.getByRole("tab", { name: "Elemente", exact: true }).focus(); + await page.keyboard.press("Tab"); + await expect(commandInput(page)).toBeFocused(); + + // Zwei Reiter: Grundriss + 3D (Ctrl+3 öffnet den 3D-Reiter). + await openTab(page, "Zeichnungsebenen"); + await page.locator(".nav-row").filter({ hasText: "Erdgeschoss" }).first().click(); + await page.keyboard.press("Control+3"); + const tabs = drawingTabs(page).getByRole("tab"); + await expect(tabs).toHaveCount(2); + const selected = async () => tabs.evaluateAll((els) => els.findIndex((e) => e.getAttribute("aria-selected") === "true")); + const start = await selected(); + await page.keyboard.press("Control+Tab"); + await expect.poll(selected).toBe((start + 1) % 2); + await page.keyboard.press("Control+Shift+Tab"); + await expect.poll(selected).toBe(start); + await page.keyboard.press("Control+Shift+Tab"); + await expect.poll(selected).toBe((start + 1) % 2); +}); diff --git a/src/i18n/de.ts b/src/i18n/de.ts index e1fedd00..752fc4bb 100644 --- a/src/i18n/de.ts +++ b/src/i18n/de.ts @@ -3303,6 +3303,8 @@ export const de = { "shortcut.toolRoom": "Werkzeug: Raum", "shortcut.floorDown": "Geschoss tiefer", "shortcut.floorUp": "Geschoss höher", + "shortcut.nextViewTab": "Nächster Reiter (Ansicht)", + "shortcut.prevViewTab": "Voriger Reiter (Ansicht)", "shortcut.showSelection3d": "Auswahl in 3D zeigen (ohne Auswahl: alles)", "shortcut.objectSettings": "Einstellungen des gewählten Objekts öffnen (ohne Auswahl: Werkzeug-Voreinstellung)", "shortcut.hideSelection3d": "Auswahl im 3D ausblenden", diff --git a/src/i18n/en.ts b/src/i18n/en.ts index 80d62043..b4440623 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -642,7 +642,7 @@ export const en: Record = { "objinfo.wall.top": "Top (OK)", "objinfo.wall.anchorFloor": "Bound", "objinfo.wall.anchorCustom": "Custom", - "objinfo.anchor.refFloor": "Reference storey", + "objinfo.anchor.refFloor": "Reference floor", "objinfo.anchor.customHeight": "Custom height", "objinfo.wall.length": "Length", "objinfo.wall.volumeGross": "Gross", @@ -859,8 +859,8 @@ export const en: Record = { "objinfo.opening.kind.window": "Window", "objinfo.opening.kind.door": "Door", "objinfo.opening.hostWall": "Host wall", - "objinfo.opening.hostRoof": "Host roof (storey)", - "objinfo.opening.hostCeiling": "Host slab (storey)", + "objinfo.opening.hostRoof": "Host roof (floor)", + "objinfo.opening.hostCeiling": "Host slab (floor)", "objinfo.opening.surfaceWidth": "Width (across slope)", "objinfo.opening.surfaceHeight": "Height (along slope)", "objinfo.opening.hostX": "Position X", @@ -1027,7 +1027,7 @@ export const en: Record = { "objinfo.extrudedSolid.component.none": "– neutral –", "objinfo.extrudedSolid.componentHint": "Material of the cut face (fill and hatch in plan and section)", "objinfo.extrudedSolid.brep": "B-rep solid", - "objinfo.extrudedSolid.baseOffset": "Offset above storey base", + "objinfo.extrudedSolid.baseOffset": "Offset above floor base", "objinfo.extrudedSolid.subtract": "Subtraction body", "objinfo.extrudedSolid.subtractHint": "Subtracts the body from walls, slabs and columns (recess/penetration)", "objinfo.extrudedSolid.volume": "Volume", @@ -1172,9 +1172,9 @@ export const en: Record = { "editor.floorHeight": "Floor height", "editor.cutHeight": "Cut height", "editor.levelElevation": "Finished floor level", - "editor.levelElevation.hint": "Type the level relative to ±0.00; the storey height below (below ±0.00: its own) adapts", + "editor.levelElevation.hint": "Type the level relative to ±0.00; the floor height below (below ±0.00: its own) adapts", "editor.zeroLevel": "Datum ±0.00", - "editor.zeroLevel.hint": "This storey is at ±0.00; storeys below get negative elevations.", + "editor.zeroLevel.hint": "This floor is at ±0.00; floors below get negative elevations.", "editor.viewTop": "View top", "editor.viewBottom": "View bottom", "editor.viewDepth": "Visible below down to", @@ -1404,7 +1404,7 @@ export const en: Record = { "resources.viewTemplates.shadows": "Shadows", "resources.viewTemplates.hiddenLines": "Hidden lines", "resources.viewTemplates.cutHatch": "Hatched cut areas at 1:100 (instead of solid black)", - "resources.viewTemplates.showTerrain": "Show terrain, contours and excavation (unset: only the ±0.00 storey and site plan)", + "resources.viewTemplates.showTerrain": "Show terrain, contours and excavation (unset: only the ±0.00 floor and site plan)", "resources.viewTemplates.floorFinish": "Show floor finish (unset: from 1:50 or “fine”)", "resources.viewTemplates.floorFinish.off": "off", "resources.viewTemplates.floorFinish.wet": "Wet rooms (tiles, coarser than 1:50)", @@ -2001,7 +2001,7 @@ export const en: Record = { "cmd.void.corner": "First corner of the penetration:", "cmd.void.corner2": "Opposite corner:", "cmd.void.height": "Height (Enter = last):", - "cmd.void.offset": "Offset above storey base (Enter = last):", + "cmd.void.offset": "Offset above floor base (Enter = last):", "cmd.solid.label": "Solid", "cmd.solid.center": "Center or first corner:", "cmd.solid.radius": "Radius:", @@ -2031,11 +2031,11 @@ export const en: Record = { "cmd.ceilingOpening.start": "First corner of the opening (inside a slab):", "cmd.ceilingOpening.corner": "Opposite corner:", "cmd.roofHole.label": "Roof court", - "cmd.needsFloor": "This command draws in plan view: select a storey first", + "cmd.needsFloor": "This command draws in plan view: select a floor first", "cmd.excavation.noTerrain": "An excavation needs terrain: import contour lines and “Generate terrain” (Terrain panel) or import the site first", "cmd.excavation.outside": "No excavation: the outline lies outside the terrain", "cmd.excavation.degenerate": "No excavation: the outline has no area", - "cmd.excavation.created": "Excavation created: bottom {bottom} m (lowest storey − 0.30), slope 45° — adjust in Object Info", + "cmd.excavation.created": "Excavation created: bottom {bottom} m (lowest floor − 0.30), slope 45° — adjust in Object Info", "cmd.excavation.createdDatum": "Excavation created: bottom {bottom} m; the terrain is in m a.s.l., ±0.00 = {datum} m a.s.l. assumed (Settings)", "cmd.excavation.fillOnly": "Excavation created, but its bottom {bottom} m lies above the terrain: fill only — lower the bottom in Object Info", "cmd.terrain.noContours": "No terrain generated: there are no contour lines (import a DXF or the site)", @@ -2563,7 +2563,7 @@ export const en: Record = { "areas.note.agfSeparate": "The external floor area AGF is not part of GF and is shown separately.", "areas.note.kfFromWalls": "KF derived from wall footprints (minus rooms) and KGF rooms; columns and shafts only as a KGF room.", "areas.note.gvSolids": "GV = volume of the free solids (massing model).", - "areas.note.gvLevels": "GV ≈ GF × storey height per level.", + "areas.note.gvLevels": "GV ≈ GF × floor height per level.", "areas.note.terrainZero": "Reference terrain = ±0.00 (no terrain model).", "areas.note.agsfMissing": "Without a creditable plot area no ratios can be computed.", "areas.note.greenInput": "The green area cannot be derived from the model and must be entered.", @@ -2880,14 +2880,14 @@ export const en: Record = { "ifc.import.voids": "{n} openings not subtracted", "ifc.import.booleans": "{n} boolean solids simplified (first operand only)", "ifc.import.truncated": "aborted: too many triangles", - "ifc.import.elements": "{schema} imported: {walls} walls, {openings} doors/windows, {ceilings} slabs, {columns} columns, {rooms} rooms, {roofs} roofs, {stairs} stairs, {floors} new storeys; {meshes} elements as context meshes", + "ifc.import.elements": "{schema} imported: {walls} walls, {openings} doors/windows, {ceilings} slabs, {columns} columns, {rooms} rooms, {roofs} roofs, {stairs} stairs, {floors} new floors; {meshes} elements as context meshes", "ifc.import.kept": "{n} candidates (walls, slabs, roofs, stairs …) not safely mappable, kept as mesh", "ifc.import.classified": "{n} elements with a classification (eBKP-H …); noted in the name of context meshes", "ifc.importDialog.title": "Import IFC", "ifc.importDialog.asMesh": "As context meshes (default)", "ifc.importDialog.asMeshHint": "Every element as a non-editable mesh on the context layer, as in the file.", "ifc.importDialog.asElements": "As building elements", - "ifc.importDialog.asElementsHint": "Walls (including curved and gable walls), slabs, roofs, straight, L and spiral stairs, columns, beams, doors/windows, rooms and storeys become editable Dossier elements; anything not safely mappable stays a mesh.", + "ifc.importDialog.asElementsHint": "Walls (including curved and gable walls), slabs, roofs, straight, L and spiral stairs, columns, beams, doors/windows, rooms and floors become editable Dossier elements; anything not safely mappable stays a mesh.", "ifc.importDialog.import": "Import", "ifc.importReport.title": "IFC import: report", "ifc.importReport.recognized": "Imported as building elements", @@ -2901,7 +2901,7 @@ export const en: Record = { "ifc.importReport.roofs": "Roofs", "ifc.importReport.stairs": "Stairs", "ifc.importReport.beams": "Beams (as extruded solids)", - "ifc.importReport.floors": "New storeys", + "ifc.importReport.floors": "New floors", "ifc.importReport.types": "New types (wall, slab, roof, door, window)", "ifc.importReport.meshes": "Other elements as context mesh", "ifc.importReport.close": "Close", @@ -2994,7 +2994,7 @@ export const en: Record = { "kennzahlen.programIssue": "{name}: {status}", "kennzahlen.gf": "Gross floor area (SIA 416) from rooms", "kennzahlen.agf": "Chargeable floor area ≈ net floor area", - "kennzahlen.gv": "Building volume from the free solids, without them GFA × storey height", + "kennzahlen.gv": "Building volume from the free solids, without them GFA × floor height", "kennzahlen.az": "Floor area ratio (usable area / site)", "kennzahlen.uez": "Site coverage (built area / site)", "kennzahlen.parcelArea": "Site area", @@ -3170,7 +3170,7 @@ export const en: Record = { "exportSave.ifc.ebkphHint": "Main group per element type: wall, slab, column, stair = C, roof = F, window = E; doors stay unclassified. A suggestion for cost planning (CRB, eBKP-H, SN 506 511) — the model does not tell exterior from interior walls or know sub-groups.", "exportSave.ifc.layers": "Model layer (category code) as classification", "exportSave.ifc.layersHint": "System “Dossier-Ebenen”: code and name of each element's graphic layer (not a cost plan).", - "exportSave.ifc.zonesNote": "SIA 416 zones (HNF, NNF …) and storey areas are always included when rooms exist.", + "exportSave.ifc.zonesNote": "SIA 416 zones (HNF, NNF …) and floor areas are always included when rooms exist.", "exportSave.ifc.schema": "IFC schema", "exportSave.ifc.schema4": "IFC4 (default)", "exportSave.ifc.schema2x3": "IFC2x3 (Coordination View 2.0)", @@ -3221,7 +3221,7 @@ export const en: Record = { "settings.section.project": "Project", "settings.referenceElevation": "Elevation of ±0.00 (m a.s.l.)", "settings.referenceElevation.hint": - "Finished floor of the datum storey (±0.00) above sea level; shown in sections and elevations at the ±0.00 level mark.", + "Finished floor of the datum floor (±0.00) above sea level; shown in sections and elevations at the ±0.00 level mark.", "settings.lineCap": "Line ends", "settings.lineCap.butt": "Flat", "settings.lineCap.round": "Round", @@ -3290,6 +3290,8 @@ export const en: Record = { "shortcut.toolRoom": "Tool: Room", "shortcut.floorDown": "Story down", "shortcut.floorUp": "Story up", + "shortcut.nextViewTab": "Next view tab", + "shortcut.prevViewTab": "Previous view tab", "shortcut.showSelection3d": "Show selection in 3D (no selection: everything)", "shortcut.objectSettings": "Open settings of the selected object (no selection: tool defaults)", "shortcut.hideSelection3d": "Hide selection in 3D", @@ -3458,9 +3460,9 @@ export const en: Record = { "WebGPU could not be initialized. Switch to WebGL2 in the status bar to keep using the 3D view.", "viewport3d.grid.show": "Show ground grid", "viewport3d.grid.hide": "Hide ground grid", - "viewport3d.explode.on": "Exploded axonometric: pull storeys apart", + "viewport3d.explode.on": "Exploded axonometric: pull floors apart", "viewport3d.explode.off": "End exploded axonometric", - "viewport3d.explode.gap": "Gap between storeys (m)", + "viewport3d.explode.gap": "Gap between floors (m)", "viewport3d.section.label": "Section plane", "viewport3d.section.show": "Section plane on", "viewport3d.section.hide": "Section plane off", @@ -3564,7 +3566,7 @@ export const en: Record = { "roomBook.title": "Room book", "roomBook.empty": "No rooms.", "roomBook.quantities": "Quantities per finish", - "roomBook.foot": "Floor area = ceiling area = room area (net). Wall area = perimeter × clear height − openings; clear height from the slabs above and below the room, otherwise storey height. Under sloping roofs the SIA 416 height bands apply (< 1.0 m, 1.0–1.5 m, ≥ 1.5 m); wall sides net of openings, reveal = reveal perimeter × wall thickness, skirting = perimeter − door widths.", + "roomBook.foot": "Floor area = ceiling area = room area (net). Wall area = perimeter × clear height − openings; clear height from the slabs above and below the room, otherwise floor height. Under sloping roofs the SIA 416 height bands apply (< 1.0 m, 1.0–1.5 m, ≥ 1.5 m); wall sides net of openings, reveal = reveal perimeter × wall thickness, skirting = perimeter − door widths.", "roomBook.exportCsv": "CSV", "roomBook.exportPdf": "PDF", "roomBook.exportPdf.fail": "Could not create the room book PDF.", @@ -3628,7 +3630,7 @@ export const en: Record = { "sheetTable.rows": "{shown} of {total} rows", "sheetTable.remove": "Remove table", "sheetTable.col.kind": "Kind", - "sheetTable.col.floor": "Storey", + "sheetTable.col.floor": "Floor", "sheetTable.col.hnf": "HNF", "sheetTable.col.nnf": "NNF", "sheetTable.col.nf": "NF", @@ -4204,13 +4206,13 @@ export const en: Record = { "costs.q.gv": "Building volume GV", "costs.q.gf": "Gross floor area GF", "costs.q.hnf": "Main usable area HNF", - "costs.q.facade": "Facade area (outer perimeter × storey height)", + "costs.q.facade": "Facade area (outer perimeter × floor height)", "costs.q.roof": "Roof area", "costs.note.example": "* Example value: rounded assumption for a building of average standard (price base 2025), no official source — please replace with your own rates.", "costs.note.noQuantity": "No quantities: the model has neither GV nor GF (draw floors with walls/rooms or free solids).", "costs.note.gvSolids": "GV from the free solids (massing model), GF/HNF from the SIA 416 area table.", - "costs.note.gvLevels": "Quantities from the SIA 416 area table (GV ≈ GF × storey height).", - "costs.note.facade": "Facade area = outer perimeter of the storeys above ground × storey height; courtyards, parapets and attic storeys are not included.", + "costs.note.gvLevels": "Quantities from the SIA 416 area table (GV ≈ GF × floor height).", + "costs.note.facade": "Facade area = outer perimeter of the floors above ground × floor height; courtyards, parapets and attic floors are not included.", "costs.note.roofFootprint": "No roof in the model: roof area = area inside the outline (flat roof assumption).", "costs.note.accuracy": "Accuracy ±{pct} (SIA 102: preliminary study ±25 %, preliminary design ±15 %).", "costs.foot.example": "Rates marked * are example values, please adjust.", diff --git a/src/state/keyboardShortcuts.test.ts b/src/state/keyboardShortcuts.test.ts index a44c36ca..806870d1 100644 --- a/src/state/keyboardShortcuts.test.ts +++ b/src/state/keyboardShortcuts.test.ts @@ -5,6 +5,7 @@ import { findConflict, formatCombo, isReservedCombo, + tabKeyAction, matchesShortcut, resolveCombo, SHORTCUT_DEFS, @@ -171,3 +172,20 @@ describe("formatCombo", () => { // commandAliasOverrides.test.ts) — ohne dediziertes Unit-Test (window/ // localStorage im "node"-Vitest-Environment nicht vorhanden); beide sind // bewusst defensiv (try/catch, No-op statt Absturz). + +describe("[252] tabKeyAction", () => { + const ev = (o: Partial) => ({ key: "Tab", ctrlKey: false, metaKey: false, altKey: false, shiftKey: false, ...o }); + it("Tab und Umschalt+Tab gehören der Befehlszeile", () => { + expect(tabKeyAction(ev({}))).toBe("commandLine"); + expect(tabKeyAction(ev({ shiftKey: true }))).toBe("commandLine"); + }); + it("Ctrl+Tab vorwärts, Ctrl+Umschalt+Tab rückwärts", () => { + expect(tabKeyAction(ev({ ctrlKey: true }))).toBe("nextViewTab"); + expect(tabKeyAction(ev({ ctrlKey: true, shiftKey: true }))).toBe("prevViewTab"); + }); + it("Cmd+Tab und Alt+Tab gehören dem System, andere Tasten nicht", () => { + expect(tabKeyAction(ev({ metaKey: true }))).toBeNull(); + expect(tabKeyAction(ev({ altKey: true }))).toBeNull(); + expect(tabKeyAction(ev({ key: "a", ctrlKey: true }))).toBeNull(); + }); +}); diff --git a/src/state/keyboardShortcuts.ts b/src/state/keyboardShortcuts.ts index f470ab23..89b4b68f 100644 --- a/src/state/keyboardShortcuts.ts +++ b/src/state/keyboardShortcuts.ts @@ -354,6 +354,18 @@ export function isReservedCombo(combo: string): boolean { return RESERVED_BARE_COMBOS.has(combo); } +/** + * [252] Fest verdrahtetes Tab-Verhalten (nicht umbelegbar): Tab gehört immer der Befehlszeile; Ctrl+Tab / + * Ctrl+Umschalt+Tab (auch auf dem Mac Ctrl, Cmd+Tab gehört dem System) springt durch die Ansichts-Reiter. + * `null` = keine Tab-Taste bzw. Cmd/Alt+Tab (System). + */ +export type TabKeyAction = "nextViewTab" | "prevViewTab" | "commandLine"; +export function tabKeyAction(e: Pick): TabKeyAction | null { + if (e.key !== "Tab" || e.metaKey || e.altKey) return null; + if (e.ctrlKey) return e.shiftKey ? "prevViewTab" : "nextViewTab"; + return "commandLine"; +} + function isMacPlatform(): boolean { if (typeof navigator === "undefined") return false; return /Mac|iPhone|iPad|iPod/.test(navigator.platform || navigator.userAgent || ""); diff --git a/src/state/shortcutOverview.test.ts b/src/state/shortcutOverview.test.ts index 126129db..625268a2 100644 --- a/src/state/shortcutOverview.test.ts +++ b/src/state/shortcutOverview.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { buildShortcutOverview } from "./shortcutOverview"; +import { buildShortcutOverview, FIXED_COMBO_ROWS } from "./shortcutOverview"; import { ALIASES, COMMANDS } from "../commands/registry"; import { SHORTCUT_DEFS } from "./keyboardShortcuts"; import { t } from "../i18n"; @@ -10,11 +10,17 @@ describe("[210] Kürzel-Übersicht", () => { it("listet jede Tastenkombination der Registry genau einmal", () => { const n = ov.combos.reduce((s, g) => s + g.rows.length, 0); - expect(n).toBe(SHORTCUT_DEFS.length); + expect(n).toBe(SHORTCUT_DEFS.length + FIXED_COMBO_ROWS.length); const undo = ov.combos.flatMap((g) => g.rows).find((r) => r.labelKey === "shortcut.undo"); expect(undo?.combo).toBe("⌘Z"); }); + it("[252] Ctrl+Tab / Ctrl+Umschalt+Tab stehen fest in der Übersicht (auf dem Mac Ctrl)", () => { + const rows = ov.combos.flatMap((g) => g.rows); + expect(rows.find((r) => r.labelKey === "shortcut.nextViewTab")?.combo).toBe("⌃Tab"); + expect(buildShortcutOverview({}, {}, false).combos.flatMap((g) => g.rows).find((r) => r.labelKey === "shortcut.prevViewTab")?.combo).toBe("Strg+Umschalt+Tab"); + }); + it("zeigt Nutzer-Kombinationen statt der Vorgabe", () => { const o = buildShortcutOverview({ undo: "mod+u" }, {}, false); expect(o.combos.flatMap((g) => g.rows).find((r) => r.labelKey === "shortcut.undo")?.combo).toBe("Strg+U"); diff --git a/src/state/shortcutOverview.ts b/src/state/shortcutOverview.ts index ce2a3f2a..0db06cd1 100644 --- a/src/state/shortcutOverview.ts +++ b/src/state/shortcutOverview.ts @@ -40,17 +40,27 @@ export interface ShortcutOverview { const CATEGORY_ORDER: ShortcutCategory[] = ["general", "selection", "edit", "boolean", "transform", "group", "tools", "navigation"]; +/** [252] Fest verdrahtete Kürzel (nicht umbelegbar): Ctrl bleibt auch auf dem Mac Ctrl, Cmd+Tab gehört dem System. */ +export const FIXED_COMBO_ROWS: { category: ShortcutCategory; labelKey: string; combo: (mac: boolean) => string }[] = [ + { category: "navigation", labelKey: "shortcut.nextViewTab", combo: (mac) => (mac ? "⌃Tab" : "Strg+Tab") }, + { category: "navigation", labelKey: "shortcut.prevViewTab", combo: (mac) => (mac ? "⌃⇧Tab" : "Strg+Umschalt+Tab") }, +]; + export function buildShortcutOverview( comboOverrides: ShortcutOverrides = {}, aliasOverrides: Record = {}, mac?: boolean, ): ShortcutOverview { + const isMac = mac ?? (typeof navigator !== "undefined" && /Mac|iPhone|iPad|iPod/.test(navigator.platform || navigator.userAgent || "")); const combos: ComboGroup[] = CATEGORY_ORDER.map((category) => ({ category, - rows: SHORTCUT_DEFS.filter((d) => d.category === category).map((d) => ({ - labelKey: d.labelKey, - combo: formatCombo(resolveCombo(d.id, comboOverrides), mac), - })), + rows: [ + ...SHORTCUT_DEFS.filter((d) => d.category === category).map((d) => ({ + labelKey: d.labelKey, + combo: formatCombo(resolveCombo(d.id, comboOverrides), mac), + })), + ...FIXED_COMBO_ROWS.filter((f) => f.category === category).map((f) => ({ labelKey: f.labelKey, combo: f.combo(isMac) })), + ], })).filter((g) => g.rows.length > 0); // Nutzer-Kürzel überschreiben eingebaute mit gleichem Schlüssel (wie `resolveCommand`). diff --git a/src/state/tabNavigation.ts b/src/state/tabNavigation.ts index 58f6cc3c..9f42bbc8 100644 --- a/src/state/tabNavigation.ts +++ b/src/state/tabNavigation.ts @@ -6,7 +6,7 @@ import type { ViewType } from "../model/viewTypes"; import { sheetLevelOf } from "../model/layoutModel"; import { getState } from "./appStore"; import type { ViewSnapshotState } from "./viewSnapshots"; -import { getViewStateBridge, getViewTabs, navigateToLevel, setViewTabs, stepFloor, switchViewKind, type TabNav } from "./viewTabs"; +import { cycleTab, getViewStateBridge, getViewTabs, navigateToLevel, setViewTabs, stepFloor, switchViewKind, type TabNav } from "./viewTabs"; import { getView3dFilter, hideSelection3d, selectionIds3d, setView3dFilter, showSelection3d } from "./view3dFilter"; import { clearKinds } from "./selection"; @@ -43,6 +43,16 @@ export function openLayoutTab(layoutId: string): void { if (sheet) openLevel(sheet.id); } +/** [252] Ctrl+Tab (+1) / Ctrl+Umschalt+Tab (−1): durch die Ansichts-Reiter springen, zyklisch. */ +export function cycleViewTab(dir: 1 | -1): void { + const bridge = getViewStateBridge(); + if (!bridge) return; + const r = cycleTab(getViewTabs(), dir, bridge.live()); + if (r.next === getViewTabs()) return; + setViewTabs(r.next); + if (r.apply) bridge.apply(r.apply); +} + /** [185] Cmd/Ctrl+5 (−1) bzw. Cmd/Ctrl+6 (+1): im Grundriss-/3D-Reiter ein Geschoss tiefer/höher (Zoom bleibt). */ export function stepActiveFloor(dir: 1 | -1): void { run((live) => stepFloor(getViewTabs(), live, getState().project.drawingLevels, dir)); diff --git a/src/state/useKeyboardShortcuts.ts b/src/state/useKeyboardShortcuts.ts index 55cbfec6..71e5294b 100644 --- a/src/state/useKeyboardShortcuts.ts +++ b/src/state/useKeyboardShortcuts.ts @@ -32,11 +32,11 @@ import { } from "../editors/elementClipboard"; import type { ElementClipboard, ElementSelectionIds, PastedIds } from "../editors/elementClipboard"; import { parseClipboardText, serializeClipboardText } from "../editors/elementClipboardSerialize"; -import { matchesShortcut, type ShortcutId, type ShortcutOverrides } from "./keyboardShortcuts"; +import { matchesShortcut, tabKeyAction, type ShortcutId, type ShortcutOverrides } from "./keyboardShortcuts"; import { isolateSelectionLayerCodes, showAllLayerCodes } from "./layerIsolate"; import { toggleTraceAction } from "./traceActions"; import { joinCurrentSelection } from "./selectionJoin"; -import { hideSelectionIn3d, showSelectionIn3d, stepActiveFloor } from "./tabNavigation"; +import { cycleViewTab, hideSelectionIn3d, showSelectionIn3d, stepActiveFloor } from "./tabNavigation"; const isEditableTarget = (e: KeyboardEvent): boolean => { const el = e.target as HTMLElement | null; @@ -119,7 +119,16 @@ export function useCommandTabShortcut( commandLineRef.current?.beginTyping(e.key); return; } - if (e.key !== "Tab") return; + const tabAction = tabKeyAction(e); + if (!tabAction) return; + // Overlay-Dialoge nutzen Tab für ihre eigenen Felder. + if ((e.target as HTMLElement | null)?.closest?.('[role="dialog"], [aria-modal="true"]')) return; + if (tabAction !== "commandLine") { + // [252] Ctrl+Tab / Ctrl+Umschalt+Tab: Ansichts-Reiter, zyklisch (auch aus Eingabefeldern). + e.preventDefault(); + cycleViewTab(tabAction === "nextViewTab" ? 1 : -1); + return; + } if (inInput) { return; } diff --git a/src/state/viewTabs.test.ts b/src/state/viewTabs.test.ts index b218b8b9..3d048a05 100644 --- a/src/state/viewTabs.test.ts +++ b/src/state/viewTabs.test.ts @@ -17,6 +17,7 @@ import { adjacentFloorId, planFitKey, stepFloor, + cycleTab, isPlanKindActive, openTab, restoreViewTabs, @@ -351,3 +352,22 @@ describe("Geschoss-Navigation wie Archicad [185]", () => { expect(planFitKey({ id: "x", kind: "drawing" }, 1)).not.toBe(planFitKey({ id: "y", kind: "drawing" }, 1)); }); }); + +describe("[252] cycleTab — Ctrl+Tab durch die Reiter", () => { + const mk = (n: number, active: number) => { + const tabs = Array.from({ length: n }, (_, i) => ({ id: `t${i}`, state: st(`l${i}`) })); + return { tabs, activeId: `t${active}` }; + }; + it("vorwärts und rückwärts, zyklisch", () => { + expect(cycleTab(mk(3, 0), 1, st("l0")).next.activeId).toBe("t1"); + expect(cycleTab(mk(3, 2), 1, st("l2")).next.activeId).toBe("t0"); + expect(cycleTab(mk(3, 0), -1, st("l0")).next.activeId).toBe("t2"); + expect(cycleTab(mk(3, 2), -1, st("l2")).apply?.activeLevelId).toBe("l1"); + }); + it("ein Reiter: nichts zu tun", () => { + const s = mk(1, 0); + const r = cycleTab(s, 1, st("l0")); + expect(r.next).toBe(s); + expect(r.apply).toBeNull(); + }); +}); diff --git a/src/state/viewTabs.ts b/src/state/viewTabs.ts index 8de03bcc..b1f01d7a 100644 --- a/src/state/viewTabs.ts +++ b/src/state/viewTabs.ts @@ -88,6 +88,18 @@ export function activateTab( return { next: { ...stored, activeId: id }, apply: target.state ?? null }; } +/** Ctrl+Tab / Ctrl+Umschalt+Tab: nächster bzw. vorheriger Reiter, zyklisch (ein Reiter: nichts zu tun). */ +export function cycleTab( + s: ViewTabsState, + dir: 1 | -1, + live: ViewSnapshotState, +): { next: ViewTabsState; apply: ViewSnapshotState | null } { + const n = s.tabs.length; + if (n <= 1) return { next: s, apply: null }; + const i = Math.max(0, s.tabs.findIndex((t) => t.id === s.activeId)); + return activateTab(s, s.tabs[(i + dir + n) % n].id, live); +} + /** Schliesst einen Reiter (nie den letzten). War er aktiv, wird der rechte (sonst linke) Nachbar aktiv; * dessen gemerkter Zustand ist anzuwenden. Ausschnitte bleiben unberührt. */ export function closeTab(