Files
DOSSIER/src/state/tabNavigation.ts
T
Claude ed475fe64b [213] Kameras als Modell-Elemente und Begehen (WASD) im 3D
Project.cameras (Rust Camera: Standpunkt + Augenhöhe über Geschoss, Ziel, Bildwinkel, Perspektive/
Axonometrie/Parallel, Sonnenstand) auf der neuen Klasse "Kameras" (92). Grundriss-Symbol im Kern
(plan/cameras.rs: Gehäuse, Sichtkegel, Ziel, Name, schmale Pick-Bänder), Griffe im Kern (camera.rs,
grips.rs: Standpunkt, Ziel, Bildwinkel/Sichtbreite), Auswahl/Entf, Objekt-Info CameraSection, Liste im
Panel Ausschnitte, "Kamera aus aktueller Ansicht anlegen", "Kamera öffnen" (auch per Doppelklick auf das
Symbol), cameraToView() für das Rendering [211]. Begehen im 3D: Umschalt+F, W/A/S/D/Pfeile, Q/E,
Umschalt/Alt, Umschauen um den Augpunkt (viewport/walk.ts). Beispiel: Kamera im Musterhaus komplex.
2026-11-12 18:31:37 +00:00

68 lines
3.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Reiter-Navigation ([182], wie Archicad): Navigator, Ansichts-Umschalter und Layouts wählen den passenden
// Reiter, statt den aktiven umzubauen. Die Regeln selbst sind rein (`viewTabs.ts`: `navigateToLevel`,
// `switchViewKind`); hier werden sie auf den Store und den Darstellungszustand der App angewendet.
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 { getView3dFilter, hideSelection3d, selectionIds3d, setView3dFilter, showSelection3d } from "./view3dFilter";
import { clearKinds } from "./selection";
function run(nav: (live: ViewSnapshotState) => TabNav | null): void {
const bridge = getViewStateBridge();
if (!bridge) return;
const r = nav(bridge.live());
if (!r) return;
setViewTabs(r.next);
if (r.setLevel) {
// Gleicher Reiter: nur das Geschoss wechselt, die Art (Grundriss/3D) bleibt.
const st = getState();
const keep = st.viewType;
st.setActiveLevelId(r.setLevel);
getState().setViewType(keep);
} else if (r.apply) {
bridge.apply(r.apply);
}
}
/** Ebene im Navigator (oder per Link, z. B. Schnittmarke) öffnen. */
export function openLevel(levelId: string): void {
run((live) => navigateToLevel(getViewTabs(), live, getState().project.drawingLevels, levelId));
}
/** „Grundriss" bzw. „3D" wählen: wechselt zum passenden Reiter oder öffnet ihn. */
export function switchViewType(want: ViewType): void {
run((live) => switchViewKind(getViewTabs(), live, getState().project.drawingLevels, want));
}
/** Layout in eigenem Reiter öffnen (bzw. zu dessen offenem Reiter springen); danach `setActiveLayoutId`. */
export function openLayoutTab(layoutId: string): void {
const sheet = sheetLevelOf(getState().project, layoutId);
if (sheet) openLevel(sheet.id);
}
/** [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));
}
/**
* [185] Cmd/Ctrl+3 „Auswahl in 3D zeigen": mit Auswahl zeigt der 3D-Reiter nur diese (Titel „3D · Auswahl"), ohne
* Auswahl wieder alles; wechselt in den 3D-Reiter bzw. öffnet ihn, die Kamera bleibt stehen (Einpassen nur Cmd/Ctrl+Shift+F).
*/
export function showSelectionIn3d(): void {
setView3dFilter(showSelection3d(selectionIds3d(getState().selection)));
switchViewType("perspektive");
}
/** [185] Cmd/Ctrl+4: gewählte Elemente im 3D temporär ausblenden (nicht anwählbar, kein Undo-Schritt); Auswahl leeren. */
export function hideSelectionIn3d(): void {
const st = getState();
const ids = selectionIds3d(st.selection);
if (!ids.length) return;
setView3dFilter(hideSelection3d(getView3dFilter(), ids));
st.setSelection(clearKinds("walls", "ceilings", "openings", "stairs", "solids", "columns", "roofs", "contextObjects", "trees", "cameras", "drawings", "groups"));
}