[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

-1
View File
@@ -399,7 +399,6 @@ export default function App() {
// ── Gewählte Schnittlinie, 3D-Live-Schnitt → state/useSectionLineState.ts ──
const { sectionLine, section3dPlane, onToggleSection3dCut } = useSectionLineState({
activeLevel,
viewType,
selectedSectionLineId,
section3dCutId,
setSection3dCutId,
+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;
+4 -1
View File
@@ -1024,6 +1024,8 @@ function AboutDialog({ onClose }: { onClose: () => void }) {
*/
export interface ViewRibbonTabProps {
viewToggleEnabled: boolean;
/** Aktiver Reiter ist ein Grundriss-Reiter ([182]); sonst ist der Grundriss-Knopf nicht hervorgehoben. */
planTabActive?: boolean;
viewType: ViewType;
onViewType: (v: ViewType) => void;
view3d: View3d;
@@ -1106,6 +1108,7 @@ const LiveScaleStat = memo(function LiveScaleStat({
*/
export const ViewRibbonTab = memo(function ViewRibbonTab({
viewToggleEnabled,
planTabActive = true,
viewType,
onViewType,
view3d,
@@ -1170,7 +1173,7 @@ export const ViewRibbonTab = memo(function ViewRibbonTab({
<button
type="button"
className={`tb-vt-btn${
viewToggleEnabled && viewType === "grundriss" ? " active" : ""
viewToggleEnabled && planTabActive && viewType === "grundriss" ? " active" : ""
}`}
onClick={() => onViewType("grundriss")}
disabled={!viewToggleEnabled}
+2
View File
@@ -3,6 +3,7 @@
// samt Ebenen-/Zeichnungs-Kombinationen — als memoisierte Elemente mit denselben Abhängigkeiten wie
// zuvor ([121]), damit ein App-Render sie nicht neu zeichnet. Aufgerufen von `App.tsx` für die `TopBar`.
import { isPlanKindActive } from "../state/viewTabs";
import { useMemo } from "react";
import type { DrawingLevel, ModelViewOption, ViewType } from "../model/types";
import { currentModelViewId, modelViewChoices } from "../state/modelViews";
@@ -181,6 +182,7 @@ export function useTopBarElements(opts: {
() => (
<ViewRibbonTab
viewToggleEnabled={true} /* [182] 3D/Grundriss sind aus jedem Reiter erreichbar */
planTabActive={isPlanKindActive(viewType, activeLevel.kind)}
viewType={viewType}
onViewType={setViewType}
view3d={view3d}