[185] Navigation wie Archicad: Geschosswechsel behält Zoom, Cmd+5/6 Geschoss, Cmd+3/4 Auswahl im 3D

Grundriss: Geschosse teilen den Einpass-Schlüssel (planFitKey, PlanView fitKey), Wechsel behält
Ausschnitt und Massstab exakt. Cmd/Ctrl+5/6 Geschoss tiefer/höher im Grundriss- und 3D-Reiter.
Cmd/Ctrl+3 zeigt nur die Auswahl im 3D (Reiter „3D · Auswahl“, Kamera passt ein; ohne Auswahl alles),
Cmd/Ctrl+4 blendet die Auswahl im 3D aus. Zustand rein UI (state/view3dFilter.ts). Kern:
model3d::ElementSelection im ClassFilter (only/hideIds für Teile, Cache, Pick). Kürzel umbelegbar,
natives Menü Ansicht. PlanViewHandle.pxPerMeter liest die aktuelle viewBox.
This commit is contained in:
Claude committed 2026-11-11 19:39:51 +00:00
1 parent a6c302a91d
commit 5530089eea
29 files changed
+717 -42

No files matched your search

+27
View File
@@ -79,4 +79,31 @@ describe("3D nach Klassen ([180])", () => {
expect(s.has("20") && s.has("21") && s.has("31")).toBe(true);
expect(s.has("30")).toBe(false);
});
it("[185] Element-Auswahl: `only` zeigt nur die Wand (samt ihren Öffnungen), `hideIds` blendet sie aus — Modell, Teile und Pick", () => {
const host = (p.openings ?? [])[0].hostWallId;
const hostOf = new Map((p.openings ?? []).map((o) => [o.id, o.hostWallId]));
const others = p.walls.filter((w) => w.id !== host).length;
const wallIds = (m: ReturnType<typeof projectToModel3d>) => new Set(m.walls.map((w) => w.wallId));
const only = projectToModel3d(p, { hide: { only: [host] } });
expect([...wallIds(only)]).toEqual([host]);
expect(only.slabs).toHaveLength(0);
expect(roofs(only)).toBe(0);
const g = pickGeometry(p, 0, { only: [host] });
expect(new Set(g.walls.map((w) => w.wallId))).toEqual(new Set([host]));
expect(g.openings.length).toBeGreaterThan(0);
expect(g.openings.every((o) => hostOf.get(o.openingId) === host)).toBe(true);
expect(g.slabs).toHaveLength(0);
const parts = projectToModel3dParts(p, { hide: { only: [host] } })!;
expect(parts.flatMap((x) => x.walls ?? []).every((w) => w.wallId === host)).toBe(true);
const hid = projectToModel3d(p, { hide: { hideIds: [host] } });
expect(wallIds(hid).has(host)).toBe(false);
expect(wallIds(hid).size).toBe(others);
const gh = pickGeometry(p, 0, { hideIds: [host] });
expect(gh.walls.some((w) => w.wallId === host)).toBe(false);
expect(gh.openings.some((o) => hostOf.get(o.openingId) === host)).toBe(false);
// Kein Filter: alles wieder da.
expect(wallIds(projectToModel3d(p, { hide: { only: null, hideIds: [] } })).size).toBe(p.walls.length);
});
});
+37 -10
View File
@@ -72,7 +72,7 @@ export function emitDrawingLineVerts(
/** Explosionsabstand ([65]): Spuren heben sich mit ihrem Geschoss; 0 = aus. */
explode = 0,
/** [180] Zusätzlich ausgeblendete Klassen (Darstellungsmodus), s. {@link Model3dOptions.hide}. */
hide?: readonly string[],
hide?: Hide3d,
): Float32Array {
return documentFor(project).drawingLineVerts(explodeGap(explode), classFilterText(hide));
}
@@ -82,17 +82,44 @@ export function emitDrawingLineVerts(
* Ebenen-Baum aus sind (Ebenen-Panel, Kombinationen, Vorlagen); `hide` ergänzt die, die der Darstellungsmodus
* nicht zeichnet (`categoryDisplay(code).render === false`).
*/
export function classFilterText(hide?: readonly string[], extra?: Record<string, unknown>): string {
const h = hide && hide.length ? { hide } : {};
return hide?.length || extra ? JSON.stringify({ ...extra, ...h }) : "";
export function classFilterText(hide?: Hide3d, extra?: Record<string, unknown>): string {
const f = filter3d(hide);
const h: Record<string, unknown> = f.hide?.length ? { hide: f.hide } : {};
// [185] Element-Auswahl: `only` (nur diese Elemente) und `hideIds` (temporär ausgeblendet), s. `model3d::ElementSelection`.
if (f.only) h.only = f.only;
if (f.hideIds?.length) h.hideIds = f.hideIds;
return Object.keys(h).length || extra ? JSON.stringify({ ...extra, ...h }) : "";
}
/**
* [185] 3D-Filter: Klassen-Codes (`hide`, wie bisher) und die Element-Auswahl der 3D-Ansicht — `only` = nur diese
* Element-ids zeigen („Auswahl in 3D zeigen", `null`/fehlt = alle), `hideIds` = temporär ausgeblendete. Rein UI.
*/
export interface Filter3d {
hide?: readonly string[];
only?: readonly string[] | null;
hideIds?: readonly string[];
}
/** Klassen-Codes (bisherige Form) oder der volle {@link Filter3d}. */
export type Hide3d = readonly string[] | Filter3d;
/** {@link Hide3d} als {@link Filter3d}. */
export function filter3d(hide?: Hide3d): Filter3d {
if (!hide) return {};
return isCodeList(hide) ? { hide } : hide;
}
function isCodeList(h: Hide3d): h is readonly string[] {
return Array.isArray(h);
}
/**
* [180] Ausgeblendete Klassen-Codes (Ebenen-Baum samt Elternklassen, dazu `hide`) — für die 3D-Zutaten, die
* nicht aus dem Kern-Modell kommen (Schatten, Baurechts-Hülle); die Teile filtert der Kern.
*/
export function hiddenClassCodes(project: Project, hide?: readonly string[]): Set<string> {
const out = new Set(hide ?? []);
export function hiddenClassCodes(project: Project, hide?: Hide3d): Set<string> {
const out = new Set(filter3d(hide).hide ?? []);
const visible = collectVisibleCodes(project.layers ?? []);
for (const c of flattenCategories(project.layers ?? [])) if (!visible.has(c.code)) out.add(c.code);
return out;
@@ -116,7 +143,7 @@ export function emitSurfacePatternLines(
/** Explosionsabstand ([65]): Linien heben sich mit dem Geschoss ihres Bauteils; 0 = aus. */
explode = 0,
/** [180] Zusätzlich ausgeblendete Klassen, s. {@link Model3dOptions.hide}. */
hide?: readonly string[],
hide?: Hide3d,
): Float32Array {
return documentFor(project).surfacePatternLines(explodeGap(explode), classFilterText(hide));
}
@@ -193,9 +220,9 @@ export interface Model3dOptions {
/**
* [180] Klassen, die zusätzlich zum Ebenen-Baum nicht gezeichnet werden (Darstellungsmodus des Ebenen-Panels).
* Ausgeblendete Klassen fehlen im Modell, in der Pick-Geometrie und im Export der Ansicht (Kern filtert nach dem
* Cache, Umschalten rechnet keine Wand neu).
* Cache, Umschalten rechnet keine Wand neu). [185] Auch als {@link Filter3d} mit Element-Auswahl.
*/
hide?: readonly string[];
hide?: Hide3d;
}
/** Das volle 3D-Modell: Wände (mit Öffnungen) + Deckenplatten + Kontext-Meshes. */
@@ -337,7 +364,7 @@ export function pickGeometry(
/** Explosionsabstand ([65]) wie bei {@link projectToModel3d}; 0 = aus. */
explode = 0,
/** [180] Zusätzlich ausgeblendete Klassen (nicht anwählbar), s. {@link Model3dOptions.hide}. */
hide?: readonly string[],
hide?: Hide3d,
): {
walls: RWall[];
slabs: RSlab[];