Merge [272] Varianten: Auge/Stift, grau einfärben, sperren
This commit is contained in:
36 files changed
+910
-81
No files matched your search
@@ -0,0 +1,18 @@
|
||||
// [272] Bearbeitungsvariante der Bildschirm-Ansichten (Stift im Panel „Varianten“ + Häkchen „grau einfärben“) als
|
||||
// Anfrage-Feld `designOptionEdit` für Grundriss, Schnitt, Ansicht und 3D. Nur hier gelesen — Druck, PDF und Exporte
|
||||
// bekommen es nie, darum bleibt das Grau auf dem Bildschirm (Kern `renovation::View::editing`).
|
||||
// Bezeichner englisch, Kommentare deutsch.
|
||||
|
||||
import { useMemo } from "react";
|
||||
import { designOptionEditArg } from "../core";
|
||||
import type { DesignOptionEditArg } from "../core";
|
||||
import type { Project } from "../model/types";
|
||||
import { useStore } from "./appStore";
|
||||
|
||||
/** Bearbeitungsvariante der Sitzung für Bildschirm-Anfragen; `null` ohne Stift (stabile Referenz für Memos). */
|
||||
export function useDesignOptionEdit(project: Project): DesignOptionEditArg | null {
|
||||
const draw = useStore((s) => s.drawDesignOption);
|
||||
const grey = useStore((s) => s.designOptionGrey);
|
||||
const sets = project.designOptionSets;
|
||||
return useMemo(() => designOptionEditArg(project, draw, grey), [sets, draw, grey]);
|
||||
}
|
||||
@@ -4,6 +4,35 @@
|
||||
import type { StoreApi } from "./store";
|
||||
import { EMPTY_SELECTION, mergeSelection } from "./selection";
|
||||
import type { Selection } from "./selection";
|
||||
import { unlockedSelection } from "../core";
|
||||
import type { DesignOptionTarget } from "../core";
|
||||
import type { Project } from "../model/types";
|
||||
|
||||
/** [272] Teil des Gesamtzustands, den die Varianten-Sperre liest (Projekt, Stift, Häkchen „sperren“). */
|
||||
type LockState = { project?: Project; drawDesignOption?: DesignOptionTarget | null; designOptionLock?: boolean };
|
||||
|
||||
/** [272] Bearbeitungsvariante, deren Aussenstehendes gesperrt ist (Stift + Häkchen „sperren“), sonst `null`. */
|
||||
function lockEdit(s: unknown): { project: Project; edit: DesignOptionTarget } | null {
|
||||
const r = s as LockState;
|
||||
return r.designOptionLock && r.drawDesignOption && r.project ? { project: r.project, edit: r.drawDesignOption } : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* [272] „Elemente ausserhalb der Variante sperren“: die Auswahl nimmt sie nie auf — EIN Ort für Klick, Rechteck, 3D-Pick,
|
||||
* „Alles wählen“ und Befehle; Griffe, Objekt-Info und Bearbeitungsbefehle sehen sie darum nicht.
|
||||
*/
|
||||
function withoutLocked(s: unknown, sel: Partial<Selection>): Partial<Selection> {
|
||||
const l = lockEdit(s);
|
||||
return l ? unlockedSelection(l.project, l.edit, sel) : sel;
|
||||
}
|
||||
|
||||
/** [272] Nach Wechsel von Stift oder Häkchen „sperren“: gesperrte Elemente aus der Auswahl nehmen. */
|
||||
export function pruneLockedSelection(api: { set: (patch: (s: SelectionSlice) => Partial<SelectionSlice>) => void }): void {
|
||||
api.set((s) => {
|
||||
const next = withoutLocked(s, s.selection);
|
||||
return next === s.selection ? {} : { selection: mergeSelection(s.selection, next) };
|
||||
});
|
||||
}
|
||||
|
||||
/** Felder, die diese Slice in den RootState beisteuert. */
|
||||
export interface SelectionSlice {
|
||||
@@ -33,7 +62,7 @@ export function createSelectionSlice(
|
||||
selection: EMPTY_SELECTION,
|
||||
groupPath: [],
|
||||
setSelection: (patch) =>
|
||||
set((s) => ({ selection: mergeSelection(s.selection, typeof patch === "function" ? patch(s.selection) : patch) })),
|
||||
set((s) => ({ selection: mergeSelection(s.selection, withoutLocked(s, typeof patch === "function" ? patch(s.selection) : patch)) })),
|
||||
setGroupPath: (path) => set({ groupPath: path }),
|
||||
// groupPath (Isolation) bleibt bewusst erhalten — Leerraum-Klick INNERHALB
|
||||
// einer betretenen Gruppe soll nur deren Auswahl leeren, nicht aus der
|
||||
|
||||
@@ -11,6 +11,7 @@ import { computeSection, generatePlan, generateVisibleLevelsPlan, materializeGre
|
||||
import { withDocument } from "../core/document";
|
||||
import { collectVisibleCodes } from "../model/layers";
|
||||
import { tracePlan } from "../core";
|
||||
import { DESIGN_OPTION_GHOST_FILL, designOptionEditArg } from "../core";
|
||||
import { getViewStateBridge } from "./viewTabs";
|
||||
import { getView3dFilter, toFilter3d } from "./view3dFilter";
|
||||
import { BUILTIN_PANEL_IDS } from "../panels/builtinPanels";
|
||||
@@ -68,6 +69,8 @@ declare global {
|
||||
renovation: () => { filter: string | null; phase: string | null; draw: string; walls: Record<string, string> };
|
||||
/** [272] Varianten: Kombination der aktiven Ebene, Zeichen-Variante, Variante je Element (`set/option`, leer = Hauptmodell), Sätze. */
|
||||
designOptions: () => { level: Record<string, string>; combination: string | null; combinations: string[]; draw: string | null; elements: Record<string, string>; sets: string[] };
|
||||
/** [272] Grundriss der aktiven Ebene wie auf dem Bildschirm (mit Bearbeitungsvariante): Wände und grau gezeichnete Wände (ids); dazu derselbe Grundriss für den Druck. */
|
||||
designOptionPlan: () => { walls: string[]; grey: string[]; printGrey: number };
|
||||
/** [193] Gefüllte Flächen (Füllfarbe gesetzt) im Grundriss der aktiven Ebene (alle Kategorien, 1:100); bei 0 ist nichts Gefülltes mehr zu sehen. */
|
||||
planFills: () => number;
|
||||
/** [193] Höhe (z) des ersten Gelände-Netz-Punkts. */
|
||||
@@ -204,6 +207,21 @@ export function installTestHooks(): void {
|
||||
}
|
||||
return { level: l?.designOptions ?? {}, combination: l?.designOptionCombination ?? null, combinations: (s.project.designOptionCombinations ?? []).map((x) => x.name), draw: s.drawDesignOption ? `${s.drawDesignOption.set}/${s.drawDesignOption.option}` : null, elements, sets: (s.project.designOptionSets ?? []).map((x) => x.id) };
|
||||
},
|
||||
designOptionPlan: () => {
|
||||
const s = getState();
|
||||
const codes = collectVisibleCodes(s.project.layers);
|
||||
const edit = designOptionEditArg(s.project, s.drawDesignOption, s.designOptionGrey);
|
||||
const walls = new Set<string>();
|
||||
const grey = new Set<string>();
|
||||
for (const q of generateVisibleLevelsPlan(s.project, s.activeLevelId, codes, undefined, s.detail, false, false, undefined, 100, false, edit).primitives) {
|
||||
const w = (q as { wallId?: string; openingId?: string }).wallId;
|
||||
if (q.kind !== "polygon" || !w || (q as { openingId?: string }).openingId) continue;
|
||||
walls.add(w);
|
||||
if (q.fill === DESIGN_OPTION_GHOST_FILL) grey.add(w);
|
||||
}
|
||||
const printGrey = generatePlan(s.project, s.activeLevelId, codes, undefined, s.detail, false, false, true, 100, true, false, null, null, edit).primitives.filter((q) => q.kind === "polygon" && q.fill === DESIGN_OPTION_GHOST_FILL).length;
|
||||
return { walls: [...walls].sort(), grey: [...grey].sort(), printGrey };
|
||||
},
|
||||
renovation: () => {
|
||||
const s = getState();
|
||||
const l = s.project.drawingLevels.find((x) => x.id === s.activeLevelId);
|
||||
|
||||
+23
-1
@@ -13,6 +13,7 @@ import type { TraceReference, RenovationStatus } from "../model/types";
|
||||
import type { DisplayMode } from "../panels/types";
|
||||
import { DEFAULT_MARQUEE_COLOR, DEFAULT_SNAP_COLOR } from "../theme/accents";
|
||||
import type { StoreApi } from "./store";
|
||||
import { pruneLockedSelection } from "./selectionSlice";
|
||||
|
||||
/** Standard-Darstellungsmodus je Panel (wie bisher: alles sichtbar normal). */
|
||||
const DEFAULT_DISPLAY_MODE: DisplayMode = "all";
|
||||
@@ -33,6 +34,16 @@ export interface ViewSlice {
|
||||
*/
|
||||
drawDesignOption: { set: string; option: string } | null;
|
||||
setDrawDesignOption: (target: { set: string; option: string } | null) => void;
|
||||
/**
|
||||
* [272] Häkchen des Panels „Varianten“ im Bearbeitungsmodus (Stift auf einer Variante), wie in Archicads Manager:
|
||||
* „Elemente ausserhalb der Variante grau einfärben“ (nur Bildschirm: Grundriss, Schnitt, Ansicht, 3D) und „… sperren“
|
||||
* (nicht wählbar). Zustand der Sitzung wie Stift und Kombination des Managers in Archicad — kein Projektfeld, kein
|
||||
* Undo-Schritt, nie im Druck; Vorgabe: grau an, sperren aus.
|
||||
*/
|
||||
designOptionGrey: boolean;
|
||||
designOptionLock: boolean;
|
||||
setDesignOptionGrey: (on: boolean) => void;
|
||||
setDesignOptionLock: (on: boolean) => void;
|
||||
// Ansichtstyp (Grundriss / Perspektive).
|
||||
viewType: ViewType;
|
||||
// Zuletzt gewählter Ansichtstyp je Zeichnungsebene — jeder Tab merkt sich
|
||||
@@ -107,7 +118,18 @@ export function createViewSlice(api: StoreApi<ViewSlice>): ViewSlice {
|
||||
drawRenovation: { status: "existing" },
|
||||
setDrawRenovation: (status, phase) => set({ drawRenovation: phase ? { status, phase } : { status } }),
|
||||
drawDesignOption: null,
|
||||
setDrawDesignOption: (target) => set({ drawDesignOption: target }),
|
||||
// Mit „sperren“ fallen gewählte Elemente ausserhalb der neuen Bearbeitungsvariante aus der Auswahl (`selectionSlice`).
|
||||
setDrawDesignOption: (target) => {
|
||||
set({ drawDesignOption: target });
|
||||
pruneLockedSelection(api as never);
|
||||
},
|
||||
designOptionGrey: true,
|
||||
designOptionLock: false,
|
||||
setDesignOptionGrey: (on) => set({ designOptionGrey: on }),
|
||||
setDesignOptionLock: (on) => {
|
||||
set({ designOptionLock: on });
|
||||
pruneLockedSelection(api as never);
|
||||
},
|
||||
viewType: "grundriss",
|
||||
viewTypeByLevel: {},
|
||||
detail: "mittel",
|
||||
|
||||
Reference in new issue
Block a user