Merge branch 'worktree-agent-a5d8662de762593ef' into claude/practical-noether-1hb2s1
# Conflicts: # TODO.md
This commit is contained in:
22 files changed
+317
-75
No files matched your search
@@ -22,6 +22,7 @@ import type { DrawingLevelsCommandHandlers, DrawingLevelsSyncState } from "./dra
|
||||
import type { DrawingLevelKind } from "../model/types";
|
||||
import { t } from "../i18n";
|
||||
import { listenBridgeState } from "./windowBridge";
|
||||
import { frozenLevelFlags } from "../panels/displayMode";
|
||||
|
||||
type HandlerName = keyof DrawingLevelsCommandHandlers;
|
||||
|
||||
@@ -100,10 +101,9 @@ export function DrawingLevelsWindowApp() {
|
||||
// Klick aufs Auge in „Alle anzeigen"/„Nur aktive" schaltet automatisch auf
|
||||
// „Ausgewählte" — dieselbe DOSSIER-Regel wie im Dock-Panel.
|
||||
const toggle = (id: string) => {
|
||||
if (state.displayMode === "all_force" || state.displayMode === "active") {
|
||||
handlers.onSetDisplayMode("all");
|
||||
}
|
||||
handlers.onToggleLevel(id);
|
||||
const frozen = frozenLevelFlags(state.displayMode, state.drawingLevels, state.activeLevelId);
|
||||
if (frozen) handlers.onSetDisplayMode("all");
|
||||
handlers.onToggleLevel(id, frozen ?? undefined);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -32,7 +32,7 @@ export interface DrawingLevelsSyncState {
|
||||
|
||||
export interface DrawingLevelsCommandHandlers {
|
||||
onSelectLevel: (id: string) => void;
|
||||
onToggleLevel: (id: string) => void;
|
||||
onToggleLevel: (id: string, frozen?: Record<string, boolean>) => void;
|
||||
onAddFloor: () => void;
|
||||
onAddSection: () => void;
|
||||
onAddElevation: () => void;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { EyeIcon } from "../ui/EyeIcon";
|
||||
import { itemDisplay } from "./displayMode";
|
||||
import { frozenLevelFlags, itemDisplay } from "./displayMode";
|
||||
import { usePanelHost } from "./host";
|
||||
import { useStore } from "../state/appStore";
|
||||
import type { DrawingLevel } from "./host";
|
||||
@@ -93,8 +93,9 @@ export function DrawingLevelsPanel() {
|
||||
// „Ausgewählte" (DOSSIER-Regel), damit das Sichtbarkeits-Flag sofort greift.
|
||||
const toggle = (id: string) => {
|
||||
const m = displayMode.mode;
|
||||
if (m === "all_force" || m === "active") displayMode.setMode("all");
|
||||
host.onToggleLevel(id);
|
||||
const frozen = frozenLevelFlags(m, drawingLevels, activeLevelId);
|
||||
if (frozen) displayMode.setMode("all");
|
||||
host.onToggleLevel(id, frozen ?? undefined);
|
||||
};
|
||||
|
||||
// Rechtsklick auf eine Zeile → Kontextmenü in App öffnen (Browser-Menü aus).
|
||||
|
||||
@@ -40,6 +40,21 @@ export interface ItemDisplay {
|
||||
* nicht aktives, unsichtbares Element wird (außer in "all_force") nie
|
||||
* gezeichnet.
|
||||
*/
|
||||
/** [196] Geschoss-ids, die die Zeichnungsebenen nach `display` nicht zeigen (Auge aus bzw. Modus) — fehlen auch im 3D. */
|
||||
export function hiddenFloorIds(levels: readonly { id: string; kind: string }[], display: (id: string) => { render: boolean }): string[] {
|
||||
return levels.filter((l) => l.kind === "floor" && !display(l.id).render).map((l) => l.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* [196] Auge einer Zeichnungsebene in „Alle anzeigen"/„Nur aktive": Der Klick schaltet auf „Ausgewählte" um. Damit er nur
|
||||
* die eigene Ebene ändert, werden die Sichtbarkeits-Flags vorher auf das eingefroren, was der Modus gerade zeigt
|
||||
* (sonst erschienen alle Geschosse, deren Flag an war). `null` in den übrigen Modi (Flags gelten schon).
|
||||
*/
|
||||
export function frozenLevelFlags(mode: DisplayMode, levels: readonly { id: string }[], activeId: string): Record<string, boolean> | null {
|
||||
if (mode !== "all_force" && mode !== "active") return null;
|
||||
return Object.fromEntries(levels.map((l) => [l.id, itemDisplay(mode, l.id === activeId, true).render]));
|
||||
}
|
||||
|
||||
export function itemDisplay(
|
||||
mode: DisplayMode,
|
||||
isActive: boolean,
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ export interface PanelHostValue {
|
||||
|
||||
// Zeichnungsebenen-Handler.
|
||||
onSelectLevel: (id: string) => void;
|
||||
onToggleLevel: (id: string) => void;
|
||||
onToggleLevel: (id: string, frozen?: Record<string, boolean>) => void;
|
||||
onAddFloor: () => void;
|
||||
onAddDrawing: () => void;
|
||||
onAddSection: () => void;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
viewBox -12.974 0 37.808 33.406
|
||||
bytes 318135
|
||||
bytes 318379
|
||||
circle 14
|
||||
g 1
|
||||
line 3212
|
||||
polygon 77
|
||||
polygon 78
|
||||
polyline 70
|
||||
rect 1
|
||||
svg 1
|
||||
text 32
|
||||
tspan 9
|
||||
hash 608c18c089b7cda0
|
||||
hash f22264fc09db5f68
|
||||
@@ -1,13 +1,13 @@
|
||||
viewBox -41.5 0 95 63.6
|
||||
bytes 108050
|
||||
bytes 108411
|
||||
circle 16
|
||||
g 1
|
||||
line 369
|
||||
path 67
|
||||
path 68
|
||||
polygon 212
|
||||
polyline 120
|
||||
rect 1
|
||||
svg 1
|
||||
text 115
|
||||
tspan 24
|
||||
hash 05cb29305849a69a
|
||||
hash 8c09c5728a08bbec
|
||||
@@ -1,13 +1,13 @@
|
||||
viewBox -12.974 0 37.808 33.406
|
||||
bytes 354278
|
||||
bytes 354615
|
||||
circle 14
|
||||
g 1
|
||||
line 3259
|
||||
path 38
|
||||
path 39
|
||||
polygon 152
|
||||
polyline 167
|
||||
rect 1
|
||||
svg 1
|
||||
text 86
|
||||
tspan 18
|
||||
hash d07966afd213a683
|
||||
hash fd034ff22b6b3cbb
|
||||
@@ -88,6 +88,8 @@ export function classFilterText(hide?: Hide3d, extra?: Record<string, unknown>):
|
||||
// [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;
|
||||
// [196] Geschosse mit ausgeschaltetem Auge: ihre Elemente fehlen im 3D (Kern `ElementSelection::hide_floors`).
|
||||
if (f.hideFloors?.length) h.hideFloors = f.hideFloors;
|
||||
return Object.keys(h).length || extra ? JSON.stringify({ ...extra, ...h }) : "";
|
||||
}
|
||||
|
||||
@@ -99,6 +101,8 @@ export interface Filter3d {
|
||||
hide?: readonly string[];
|
||||
only?: readonly string[] | null;
|
||||
hideIds?: readonly string[];
|
||||
/** [196] Geschoss-ids (Zeichnungsebenen) mit ausgeschaltetem Auge. */
|
||||
hideFloors?: readonly string[];
|
||||
}
|
||||
|
||||
/** Klassen-Codes (bisherige Form) oder der volle {@link Filter3d}. */
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
// [196] Auge einer Zeichnungsebene: schaltet nur die eigene; in „Nur aktive"/„Alle anzeigen" werden die Flags vorher
|
||||
// auf das eingefroren, was der Modus zeigt (sonst erschienen beim Umschalten auf „Ausgewählte" alle Geschosse).
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import { getState, setState } from "./appStore";
|
||||
import { sampleProject } from "../model/sampleProject";
|
||||
import { frozenLevelFlags, hiddenFloorIds, itemDisplay } from "../panels/displayMode";
|
||||
|
||||
beforeEach(() => {
|
||||
setState({ project: sampleProject });
|
||||
getState().clearHistory();
|
||||
});
|
||||
|
||||
const flags = () => Object.fromEntries(getState().project.drawingLevels.map((l) => [l.id, l.visible]));
|
||||
|
||||
describe("Auge der Zeichnungsebenen [196]", () => {
|
||||
it("frozenLevelFlags: nur in all_force/active, sonst null", () => {
|
||||
const lv = getState().project.drawingLevels;
|
||||
expect(frozenLevelFlags("all", lv, "eg")).toBeNull();
|
||||
expect(frozenLevelFlags("grey", lv, "eg")).toBeNull();
|
||||
const act = frozenLevelFlags("active", lv, "eg")!;
|
||||
expect(act.eg).toBe(true);
|
||||
expect(Object.entries(act).filter(([, v]) => v).map(([k]) => k)).toEqual(["eg"]);
|
||||
expect(Object.values(frozenLevelFlags("all_force", lv, "eg")!).every(Boolean)).toBe(true);
|
||||
});
|
||||
|
||||
it("Klick auf das Auge einer Ansicht in „Nur aktive“ ändert nur diese Ebene (ein Undo-Schritt)", () => {
|
||||
const lv = getState().project.drawingLevels;
|
||||
const view = lv.find((l) => l.kind === "elevation")!;
|
||||
const frozen = frozenLevelFlags("active", lv, "eg")!;
|
||||
const wasOn = frozen[view.id];
|
||||
getState().toggleLevelVisible(view.id, frozen);
|
||||
const after = flags();
|
||||
// Geschosse nach dem eingefrorenen Modus (nur EG an), die Ansicht umgeschaltet.
|
||||
for (const l of lv) expect(after[l.id]).toBe(l.id === view.id ? !wasOn : frozen[l.id]);
|
||||
expect(hiddenFloorIds(getState().project.drawingLevels, (id) => itemDisplay("all", id === "eg", after[id])).sort()).toEqual(lv.filter((l) => l.kind === "floor" && l.id !== "eg").map((l) => l.id).sort());
|
||||
getState().undo();
|
||||
expect(flags()).toEqual(Object.fromEntries(lv.map((l) => [l.id, l.visible])));
|
||||
});
|
||||
|
||||
it("ohne frozen: nur die eine Ebene", () => {
|
||||
const before = flags();
|
||||
getState().toggleLevelVisible("og");
|
||||
expect(flags()).toEqual({ ...before, og: !before.og });
|
||||
});
|
||||
|
||||
it("hiddenFloorIds: nur Geschosse mit Auge aus", () => {
|
||||
const levels = [{ id: "a", kind: "floor" }, { id: "b", kind: "floor" }, { id: "s", kind: "section" }];
|
||||
expect(hiddenFloorIds(levels, (id) => ({ render: id === "a" }))).toEqual(["b"]);
|
||||
});
|
||||
});
|
||||
@@ -119,7 +119,7 @@ export interface ProjectSlice {
|
||||
openProjectFile: (text: string) => LoadFileResult;
|
||||
|
||||
// ── Zeichnungsebenen (Levels/Geschosse) ──────────────────────────────────
|
||||
toggleLevelVisible: (id: string) => void;
|
||||
toggleLevelVisible: (id: string, frozen?: Record<string, boolean>) => void;
|
||||
patchActiveFloor: (patch: Partial<DrawingLevel>) => void;
|
||||
addFloor: () => void;
|
||||
addDrawing: () => void;
|
||||
@@ -676,8 +676,12 @@ export function createProjectSlice(
|
||||
},
|
||||
|
||||
// ── Zeichnungsebenen ───────────────────────────────────────────────────
|
||||
toggleLevelVisible: (id) =>
|
||||
applyChange((p) => patchItem(p, "drawingLevels", id, (z) => ({ ...z, visible: !z.visible }))),
|
||||
// [196] `frozen`: Flags aller Ebenen, wie der Modus sie gerade zeigt — nur die angeklickte wird umgeschaltet.
|
||||
toggleLevelVisible: (id, frozen) =>
|
||||
applyChange((p) => {
|
||||
const flag = (z: DrawingLevel) => frozen?.[z.id] ?? z.visible;
|
||||
return patchItems(p, "drawingLevels", (z) => z.id === id || flag(z) !== z.visible, (z) => ({ ...z, visible: z.id === id ? !flag(z) : flag(z) }));
|
||||
}),
|
||||
|
||||
patchActiveFloor: (patch) => {
|
||||
const activeLevelId = get().activeLevelId;
|
||||
|
||||
@@ -50,10 +50,10 @@ export function stepActiveFloor(dir: 1 | -1): void {
|
||||
|
||||
/**
|
||||
* [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 passt sich ein.
|
||||
* 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(getView3dFilter(), selectionIds3d(getState().selection)));
|
||||
setView3dFilter(showSelection3d(selectionIds3d(getState().selection)));
|
||||
switchViewType("perspektive");
|
||||
}
|
||||
|
||||
|
||||
+13
-3
@@ -9,6 +9,8 @@ import { ceilingThickness } from "../model/types";
|
||||
import { computeSection, generatePlan, verticalExtents, generateSectionPlan, pickGeometry, projectToModel3d } from "../core";
|
||||
import { getViewStateBridge } from "./viewTabs";
|
||||
import { getView3dFilter, toFilter3d } from "./view3dFilter";
|
||||
import { BUILTIN_PANEL_IDS } from "../panels/builtinPanels";
|
||||
import { hiddenFloorIds, itemDisplay } from "../panels/displayMode";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
@@ -59,7 +61,7 @@ declare global {
|
||||
/** [195] Strichstärke-Override der Wände (id → mm), nur gesetzte. */
|
||||
wallWeights: () => Record<string, number>;
|
||||
/** [185] 3D-Element-Filter (Store) und die Wand-ids des 3D-Modells bzw. der Pick-Geometrie mit ihm. */
|
||||
view3d: () => { only: string[] | null; hidden: string[]; walls: string[]; pickWalls: string[] };
|
||||
view3d: () => { only: string[] | null; hidden: string[]; walls: string[]; pickWalls: string[]; floors: string[]; pickOpenings: { id: string; host: string }[] };
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -153,14 +155,22 @@ export function installTestHooks(): void {
|
||||
},
|
||||
view3d: () => {
|
||||
const f = getView3dFilter();
|
||||
const p = getState().project;
|
||||
const hide = toFilter3d(f, []);
|
||||
const s = getState();
|
||||
const p = s.project;
|
||||
const mode = s.displayModes[BUILTIN_PANEL_IDS.drawingLevels] ?? "all";
|
||||
const hide = toFilter3d(f, [], hiddenFloorIds(p.drawingLevels, (id) => itemDisplay(mode, id === s.activeLevelId, p.drawingLevels.find((l) => l.id === id)?.visible ?? false)));
|
||||
const uniq = (ids: string[]) => [...new Set(ids)].sort();
|
||||
return {
|
||||
only: f.only,
|
||||
hidden: f.hidden,
|
||||
walls: uniq(projectToModel3d(p, { hide }).walls.map((w) => w.wallId)),
|
||||
pickWalls: uniq(pickGeometry(p, 0, hide).walls.map((w) => w.wallId)),
|
||||
pickOpenings: (() => {
|
||||
const g = pickGeometry(p, 0, hide);
|
||||
const ids = uniq([...g.openings.map((o) => o.openingId), ...g.openingMeshes.map((o) => o.openingId)]);
|
||||
return ids.map((id) => ({ id, host: p.openings?.find((o) => o.id === id)?.hostWallId || p.openings?.find((o) => o.id === id)?.hostRoofId || p.openings?.find((o) => o.id === id)?.hostCeilingId || "" }));
|
||||
})(),
|
||||
floors: uniq(projectToModel3d(p, { hide }).walls.map((w) => p.walls.find((x) => x.id === w.wallId)?.floorId ?? "")),
|
||||
};
|
||||
},
|
||||
layerView: () => {
|
||||
|
||||
@@ -24,34 +24,31 @@ describe("3D-Element-Filter [185]", () => {
|
||||
expect(selectionIds3d(sel)).toEqual(["w1", "w2", "o1"]);
|
||||
});
|
||||
|
||||
it("Cmd+3 mit Auswahl: nur diese, Ausgeblendetes vergessen, Kamera einpassen; ohne Auswahl: alles", () => {
|
||||
const hidden = hideSelection3d(NO_VIEW3D_FILTER, ["x"]);
|
||||
const a = showSelection3d(hidden, ["w1", "w1", "o1"]);
|
||||
it("Cmd+3 mit Auswahl: nur diese, Ausgeblendetes vergessen, Kamera bleibt; ohne Auswahl: alles", () => {
|
||||
const a = showSelection3d(["w1", "w1", "o1"]);
|
||||
expect(a).toMatchObject({ only: ["w1", "o1"], hidden: [] });
|
||||
expect(isSelectionMode(a)).toBe(true);
|
||||
expect(a.fitSeq).toBe(hidden.fitSeq + 1);
|
||||
const b = showSelection3d(a, []);
|
||||
const b = showSelection3d([]);
|
||||
expect(b).toMatchObject({ only: null, hidden: [] });
|
||||
expect(isSelectionMode(b)).toBe(false);
|
||||
expect(b.fitSeq).toBe(a.fitSeq + 1);
|
||||
});
|
||||
|
||||
it("Cmd+4: blendet zusätzlich aus, im Auswahl-Modus auch; ohne ids unverändert", () => {
|
||||
const a = hideSelection3d(NO_VIEW3D_FILTER, ["w1"]);
|
||||
expect(a).toMatchObject({ only: null, hidden: ["w1"], fitSeq: 0 });
|
||||
expect(a).toMatchObject({ only: null, hidden: ["w1"], });
|
||||
expect(hideSelection3d(a, ["w1"])).toBe(a);
|
||||
expect(hideSelection3d(a, [])).toBe(a);
|
||||
const b = hideSelection3d(showSelection3d(a, ["w2", "w3"]), ["w3"]);
|
||||
const b = hideSelection3d(showSelection3d(["w2", "w3"]), ["w3"]);
|
||||
expect(b).toMatchObject({ only: ["w2", "w3"], hidden: ["w3"] });
|
||||
});
|
||||
|
||||
it("toFilter3d: Klassen plus Element-Auswahl für den Kern", () => {
|
||||
expect(toFilter3d(NO_VIEW3D_FILTER, ["31"])).toEqual({ hide: ["31"], only: null, hideIds: [] });
|
||||
expect(toFilter3d(showSelection3d(NO_VIEW3D_FILTER, ["w1"]), [])).toEqual({ hide: [], only: ["w1"], hideIds: [] });
|
||||
expect(toFilter3d(NO_VIEW3D_FILTER, ["31"])).toEqual({ hide: ["31"], only: null, hideIds: [], hideFloors: [] });
|
||||
expect(toFilter3d(showSelection3d(["w1"]), [])).toEqual({ hide: [], only: ["w1"], hideIds: [], hideFloors: [] });
|
||||
});
|
||||
|
||||
it("Store: setzen und beim Projektwechsel zurücksetzen", () => {
|
||||
setView3dFilter(showSelection3d(NO_VIEW3D_FILTER, ["w1"]));
|
||||
setView3dFilter(showSelection3d(["w1"]));
|
||||
expect(isSelectionMode(getView3dFilter())).toBe(true);
|
||||
resetView3dFilter();
|
||||
expect(getView3dFilter()).toBe(NO_VIEW3D_FILTER);
|
||||
|
||||
@@ -16,11 +16,9 @@ export interface View3dFilter {
|
||||
only: string[] | null;
|
||||
/** Temporär ausgeblendete Element-ids. */
|
||||
hidden: string[];
|
||||
/** Zählt die Anfragen „Kamera auf das Gezeigte einpassen" (der 3D-Viewport passt bei jeder Änderung ein). */
|
||||
fitSeq: number;
|
||||
}
|
||||
|
||||
export const NO_VIEW3D_FILTER: View3dFilter = Object.freeze({ only: null, hidden: [], fitSeq: 0 }) as View3dFilter;
|
||||
export const NO_VIEW3D_FILTER: View3dFilter = Object.freeze({ only: null, hidden: [] }) as View3dFilter;
|
||||
|
||||
/** Element-Arten, die im 3D vorkommen (Räume, Schnittlinien, Lage-Darstellung und Gruppen nicht). */
|
||||
const KINDS_3D: readonly SelectionKind[] = ["walls", "ceilings", "openings", "stairs", "solids", "columns", "roofs", "contextObjects", "trees", "drawings"];
|
||||
@@ -36,11 +34,11 @@ export function isSelectionMode(f: View3dFilter): boolean {
|
||||
}
|
||||
|
||||
/**
|
||||
* Cmd/Ctrl+3: mit Auswahl nur diese zeigen (ausgeblendete werden vergessen), ohne Auswahl alles zeigen. Beide Male
|
||||
* passt der 3D-Viewport die Kamera ein.
|
||||
* Cmd/Ctrl+3: mit Auswahl nur diese zeigen (ausgeblendete werden vergessen), ohne Auswahl alles zeigen. Die Kamera
|
||||
* bleibt stehen (Einpassen nur mit Cmd/Ctrl+Shift+F).
|
||||
*/
|
||||
export function showSelection3d(f: View3dFilter, ids: readonly string[]): View3dFilter {
|
||||
return ids.length ? { only: [...new Set(ids)], hidden: [], fitSeq: f.fitSeq + 1 } : { only: null, hidden: [], fitSeq: f.fitSeq + 1 };
|
||||
export function showSelection3d(ids: readonly string[]): View3dFilter {
|
||||
return ids.length ? { only: [...new Set(ids)], hidden: [] } : { only: null, hidden: [] };
|
||||
}
|
||||
|
||||
/** Cmd/Ctrl+4: die Elemente `ids` zusätzlich ausblenden (Kamera bleibt). Ohne ids unverändert. */
|
||||
@@ -50,9 +48,9 @@ export function hideSelection3d(f: View3dFilter, ids: readonly string[]): View3d
|
||||
return hidden.length === f.hidden.length ? f : { ...f, hidden };
|
||||
}
|
||||
|
||||
/** Filter für die 3D-Abfragen: Klassen-Codes `hide` plus Element-Auswahl (Kern `ClassFilter::from_text`). */
|
||||
export function toFilter3d(f: View3dFilter, hide: readonly string[]): Filter3d {
|
||||
return { hide, only: f.only, hideIds: f.hidden };
|
||||
/** Filter für die 3D-Abfragen: Klassen-Codes `hide`, Geschosse mit ausgeschaltetem Auge ([196]) plus Element-Auswahl (Kern `ClassFilter::from_text`). */
|
||||
export function toFilter3d(f: View3dFilter, hide: readonly string[], hideFloors: readonly string[] = []): Filter3d {
|
||||
return { hide, only: f.only, hideIds: f.hidden, hideFloors };
|
||||
}
|
||||
|
||||
// ── Store ───────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -419,6 +419,7 @@ export function Wasm3DViewport({
|
||||
onGrip3dEditTab,
|
||||
onGrip3dEditCancel,
|
||||
hiddenCodes,
|
||||
hiddenFloors,
|
||||
}: {
|
||||
project: Project;
|
||||
/** Kanonischer Blickwinkel (Oberleiste) — s. Datei-Kommentar. */
|
||||
@@ -534,6 +535,8 @@ export function Wasm3DViewport({
|
||||
* beides fehlt im Modell und ist nicht anwählbar.
|
||||
*/
|
||||
hiddenCodes?: readonly string[];
|
||||
/** [196] Geschosse (Zeichnungsebenen-ids) mit ausgeschaltetem Auge: ihre Elemente fehlen im Modell und im Pick. */
|
||||
hiddenFloors?: readonly string[];
|
||||
}) {
|
||||
const canvasRef = useRef<HTMLCanvasElement | null>(null);
|
||||
// Pick-Callback in einem Ref spiegeln, damit der (einmal registrierte)
|
||||
@@ -606,11 +609,13 @@ export function Wasm3DViewport({
|
||||
// [185] Element-Auswahl („Auswahl in 3D zeigen", temporär ausgeblendet) kommt dazu; ohne sie bleibt `hide` die
|
||||
// Code-Liste (gleicher Text an den Kern wie bisher).
|
||||
const elementFilter = useView3dFilter();
|
||||
const { only: onlyIds, hidden: hiddenIds, fitSeq } = elementFilter;
|
||||
const { only: onlyIds, hidden: hiddenIds } = elementFilter;
|
||||
const floorsKey = (hiddenFloors ?? []).join("\u0001");
|
||||
const hide = useMemo<Hide3d>(() => {
|
||||
const codes = hiddenKey ? hiddenKey.split("\u0001") : [];
|
||||
return onlyIds || hiddenIds.length ? toFilter3d({ only: onlyIds, hidden: hiddenIds, fitSeq: 0 }, codes) : codes;
|
||||
}, [hiddenKey, onlyIds, hiddenIds]);
|
||||
const floors = floorsKey ? floorsKey.split("\u0001") : [];
|
||||
return onlyIds || hiddenIds.length || floors.length ? toFilter3d({ only: onlyIds, hidden: hiddenIds }, codes, floors) : codes;
|
||||
}, [hiddenKey, floorsKey, onlyIds, hiddenIds]);
|
||||
const hideRef = useRef(hide);
|
||||
hideRef.current = hide;
|
||||
// Versatz je Geschoss ([65]) für Griffe und gezogene Höhen (Modell bleibt unversetzt).
|
||||
@@ -721,15 +726,6 @@ export function Wasm3DViewport({
|
||||
applyPreset();
|
||||
}, [ready, applyPreset]);
|
||||
|
||||
// [185] „Auswahl in 3D zeigen" / alles zeigen: Kamera auf das Gezeigte einpassen (das Modell ist im Effekt oben
|
||||
// schon mit dem neuen Filter eingespielt).
|
||||
const fitSeqRef = useRef(fitSeq);
|
||||
useEffect(() => {
|
||||
if (!ready || fitSeqRef.current === fitSeq) return;
|
||||
fitSeqRef.current = fitSeq;
|
||||
fitCameraRef.current();
|
||||
}, [ready, fitSeq]);
|
||||
|
||||
// Kamera-Brücke ([BCF]): Lesen/Setzen der Orbit-Kamera, Schnappschuss und Schnitt von aussen
|
||||
// (`cameraBridge.ts`). Der Orbit-Zustand ist die Wahrheit; nach einem Preset ist er aus der
|
||||
// Rust-Preset-Kamera geseedet (s. `applyPreset`).
|
||||
|
||||
@@ -40,6 +40,7 @@ import { pushNativeScene, pushNativeWalls } from "./plan/nativeSync";
|
||||
import { explodeFloorOffsets, selectionHighlightLines } from "../core";
|
||||
import { clashHighlightLines } from "../analysis/clash";
|
||||
import { useClashSession } from "../panels/clashSession";
|
||||
import { hiddenFloorIds } from "../panels/displayMode";
|
||||
import { applyGroupDimmingToPlan } from "../state/groupActions";
|
||||
import { useStore } from "../state/appStore";
|
||||
import { planFitKey } from "../state/viewTabs";
|
||||
@@ -315,6 +316,8 @@ export const Content = memo(function Content({
|
||||
() => flattenCategories(project.layers ?? []).map((c) => c.code).filter((c) => !categoryDisplay(c).render),
|
||||
[project.layers, categoryDisplay],
|
||||
);
|
||||
// [196] Geschosse mit ausgeschaltetem Auge (Zeichnungsebenen-Panel) fehlen auch im 3D.
|
||||
const hiddenFloors3d = useMemo(() => hiddenFloorIds(project.drawingLevels, floorDisplay), [project.drawingLevels, floorDisplay]);
|
||||
// 3D-Sicht: aus dem Grundriss UND aus Schnitt/Ansicht ([115]); im Schnitt schneidet der Live-Schnitt
|
||||
// an der Schnittlinie (App setzt `section3d` beim Wechsel).
|
||||
const view3dPane = (
|
||||
@@ -325,6 +328,7 @@ export const Content = memo(function Content({
|
||||
<Viewport3D
|
||||
project={project}
|
||||
hiddenCodes={hidden3d}
|
||||
hiddenFloors={hiddenFloors3d}
|
||||
renderMode={renderMode}
|
||||
detail={detail}
|
||||
view3d={view3d}
|
||||
|
||||
Reference in new issue
Block a user