[182] [149] Grundriss-Knopf nur im Grundriss-Reiter hervorgehoben, toter Auto-Schnitt im 3D entfernt; TODO [149] auf Stand (Auswahlrechteck/Beschriftung waren schon gebaut)

This commit is contained in:
Claude committed 2026-11-11 01:55:29 +00:00
1 parent 1419679963
commit ec77d07300
7 files changed
+25 -16

No files matched your search

+3 -11
View File
@@ -4,8 +4,8 @@
// Zeichnungsebenen aus dem Store ([121]); die Objekt-Info der Auswahl rechnen Panels selbst
// (`useSelectionInfo`), der Panel-Host beim Aufruf eines Handlers.
import { useCallback, useEffect, useMemo } from "react";
import type { DrawingLevel, ViewType } from "../model/types";
import { useCallback, useMemo } from "react";
import type { DrawingLevel } from "../model/types";
import { sectionPlaneFromLevel } from "../core";
import { useStore } from "./appStore";
import type { useSelectionState } from "./useSelectionState";
@@ -14,12 +14,11 @@ type Sel = ReturnType<typeof useSelectionState>;
export function useSectionLineState(opts: {
activeLevel: DrawingLevel;
viewType: ViewType;
selectedSectionLineId: string | null;
section3dCutId: Sel["section3dCutId"];
setSection3dCutId: Sel["setSection3dCutId"];
}) {
const { activeLevel, viewType, selectedSectionLineId, section3dCutId, setSection3dCutId } = opts;
const { activeLevel, selectedSectionLineId, section3dCutId, setSection3dCutId } = opts;
const drawingLevels = useStore((s) => s.project.drawingLevels);
// Gewählte Schnitt-/Ansichtslinie (DrawingLevel) — separat von `selection`, da
@@ -56,13 +55,6 @@ export function useSectionLineState(opts: {
return lvl ? sectionPlaneFromLevel(lvl) : null;
}, [drawingLevels, section3dCutId]);
// Aus einem Schnitt ins 3D ([115]): der Live-Schnitt folgt der Schnittlinie dieses Schnitts (einmal
// beim Wechsel; im 3D lässt er sich wie sonst aufheben).
const sectionLevelIn3d = activeLevel.kind === "section" && viewType === "perspektive" ? activeLevel.id : null;
useEffect(() => {
if (sectionLevelIn3d) setSection3dCutId(sectionLevelIn3d);
}, [sectionLevelIn3d, setSection3dCutId]);
// Bindet den 3D-Live-Schnitt an eine Schnittlinie (Toggle im Objekt-Info).
const onToggleSection3dCut = useCallback(
(id: string) => setSection3dCutId((cur) => (cur === id ? null : id)),
+8
View File
@@ -14,6 +14,7 @@ import {
navigateToLevel,
switchViewKind,
tabKindOf,
isPlanKindActive,
openTab,
restoreViewTabs,
restoreViewTabsFromProject,
@@ -199,6 +200,13 @@ describe("Reiter-Arten und Navigation [182]", () => {
expect(tabKindOf(undefined, levels)).toBeNull();
});
it("isPlanKindActive: Grundriss-Knopf nur im Grundriss-Reiter hervorgehoben", () => {
expect(isPlanKindActive("grundriss", "floor")).toBe(true);
expect(isPlanKindActive("grundriss", "section")).toBe(false);
expect(isPlanKindActive("grundriss", "elevation")).toBe(false);
expect(isPlanKindActive("perspektive", "floor")).toBe(false);
});
it("Geschoss im 3D-Reiter: nur Geschoss wechselt, kein neuer Reiter", () => {
const s = one();
const r = navigateToLevel(s, live("eg", "perspektive"), levels, "og");
+5
View File
@@ -113,6 +113,11 @@ export function levelTabKind(kind: DrawingLevel["kind"]): Exclude<TabKind, "3d">
return kind === "floor" ? "plan" : kind === "section" ? "section" : kind === "elevation" ? "elevation" : "drawing";
}
/** Ist der Reiter ein Grundriss-Reiter (Hervorhebung des Grundriss-Knopfs)? Schnitt/Ansicht/Zeichnung/3D: nein. */
export function isPlanKindActive(viewType: ViewSnapshotState["viewType"], levelKind: DrawingLevel["kind"]): boolean {
return viewType !== "perspektive" && levelTabKind(levelKind) === "plan";
}
/** Art eines Reiters aus seinem Darstellungszustand (`null`: unbekannt, z. B. ohne gemerkten Zustand). */
export function tabKindOf(st: KindState | undefined, levels: readonly LevelLite[]): TabKind | null {
if (!st) return null;