Merge [272] Varianten: Auge/Stift, grau einfärben, sperren
This commit is contained in:
36 files changed
+910
-81
No files matched your search
@@ -141,4 +141,7 @@ export {
|
||||
renameCombinationOps, setCombinationChoiceOps, deleteCombinationOps,
|
||||
} from "../model/designOptions";
|
||||
export type { Combination, CombinationState, DesignOptionCompareRow, DesignOptionCollection } from "../model/designOptions";
|
||||
// [272] Nachtrag: Auge/Stift, grau einfärben und sperren wie im Archicad-Manager
|
||||
export { DESIGN_OPTION_GHOST_FILL, designOptionEditArg, visibleOption, eyeClick, penClick, designOptionLocked, unlockedSelection } from "../model/designOptions";
|
||||
export type { DesignOptionEditArg, DesignOptionTarget } from "../model/designOptions";
|
||||
export { buildVariantenSampleProject } from "../model/sampleProjectVarianten";
|
||||
@@ -4772,6 +4772,19 @@ export const de = {
|
||||
"designOption.primaryCombination": "Hauptvarianten",
|
||||
"designOption.viewCombination": "Kombination dieser Ansicht",
|
||||
"designOption.drawIn": "Neue Elemente zeichnen in",
|
||||
"designOption.eye": "Sichtbar in dieser Ansicht",
|
||||
"designOption.eye.on": "Sichtbar in dieser Ansicht (je Satz eine Variante)",
|
||||
"designOption.eye.off": "In dieser Ansicht zeigen",
|
||||
"designOption.pen": "Bearbeiten",
|
||||
"designOption.pen.on": "Wird bearbeitet: neue Elemente landen hier. Nochmals klicken: zurück zum Hauptmodell",
|
||||
"designOption.pen.off": "Diese Variante bearbeiten (neue Elemente landen hier)",
|
||||
"designOption.pen.main": "Hauptmodell bearbeiten",
|
||||
"designOption.edit.title": "Bearbeiten",
|
||||
"designOption.edit.grey": "Elemente ausserhalb der Variante grau einfärben",
|
||||
"designOption.edit.lock": "Elemente ausserhalb der Variante sperren",
|
||||
"designOption.edit.hint": "Wirkt beim Bearbeiten einer Variante (Stift), nur auf dem Bildschirm, nicht im Druck.",
|
||||
"designOption.editing": "Bearbeite: {option}",
|
||||
"designOption.editing.hint": "Neue Elemente landen in {option}. Klick öffnet das Panel „Varianten“.",
|
||||
"designOption.set": "Variantensatz",
|
||||
"designOption.option": "Variante",
|
||||
"designOption.primary": "Hauptvariante",
|
||||
|
||||
@@ -4758,6 +4758,19 @@ export const en: Record<TranslationKey, string> = {
|
||||
"designOption.primaryCombination": "primary options",
|
||||
"designOption.viewCombination": "Combination of this view",
|
||||
"designOption.drawIn": "Draw new elements in",
|
||||
"designOption.eye": "Visible in this view",
|
||||
"designOption.eye.on": "Visible in this view (one option per set)",
|
||||
"designOption.eye.off": "Show in this view",
|
||||
"designOption.pen": "Edit",
|
||||
"designOption.pen.on": "Being edited: new elements go here. Click again to return to the main model",
|
||||
"designOption.pen.off": "Edit this option (new elements go here)",
|
||||
"designOption.pen.main": "Edit main model",
|
||||
"designOption.edit.title": "Editing",
|
||||
"designOption.edit.grey": "Gray out elements outside the option",
|
||||
"designOption.edit.lock": "Lock elements outside the option",
|
||||
"designOption.edit.hint": "Applies while editing an option (pen), on screen only, not in prints.",
|
||||
"designOption.editing": "Editing: {option}",
|
||||
"designOption.editing.hint": "New elements go to {option}. Click to open the Design Options panel.",
|
||||
"designOption.set": "Option set",
|
||||
"designOption.option": "Option",
|
||||
"designOption.primary": "Primary option",
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
resolveCombination, setLevelCombinationOps, setPrimaryOptionOps, showsInCombination,
|
||||
addCombinationOps, assignCombinationOps, combinationChoice, deleteCombinationOps, designOptionCombinations, levelCombinationState, renameCombinationOps, setCombinationChoiceOps,
|
||||
storedChoice,
|
||||
DESIGN_OPTION_GHOST_FILL, designOptionEditArg, designOptionLocked, eyeClick, penClick, unlockedSelection, visibleOption,
|
||||
} from "./designOptions";
|
||||
import { viewportDesignOptions } from "../plan/viewportPlan";
|
||||
import { viewportVariantSuffix } from "./posterTemplates";
|
||||
@@ -233,3 +234,74 @@ describe("[272] Benannte Variantenkombinationen", () => {
|
||||
expect(q2.drawingLevels.find((l) => l.id === "eg")?.designOptions).toEqual({ fassade: "b" });
|
||||
});
|
||||
});
|
||||
|
||||
describe("[272] Varianten bearbeiten wie Archicad (Auge, Stift, grau, sperren)", () => {
|
||||
const dach = (option: string) => ({ set: "dachform", option });
|
||||
|
||||
it("Bearbeitungsvariante der Bildschirm-Anfrage: nur mit Stift und bekannter Variante", () => {
|
||||
const p = buildVariantenSampleProject();
|
||||
expect(designOptionEditArg(p, null, true)).toBeNull();
|
||||
expect(designOptionEditArg(p, { set: "dachform", option: "zz" }, true)).toBeNull();
|
||||
expect(designOptionEditArg(p, dach("b"), true)).toEqual({ set: "dachform", option: "b", grey: true });
|
||||
expect(designOptionEditArg(p, dach("b"), false)).toEqual({ set: "dachform", option: "b", grey: false });
|
||||
});
|
||||
|
||||
it("Auge: sichtbare Variante je Satz (Stift geht vor); Klick schaltet die Ebene um, im Stift-Satz endet die Bearbeitung", () => {
|
||||
const p = buildVariantenSampleProject();
|
||||
const eg = p.drawingLevels.find((l) => l.id === "eg");
|
||||
expect(visibleOption(p, eg, null, "dachform")).toBe("a");
|
||||
expect(visibleOption(p, eg, dach("b"), "dachform")).toBe("b");
|
||||
expect(visibleOption(p, eg, dach("b"), "fassade")).toBe(levelCombination(p, eg).fassade);
|
||||
// Auge in einem anderen Satz: Ebene wechselt, Stift bleibt.
|
||||
const other = eyeClick(p, "eg", dach("b"), "fassade", "b");
|
||||
expect(other.draw).toEqual(dach("b"));
|
||||
const q = applyOps(p, other.ops);
|
||||
expect(levelCombination(q, q.drawingLevels.find((l) => l.id === "eg")).fassade).toBe("b");
|
||||
// Auge im Satz des Stifts auf eine andere Variante: Bearbeitung endet (Stift impliziert Auge).
|
||||
const same = eyeClick(p, "eg", dach("b"), "dachform", "a");
|
||||
expect(same.draw).toBeNull();
|
||||
// Auge auf die bearbeitete Variante: nichts zu tun.
|
||||
expect(eyeClick(p, "eg", dach("b"), "dachform", "b")).toEqual({ draw: dach("b"), ops: [] });
|
||||
});
|
||||
|
||||
it("Stift: setzt die Bearbeitungsvariante, zweiter Klick zurück aufs Hauptmodell (kein Undo-Schritt)", () => {
|
||||
const p = buildVariantenSampleProject();
|
||||
expect(penClick(p, null, "dachform", "b")).toEqual(dach("b"));
|
||||
expect(penClick(p, dach("b"), "dachform", "b")).toBeNull();
|
||||
expect(penClick(p, dach("b"), "fassade", "a")).toEqual({ set: "fassade", option: "a" });
|
||||
expect(penClick(p, null, "dachform", "zz")).toBeNull();
|
||||
});
|
||||
|
||||
it("Sperren: ausserhalb der Bearbeitungsvariante nicht wählbar (Öffnung folgt ihrer Wand), ohne Stift nichts gesperrt", () => {
|
||||
const p = buildVariantenSampleProject();
|
||||
const main = p.walls.find((w) => !w.designOption)!;
|
||||
const roofB = (p.roofs ?? []).find((r) => r.designOption?.option === "b" && r.designOption.set === "dachform")!;
|
||||
const roofA = (p.roofs ?? []).find((r) => r.designOption?.option === "a" && r.designOption.set === "dachform")!;
|
||||
expect(designOptionLocked(p, dach("b"), "walls", main.id)).toBe(true);
|
||||
expect(designOptionLocked(p, dach("b"), "roofs", roofB.id)).toBe(false);
|
||||
expect(designOptionLocked(p, dach("b"), "roofs", roofA.id)).toBe(true);
|
||||
expect(designOptionLocked(p, null, "walls", main.id)).toBe(false);
|
||||
// Öffnung ohne eigene Variante in einer Wand der Variante: frei.
|
||||
const q: Project = { ...p, walls: p.walls.map((w) => (w.id === main.id ? { ...w, designOption: dach("b") } : w)) };
|
||||
const o = (q.openings ?? []).find((x) => x.hostWallId === main.id && !x.designOption);
|
||||
expect(o).toBeDefined();
|
||||
expect(designOptionLocked(q, dach("b"), "openings", o!.id)).toBe(false);
|
||||
expect(designOptionLocked(p, dach("b"), "openings", o!.id)).toBe(true);
|
||||
// Schnittlinien und Gruppen bleiben wählbar; Auswahl gefiltert.
|
||||
expect(designOptionLocked(p, dach("b"), "sectionLines", "schnitt-a")).toBe(false);
|
||||
expect(unlockedSelection(p, dach("b"), { walls: [main.id], roofs: [roofB.id, roofA.id] })).toEqual({ walls: [], roofs: [roofB.id] });
|
||||
expect(unlockedSelection(p, null, { walls: [main.id] })).toEqual({ walls: [main.id] });
|
||||
});
|
||||
|
||||
it("Grau nur in der Bildschirm-Anfrage: Hauptmodell grau, bearbeitete Variante nicht, Druck unverändert", () => {
|
||||
const p = buildVariantenSampleProject();
|
||||
const fills = (edit: ReturnType<typeof designOptionEditArg>) =>
|
||||
withDocument(p, () => {
|
||||
const plan = generatePlan(p, "eg", ALL, undefined, "mittel", false, false, true, 100, false, false, null, null, edit);
|
||||
return plan.primitives.filter((x) => x.kind === "polygon" && (x as { wallId?: string }).wallId).map((x) => (x as { fill: string }).fill);
|
||||
});
|
||||
expect(fills(null)).not.toContain(DESIGN_OPTION_GHOST_FILL);
|
||||
expect(fills(designOptionEditArg(p, dach("b"), true))).toContain(DESIGN_OPTION_GHOST_FILL);
|
||||
expect(fills(designOptionEditArg(p, dach("b"), false))).not.toContain(DESIGN_OPTION_GHOST_FILL);
|
||||
});
|
||||
});
|
||||
@@ -424,3 +424,101 @@ export function projectWithCombination(project: Project, c: Combination): Projec
|
||||
...(project.layouts ? { layouts: project.layouts.map((l) => ({ ...l, viewports: l.viewports.map(strip) })) } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
// ── Bearbeiten wie im Archicad-Manager (Nachtrag 17.11.): Auge, Stift, grau einfärben, sperren ─────────────────────
|
||||
//
|
||||
// Stift = Bearbeitungsvariante (`drawDesignOption` im Store, Zustand der Sitzung wie in Archicad die Einstellungen des
|
||||
// Managers, kein Undo-Schritt): neue Elemente der Zeichenbefehle gehören ihr (Kern `design_options::stamp_ops`), die
|
||||
// Bildschirm-Ansichten zeigen sie (Stift impliziert Auge) und färben mit „grau“ alles ausserhalb grau (Kern
|
||||
// `design_options::Edit`, `renovation::View::editing` — der eine Sichtbarkeits-Ort; Druck/PDF/Exporte fragen nie damit).
|
||||
|
||||
/** Variante als Ziel (Satz-Id, Varianten-Id). */
|
||||
export type DesignOptionTarget = { set: string; option: string };
|
||||
|
||||
/** Anfrage-Feld `designOptionEdit` der Bildschirm-Ansichten (Grundriss, Schnitt, Ansicht, Axo, 3D). */
|
||||
export interface DesignOptionEditArg {
|
||||
set: string;
|
||||
option: string;
|
||||
/** Häkchen „Elemente ausserhalb der Variante grau einfärben“. */
|
||||
grey: boolean;
|
||||
}
|
||||
|
||||
/** Füllfarbe des Graus ausserhalb der Bearbeitungsvariante (gleich wie `renovation::ghost_style` im Kern). */
|
||||
export const DESIGN_OPTION_GHOST_FILL = "#e3e3e3";
|
||||
|
||||
function knownTarget(project: Project, t: DesignOptionTarget | null | undefined): t is DesignOptionTarget {
|
||||
return !!t && designOptionSets(project).some((s) => s.id === t.set && s.options.some((o) => o.id === t.option));
|
||||
}
|
||||
|
||||
/** Bearbeitungsvariante für Bildschirm-Anfragen; `null` ohne Stift oder bei unbekannter Variante. */
|
||||
export function designOptionEditArg(project: Project, draw: DesignOptionTarget | null | undefined, grey: boolean): DesignOptionEditArg | null {
|
||||
return knownTarget(project, draw) ? { set: draw.set, option: draw.option, grey } : null;
|
||||
}
|
||||
|
||||
/** Auge: die in der aktiven Ansicht sichtbare Variante des Satzes (der Stift geht vor, sonst die Kombination der Ebene). */
|
||||
export function visibleOption(project: Project, level: DrawingLevel | undefined, draw: DesignOptionTarget | null | undefined, setId: string): string | undefined {
|
||||
if (knownTarget(project, draw) && draw.set === setId) return draw.option;
|
||||
return levelCombination(project, level)[setId];
|
||||
}
|
||||
|
||||
/**
|
||||
* Klick aufs Auge einer Variante: die Ebene zeigt sie (Ops, ein Undo-Schritt). Im Satz des Stifts endet damit die Bearbeitung
|
||||
* (Stift impliziert Auge, eine andere Variante dieses Satzes sichtbar zu machen heisst, den Stift abzugeben).
|
||||
*/
|
||||
export function eyeClick(project: Project, levelId: string, draw: DesignOptionTarget | null, setId: string, optionId: string): { draw: DesignOptionTarget | null; ops: CoreOp[] } {
|
||||
if (draw && draw.set === setId && draw.option === optionId) return { draw, ops: [] };
|
||||
const level = project.drawingLevels.find((l) => l.id === levelId);
|
||||
const ops = levelCombination(project, level)[setId] === optionId ? [] : setLevelCombinationOps(project, levelId, setId, optionId);
|
||||
return { draw: draw && draw.set === setId ? null : draw, ops };
|
||||
}
|
||||
|
||||
/** Klick auf den Stift einer Variante: sie wird Bearbeitungsvariante; der Stift der bearbeiteten Variante gibt zurück ans Hauptmodell. */
|
||||
export function penClick(project: Project, draw: DesignOptionTarget | null, setId: string, optionId: string): DesignOptionTarget | null {
|
||||
if (draw && draw.set === setId && draw.option === optionId) return null;
|
||||
const t = { set: setId, option: optionId };
|
||||
return knownTarget(project, t) ? t : null;
|
||||
}
|
||||
|
||||
/** Auswahl-Art → Liste im Projekt (nur Arten, deren Elemente einer Variante angehören können). */
|
||||
const KIND_COLLECTION: Record<string, DesignOptionCollection> = {
|
||||
walls: "walls",
|
||||
openings: "openings",
|
||||
ceilings: "ceilings",
|
||||
roofs: "roofs",
|
||||
stairs: "stairs",
|
||||
columns: "columns",
|
||||
solids: "extrudedSolids",
|
||||
rooms: "rooms",
|
||||
drawings: "drawings2d",
|
||||
};
|
||||
|
||||
/** Modell-Arten ohne Variante (immer ausserhalb einer Bearbeitungsvariante). */
|
||||
const OUTSIDE_KINDS = new Set(["trees", "cameras", "contextObjects"]);
|
||||
|
||||
/**
|
||||
* Häkchen „Elemente ausserhalb der Variante sperren“: ist das Element (Auswahl-Art, Id) bei Bearbeitungsvariante `edit` gesperrt?
|
||||
* Gesperrt ist alles ausserhalb der Variante (Hauptmodell, andere Varianten, Bäume, Kameras, Kontext); eine Öffnung ohne eigene
|
||||
* Variante folgt ihrer Wand. Schnittlinien, Lage-Darstellung und Gruppen bleiben wählbar. Ohne `edit` nichts gesperrt.
|
||||
*/
|
||||
export function designOptionLocked(project: Project, edit: DesignOptionTarget | null | undefined, kind: string, id: string): boolean {
|
||||
if (!edit) return false;
|
||||
if (OUTSIDE_KINDS.has(kind)) return true;
|
||||
const coll = KIND_COLLECTION[kind];
|
||||
if (!coll) return false;
|
||||
const e = ((project[coll] ?? []) as { id: string; designOption?: DesignOptionRef; hostWallId?: string }[]).find((x) => x.id === id);
|
||||
if (!e) return false;
|
||||
const r = e.designOption ?? (coll === "openings" ? project.walls.find((w) => w.id === e.hostWallId)?.designOption : undefined);
|
||||
return !(r && r.set === edit.set && r.option === edit.option);
|
||||
}
|
||||
|
||||
/** Auswahl ohne gesperrte Elemente ({@link designOptionLocked}); unveränderte Listen behalten ihre Referenz. */
|
||||
export function unlockedSelection<T extends Record<string, string[] | undefined>>(project: Project, edit: DesignOptionTarget | null | undefined, sel: T): T {
|
||||
if (!edit) return sel;
|
||||
const out = { ...sel } as Record<string, string[] | undefined>;
|
||||
for (const [k, ids] of Object.entries(sel)) {
|
||||
if (!ids?.length) continue;
|
||||
const keep = ids.filter((id) => !designOptionLocked(project, edit, k, id));
|
||||
if (keep.length !== ids.length) out[k] = keep;
|
||||
}
|
||||
return out as T;
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
// [272] Dock-Panel „Varianten“ (wie Archicads Design-Options-Verwaltung): Kombination der aktiven Ansicht (je Satz eine
|
||||
// Variante; ein Feld der Ebene wie der Umbaufilter, darum je Reiter eigen und mit Undo), „neue Elemente zeichnen in …“
|
||||
// (Zustand der Sitzung), Auswahl einer Variante zuweisen oder in eine Variante kopieren (ein Undo-Schritt), Sätze und
|
||||
// Varianten verwalten samt „Übernehmen“ (Ressourcen-Tab, dieselben Bausteine) und der Vergleich der Kennzahlen/Kosten.
|
||||
// [272] Dock-Panel „Varianten“ (wie Archicads Design-Options-Manager): je Variante Auge und Stift — Auge = in der
|
||||
// Kombination der aktiven Ansicht sichtbar (je Satz eine; ein Feld der Ebene wie der Umbaufilter, darum je Reiter eigen
|
||||
// und mit Undo), Stift = Bearbeitungsvariante (neue Elemente landen in ihr; Zustand der Sitzung, kein Undo-Schritt;
|
||||
// Stift impliziert Auge). Im Bearbeitungsmodus zwei Häkchen wie in Archicad: ausserhalb grau einfärben (nur Bildschirm)
|
||||
// und sperren (nicht wählbar). Dazu benannte Kombinationen, Auswahl einer Variante zuweisen oder in eine Variante kopieren
|
||||
// (ein Undo-Schritt), Sätze und Varianten verwalten samt „Übernehmen“ und der Vergleich der Kennzahlen/Kosten.
|
||||
|
||||
import { useMemo, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
@@ -9,12 +11,13 @@ import { useStore } from "../state/appStore";
|
||||
import {
|
||||
addCombinationOps, assignCombinationOps, combinationChoice, deleteCombinationOps, designOptionCombinations, levelCombinationState, nextCombinationName, renameCombinationOps, setCombinationChoiceOps,
|
||||
acceptDesignOptionOps, addDesignOptionOps, addDesignOptionSetOps, assignDesignOptionOps, copyToDesignOptionOps, deleteDesignOptionOps, designOptionIds,
|
||||
designOptionSets, designOptionTargets, levelCombination, parseTarget, renameDesignOptionOps, renameDesignOptionSetOps, setLevelCombinationOps, setPrimaryOptionOps,
|
||||
designOptionSets, designOptionTargets, levelCombination, parseTarget, renameDesignOptionOps, renameDesignOptionSetOps, setPrimaryOptionOps,
|
||||
eyeClick, penClick, visibleOption,
|
||||
} from "../core";
|
||||
import { ConfirmDialog } from "../ui/ConfirmDialog";
|
||||
import { InlineName } from "../ui/InlineName";
|
||||
import { PromptDialog } from "../ui/PromptDialog";
|
||||
import { DesignOptionsTab, type DesignOptionHandlers } from "../ui/resourceManager/DesignOptionsTab";
|
||||
import { DesignOptionsTab, type DesignOptionHandlers, type DesignOptionViewControls } from "../ui/resourceManager/DesignOptionsTab";
|
||||
import { DesignOptionCompareSection } from "./DesignOptionCompareSection";
|
||||
import { selectionDesignOptionIds } from "./objectInfo/DesignOptionField";
|
||||
|
||||
@@ -24,6 +27,10 @@ export function DesignOptionsPanel() {
|
||||
const selection = useStore((s) => s.selection);
|
||||
const draw = useStore((s) => s.drawDesignOption);
|
||||
const setDraw = useStore((s) => s.setDrawDesignOption);
|
||||
const grey = useStore((s) => s.designOptionGrey);
|
||||
const setGrey = useStore((s) => s.setDesignOptionGrey);
|
||||
const lock = useStore((s) => s.designOptionLock);
|
||||
const setLock = useStore((s) => s.setDesignOptionLock);
|
||||
const applyChange = useStore((s) => s.applyChange);
|
||||
const [target, setTarget] = useState("");
|
||||
const [showCompare, setShowCompare] = useState(false);
|
||||
@@ -47,7 +54,19 @@ export function DesignOptionsPanel() {
|
||||
onAcceptDesignOption: (setId, optionId) => applyChange((p) => acceptDesignOptionOps(p, setId, optionId)),
|
||||
onDeleteDesignOption: (setId, optionId) => applyChange((p) => deleteDesignOptionOps(p, setId, optionId)),
|
||||
};
|
||||
const drawKey = draw ? `${draw.set}/${draw.option}` : "";
|
||||
// Auge und Stift je Variante (Zeilen der Variantensätze).
|
||||
const view: DesignOptionViewControls = {
|
||||
visible: (setId) => visibleOption(project, level, draw, setId),
|
||||
edit: draw,
|
||||
eyeEnabled: levelEditable,
|
||||
onEye: (setId, optionId) => {
|
||||
if (!level) return;
|
||||
const r = eyeClick(project, level.id, draw, setId, optionId);
|
||||
if (r.ops.length) applyChange((p) => eyeClick(p, level.id, draw, setId, optionId).ops);
|
||||
if (r.draw !== draw) setDraw(r.draw);
|
||||
},
|
||||
onPen: (setId, optionId) => setDraw(penClick(project, draw, setId, optionId)),
|
||||
};
|
||||
const setOptions = (s: (typeof sets)[number]) =>
|
||||
s.options.map((o) => (
|
||||
<option key={o.id} value={o.id}>
|
||||
@@ -68,28 +87,35 @@ export function DesignOptionsPanel() {
|
||||
<section className="reno-panel design-options-panel" data-testid="design-options-panel">
|
||||
{sets.length > 0 && (
|
||||
<>
|
||||
<div className="reno-block">
|
||||
<div className="reno-head">{t("designOption.viewCombination")}</div>
|
||||
{sets.map((s) => (
|
||||
<label key={s.id} className="reno-field">
|
||||
<span>{s.name}</span>
|
||||
<select
|
||||
value={combo[s.id] ?? ""}
|
||||
disabled={!levelEditable}
|
||||
aria-label={s.name}
|
||||
data-testid={`design-option-combo-${s.id}`}
|
||||
onChange={(e) => level && applyChange((p) => setLevelCombinationOps(p, level.id, s.id, e.target.value))}
|
||||
>
|
||||
{setOptions(s)}
|
||||
</select>
|
||||
</label>
|
||||
))}
|
||||
<label className="reno-field">
|
||||
<span>{t("designOption.drawIn")}</span>
|
||||
<select value={drawKey} aria-label={t("designOption.drawIn")} data-testid="design-option-draw" onChange={(e) => setDraw(parseTarget(e.target.value))}>
|
||||
{targetOptions}
|
||||
</select>
|
||||
<div className="reno-block" data-testid="design-option-edit">
|
||||
<div className="reno-head">{t("designOption.edit.title")}</div>
|
||||
<div className={`rm-row dop-main-row${draw ? "" : " is-editing"}`}>
|
||||
<button
|
||||
type="button"
|
||||
className={`reno-icon-btn dop-pen${draw ? "" : " is-on"}`}
|
||||
aria-pressed={!draw}
|
||||
aria-label={t("designOption.pen.main")}
|
||||
title={t("designOption.pen.main")}
|
||||
data-testid="design-option-pen-main"
|
||||
onClick={() => setDraw(null)}
|
||||
>
|
||||
<span className="material-symbols-outlined" aria-hidden="true">{draw ? "edit" : "edit_square"}</span>
|
||||
</button>
|
||||
<span className="dop-main-name">{t("designOption.main")}</span>
|
||||
</div>
|
||||
<label className="reno-field dop-check">
|
||||
<input type="checkbox" checked={grey} data-testid="design-option-grey" onChange={(e) => setGrey(e.target.checked)} />
|
||||
<span>{t("designOption.edit.grey")}</span>
|
||||
</label>
|
||||
<label className="reno-field dop-check">
|
||||
<input type="checkbox" checked={lock} data-testid="design-option-lock" onChange={(e) => setLock(e.target.checked)} />
|
||||
<span>{t("designOption.edit.lock")}</span>
|
||||
</label>
|
||||
<div className="reno-hint">{t("designOption.edit.hint")}</div>
|
||||
</div>
|
||||
<div className="reno-block">
|
||||
<div className="reno-head">{t("designOption.sets.title")}</div>
|
||||
<DesignOptionsTab project={project} handlers={handlers} embedded view={view} />
|
||||
</div>
|
||||
<div className="reno-block">
|
||||
<div className="reno-head">{t("designOption.combinations.title")}</div>
|
||||
@@ -162,10 +188,12 @@ export function DesignOptionsPanel() {
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
<div className="reno-block">
|
||||
<div className="reno-head">{t("designOption.sets.title")}</div>
|
||||
<DesignOptionsTab project={project} handlers={handlers} embedded />
|
||||
</div>
|
||||
{sets.length === 0 && (
|
||||
<div className="reno-block">
|
||||
<div className="reno-head">{t("designOption.sets.title")}</div>
|
||||
<DesignOptionsTab project={project} handlers={handlers} embedded />
|
||||
</div>
|
||||
)}
|
||||
{sets.length > 0 && (
|
||||
<div className="reno-block">
|
||||
<button type="button" className="reno-add-btn" data-testid="design-option-compare-open" onClick={() => setShowCompare((v) => !v)}>
|
||||
|
||||
@@ -25,6 +25,7 @@ import type {
|
||||
} from "../model/types";
|
||||
import { documentFor } from "../core/document";
|
||||
import { lineEndsCode } from "../model/lineEnds";
|
||||
import type { DesignOptionEditArg } from "../model/designOptions";
|
||||
import { registerCoreRestore } from "../engine/coreWasm";
|
||||
import { decodePlanBuf, type DecodedPlanBuf } from "./planBuf";
|
||||
import {
|
||||
@@ -260,6 +261,11 @@ export function generatePlan(
|
||||
* {@link generateVisibleLevelsPlan}); Achsraster, die dort auch stehen, fehlen hier (nur einmal im Bild).
|
||||
*/
|
||||
traceOf?: string | null,
|
||||
/**
|
||||
* [272] Bearbeitungsvariante der Bildschirm-Ansicht (Stift im Panel „Varianten“, `model/designOptions.ts`): sichtbar, mit
|
||||
* `grey` alles ausserhalb grau (Kern `renovation::View::editing`). Nie im Druck/Export (dort fehlt sie).
|
||||
*/
|
||||
designOptionEdit?: DesignOptionEditArg | null,
|
||||
): Plan {
|
||||
const compact = compactUnderlay && !forPrint;
|
||||
// Blatt-Ebene eines Layouts (Papier 1:1): ohne projektglobale Zutaten (Kontext, Luftbilder,
|
||||
@@ -275,7 +281,7 @@ export function generatePlan(
|
||||
// Zeitpunkt der Schattenstudie: `Date` nimmt das Datum, wie es in der Datei steht (Ortszeit ohne Zone).
|
||||
const study = project.sunStudy;
|
||||
const sunWhen = includeGlobal && study?.show ? new Date(study.when).getTime() : NaN;
|
||||
const dom = planDomains(project, floorId, visibleCodes, categoryDisplay, detail, showReferenceLines, includeGlobal, scaleDenominator, forPrint, compact, mono, sunWhen, overrideRuleIds, traceOf);
|
||||
const dom = planDomains(project, floorId, visibleCodes, categoryDisplay, detail, showReferenceLines, includeGlobal, scaleDenominator, forPrint, compact, mono, sunWhen, overrideRuleIds, traceOf, forPrint ? null : designOptionEdit);
|
||||
const pieces: PlanPiece[] = [];
|
||||
const pushGroups = (first: number, last: number): void => {
|
||||
const from = dom.buf.groups[first][0];
|
||||
@@ -356,6 +362,8 @@ export function generateVisibleLevelsPlan(
|
||||
scaleDenominator: number = DEFAULT_SCALE_DENOMINATOR,
|
||||
/** Kompakte Linien-Unterlage (s. `UnderlayGroup`) — nur die interaktive GPU-Ansicht. */
|
||||
compactUnderlay = false,
|
||||
/** [272] Bearbeitungsvariante der Bildschirm-Ansicht (s. {@link generatePlan}). */
|
||||
designOptionEdit?: DesignOptionEditArg | null,
|
||||
): Plan {
|
||||
const active = project.drawingLevels.find((l) => l.id === activeLevelId);
|
||||
const siblings =
|
||||
@@ -408,6 +416,7 @@ export function generateVisibleLevelsPlan(
|
||||
compactUnderlay,
|
||||
null,
|
||||
activeLevelId, // [203] Achsraster des aktiven Geschosses nicht noch einmal
|
||||
designOptionEdit,
|
||||
);
|
||||
for (const g of p.underlay ?? []) underlay.push({ ...g, tint: d.greyed, above: false });
|
||||
const from = count;
|
||||
@@ -434,6 +443,9 @@ export function generateVisibleLevelsPlan(
|
||||
scaleDenominator,
|
||||
false,
|
||||
compactUnderlay,
|
||||
null,
|
||||
null,
|
||||
designOptionEdit,
|
||||
);
|
||||
const activeCount = planCount(activePlan);
|
||||
for (const pc of piecesOf(activePlan)) pieces.push(pc);
|
||||
@@ -504,6 +516,7 @@ function planDomainsArgs(
|
||||
sunWhen: number,
|
||||
rules?: readonly string[] | null,
|
||||
traceOf?: string | null,
|
||||
designOptionEdit?: DesignOptionEditArg | null,
|
||||
): Record<string, unknown> {
|
||||
// Sichtbar und gezeichnet bzw. gedimmt: über die sichtbaren Codes (wenige), nicht über alle
|
||||
// Elemente — der Kern zeichnet ein Element genau dann, wenn sein Code in `show` steht.
|
||||
@@ -518,6 +531,7 @@ function planDomainsArgs(
|
||||
const out: Record<string, unknown> = { floor: floorId, show, grey, referenceLines, global, scale, forPrint, compact, mono, sunWhen: Number.isNaN(sunWhen) ? null : sunWhen };
|
||||
if (rules) out.rules = [...rules];
|
||||
if (traceOf) out.traceOf = traceOf;
|
||||
if (designOptionEdit) out.designOptionEdit = designOptionEdit;
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -573,8 +587,9 @@ function planDomains(
|
||||
sunWhen: number,
|
||||
rules?: readonly string[] | null,
|
||||
traceOf?: string | null,
|
||||
designOptionEdit?: DesignOptionEditArg | null,
|
||||
): DomainPrims {
|
||||
const args = JSON.stringify(planDomainsArgs(floorId, visibleCodes, categoryDisplay, referenceLines, global, scale, forPrint, compact, mono, sunWhen, rules, traceOf));
|
||||
const args = JSON.stringify(planDomainsArgs(floorId, visibleCodes, categoryDisplay, referenceLines, global, scale, forPrint, compact, mono, sunWhen, rules, traceOf, designOptionEdit));
|
||||
const held = chunkStores.get(args);
|
||||
const query = held && held.size ? `${args.slice(0, -1)},"have":[${[...held.keys()].join(",")}]}` : args;
|
||||
const res = readPlanMulti(documentFor(project).queryBin("planDomains", [DETAIL_CODE[detail] ?? 1], query), held);
|
||||
|
||||
@@ -10,6 +10,7 @@ import { decodePlanBuf } from "./planBuf";
|
||||
import { lazyPlan } from "./planLazy";
|
||||
import { hasLine, levelArg, visibilityArgs } from "./toSection";
|
||||
import type { CategoryDisplayResolver, Plan } from "./generatePlan";
|
||||
import type { DesignOptionEditArg } from "../model/designOptions";
|
||||
|
||||
/** Optionen des Ansichts-Generators. */
|
||||
export interface ElevationOptions {
|
||||
@@ -27,6 +28,8 @@ export interface ElevationOptions {
|
||||
scaleDenominator?: number;
|
||||
/** [33] Eingeschaltete Override-Regeln eines Blatt-Viewports (fehlt = Schalter im Projekt). */
|
||||
overrideRuleIds?: readonly string[] | null;
|
||||
/** [272] Bearbeitungsvariante der Bildschirm-Ansicht (`model/designOptions.ts`), nie im Druck. */
|
||||
designOptionEdit?: DesignOptionEditArg | null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,6 +55,7 @@ export function elevationPlanQuery(project: Project, level: DrawingLevel, opts:
|
||||
const text = JSON.stringify({
|
||||
level: levelArg(level),
|
||||
...(opts.overrideRuleIds ? { rules: [...opts.overrideRuleIds] } : {}),
|
||||
...(opts.designOptionEdit ? { designOptionEdit: opts.designOptionEdit } : {}),
|
||||
...visibilityArgs(project, opts.visibleCodes, opts.categoryDisplay),
|
||||
});
|
||||
return { name: "elevationPlan" as const, args: [opts.mono ? 1 : 0, shadows === undefined || shadows === null ? 2 : shadows ? 1 : 0, opts.scaleDenominator ?? 100], text };
|
||||
|
||||
@@ -11,6 +11,7 @@ import { withDocument } from "../core/document";
|
||||
import { decodePlanBuf } from "./planBuf";
|
||||
import { lazyPlan } from "./planLazy";
|
||||
import { lineEndsCode } from "../model/lineEnds";
|
||||
import type { DesignOptionEditArg } from "../model/designOptions";
|
||||
import type { CategoryDisplayResolver, Plan } from "./generatePlan";
|
||||
|
||||
/** Vorbereitete Eingabe eines Schnitts: Projekt, Ebene und der Schlüssel für den Schnitt-Cache des Kerns. */
|
||||
@@ -110,6 +111,8 @@ export function generateSectionPlan(
|
||||
detail?: DetailLevel;
|
||||
/** [33] Eingeschaltete Override-Regeln eines Blatt-Viewports (fehlt = Schalter im Projekt). */
|
||||
overrideRuleIds?: readonly string[] | null;
|
||||
/** [272] Bearbeitungsvariante der Bildschirm-Ansicht (`model/designOptions.ts`), nie im Druck. */
|
||||
designOptionEdit?: DesignOptionEditArg | null;
|
||||
} = {},
|
||||
): Plan {
|
||||
const { project } = output;
|
||||
@@ -138,6 +141,7 @@ export function sectionPlanQuery(output: SectionOutput, mono: boolean, opts: Sec
|
||||
scale: opts.scaleDenominator ?? 100,
|
||||
detail: opts.detail,
|
||||
...(opts.overrideRuleIds ? { rules: [...opts.overrideRuleIds] } : {}),
|
||||
...(opts.designOptionEdit ? { designOptionEdit: opts.designOptionEdit } : {}),
|
||||
...visibilityArgs(project, opts.visibleCodes, opts.categoryDisplay),
|
||||
});
|
||||
const args = output.args.slice();
|
||||
|
||||
@@ -103,6 +103,8 @@ export function classFilterText(hide?: Hide3d, extra?: Record<string, unknown>):
|
||||
}
|
||||
// [272] Variantenkombination der Ansicht (fehlt = Hauptvarianten; Kern `renovation.rs`).
|
||||
if (f.designOptions && Object.keys(f.designOptions).length) h.designOptions = f.designOptions;
|
||||
// [272] Bearbeitungsvariante des 3D-Fensters (Stift; grau ausserhalb, Kern `renovation::screen_view_from_text`).
|
||||
if (f.designOptionEdit) h.designOptionEdit = f.designOptionEdit;
|
||||
return Object.keys(h).length || extra ? JSON.stringify({ ...extra, ...h }) : "";
|
||||
}
|
||||
|
||||
@@ -129,6 +131,8 @@ export interface Filter3d {
|
||||
renovationPhase?: string;
|
||||
/** [272] Variantenkombination der Ansicht (Satz-Id → Varianten-Id); fehlt = Hauptvarianten. */
|
||||
designOptions?: Record<string, string>;
|
||||
/** [272] Bearbeitungsvariante (Stift) des 3D-Fensters: sichtbar, mit `grey` alles ausserhalb grau. Nur Bildschirm. */
|
||||
designOptionEdit?: { set: string; option: string; grey: boolean } | null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -10206,3 +10206,63 @@ body {
|
||||
.reno-icon-btn .material-symbols-outlined {
|
||||
font-size: 16px;
|
||||
}
|
||||
/* [272] Auge und Stift je Variante (wie Archicads Design-Options-Manager), Bearbeitungsmodus. */
|
||||
.rm-design-option .dop-eye {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
.rm-design-option .dop-eye:disabled {
|
||||
opacity: 0.35;
|
||||
cursor: default;
|
||||
}
|
||||
.dop-pen {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
padding: 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.dop-pen .material-symbols-outlined {
|
||||
font-size: 15px;
|
||||
}
|
||||
.dop-pen.is-on {
|
||||
color: var(--accent);
|
||||
border-color: var(--accent-border);
|
||||
background: var(--accent-dim);
|
||||
}
|
||||
.rm-design-option.is-editing,
|
||||
.dop-main-row.is-editing {
|
||||
background: var(--active-dim);
|
||||
border-radius: 6px;
|
||||
}
|
||||
.rm-design-option.is-editing .rm-option-name,
|
||||
.dop-main-row.is-editing .dop-main-name {
|
||||
font-weight: 600;
|
||||
}
|
||||
.dop-main-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding-left: 22px;
|
||||
}
|
||||
.dop-check input {
|
||||
margin: 0 4px 0 0;
|
||||
accent-color: var(--accent);
|
||||
}
|
||||
.dop-check span {
|
||||
font-size: 12px;
|
||||
}
|
||||
.sb-toggle.sb-design-editing {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
color: var(--accent);
|
||||
border: 1px solid var(--accent-border);
|
||||
background: var(--accent-dim);
|
||||
border-radius: 6px;
|
||||
padding: 0 6px;
|
||||
}
|
||||
.sb-toggle.sb-design-editing .material-symbols-outlined {
|
||||
font-size: 14px;
|
||||
}
|
||||
@@ -1,11 +1,15 @@
|
||||
// [272] Chip „Variante: …“ in der Statusleiste (neben „Umbau“): zeigt die Variantenkombination der aktiven Ansicht (nur die
|
||||
// Abweichungen von den Hauptvarianten) und öffnet per Klick das Panel „Varianten“, in dem man sie einstellt. Nur sichtbar,
|
||||
// wenn das Projekt Variantensätze hat; bei wenig Platz wandert es mit Pausfolie und „Umbau“ in „⋯“ ([263]).
|
||||
// Im Bearbeitungsmodus (Stift auf einer Variante) zeigt es deutlich „Bearbeite: Dachform B“ (hervorgehoben).
|
||||
|
||||
import { t } from "../i18n";
|
||||
import { useStore } from "../state/appStore";
|
||||
import { combinationSuffix, designOptionTargets, levelCombination, levelCombinationState } from "../core";
|
||||
|
||||
/** Material-Symbol des Bearbeitungsmodus (Ligatur, kein UI-Text). */
|
||||
const EDITING_ICON = "edit_square";
|
||||
|
||||
export function DesignOptionControl() {
|
||||
const project = useStore((s) => s.project);
|
||||
const activeLevelId = useStore((s) => s.activeLevelId);
|
||||
@@ -19,6 +23,23 @@ export function DesignOptionControl() {
|
||||
const drawKey = draw ? `${draw.set}/${draw.option}` : "";
|
||||
const drawLabel = designOptionTargets(project).find((x) => x.key === drawKey)?.label ?? t("designOption.main");
|
||||
const shown = suffix || t("designOption.primaryCombination");
|
||||
const editSet = draw ? project.designOptionSets.find((s) => s.id === draw.set) : undefined;
|
||||
const editOption = editSet?.options.find((o) => o.id === draw?.option);
|
||||
if (editSet && editOption) {
|
||||
const name = `${editSet.name} ${editOption.name}`.trim();
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className="sb-toggle sb-renovation-on sb-design-editing"
|
||||
data-testid="design-option-toggle"
|
||||
title={t("designOption.editing.hint", { option: name })}
|
||||
onClick={() => window.dispatchEvent(new CustomEvent("dossier:reveal-panel", { detail: "design-options" }))}
|
||||
>
|
||||
<span className="material-symbols-outlined" aria-hidden="true">{EDITING_ICON}</span>
|
||||
{t("designOption.editing", { option: name })}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -7,8 +7,24 @@ import { t } from "../../i18n";
|
||||
import type { Project } from "../../model/types";
|
||||
import { designOptionSets, primaryOption } from "../../core";
|
||||
import { ConfirmDialog } from "../ConfirmDialog";
|
||||
import { EyeIcon } from "../EyeIcon";
|
||||
import { InlineName } from "../InlineName";
|
||||
|
||||
/**
|
||||
* [272] Auge und Stift je Variante (nur im Dock-Panel „Varianten“, wie Archicads Design-Options-Manager): Auge = in der
|
||||
* Kombination der aktiven Ansicht sichtbar (je Satz genau eine), Stift = Bearbeitungsvariante (neue Elemente landen in ihr).
|
||||
*/
|
||||
export interface DesignOptionViewControls {
|
||||
/** Sichtbare Variante des Satzes (Stift geht vor). */
|
||||
visible: (setId: string) => string | undefined;
|
||||
/** Bearbeitungsvariante (`null` = Hauptmodell). */
|
||||
edit: { set: string; option: string } | null;
|
||||
/** Die aktive Ansicht kann eine Kombination tragen (sonst Augen gesperrt). */
|
||||
eyeEnabled: boolean;
|
||||
onEye: (setId: string, optionId: string) => void;
|
||||
onPen: (setId: string, optionId: string) => void;
|
||||
}
|
||||
|
||||
export interface DesignOptionHandlers {
|
||||
onAddDesignOptionSet?: (name: string) => void;
|
||||
onRenameDesignOptionSet?: (setId: string, name: string) => void;
|
||||
@@ -35,7 +51,7 @@ function counts(project: Project): Map<string, number> {
|
||||
return out;
|
||||
}
|
||||
|
||||
export function DesignOptionsTab({ project, handlers, embedded }: { project: Project; handlers: DesignOptionHandlers; /** Im Dock-Panel: ohne eigene Überschrift. */ embedded?: boolean }) {
|
||||
export function DesignOptionsTab({ project, handlers, embedded, view }: { project: Project; handlers: DesignOptionHandlers; /** Im Dock-Panel: ohne eigene Überschrift. */ embedded?: boolean; /** [272] Auge und Stift je Variante (nur im Dock-Panel). */ view?: DesignOptionViewControls }) {
|
||||
const sets = designOptionSets(project);
|
||||
const [newName, setNewName] = useState("");
|
||||
const [deleting, setDeleting] = useState<{ setId: string; optionId?: string } | null>(null);
|
||||
@@ -75,8 +91,38 @@ export function DesignOptionsTab({ project, handlers, embedded }: { project: Pro
|
||||
<span className="material-symbols-outlined" aria-hidden="true">delete</span>
|
||||
</button>
|
||||
</div>
|
||||
{s.options.map((o) => (
|
||||
<div className="rm-row rm-design-option" key={o.id} data-testid="rm-design-option">
|
||||
{s.options.map((o) => {
|
||||
const shown = view?.visible(s.id) === o.id;
|
||||
const editing = view?.edit?.set === s.id && view.edit.option === o.id;
|
||||
return (
|
||||
<div className={`rm-row rm-design-option${editing ? " is-editing" : ""}`} key={o.id} data-testid="rm-design-option">
|
||||
{view && (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
className={`eye dop-eye${shown ? " is-on" : ""}`}
|
||||
disabled={!view.eyeEnabled && !shown}
|
||||
aria-pressed={shown}
|
||||
aria-label={`${t("designOption.eye")}: ${o.name}`}
|
||||
title={shown ? t("designOption.eye.on") : t("designOption.eye.off")}
|
||||
data-testid={`design-option-eye-${s.id}-${o.id}`}
|
||||
onClick={() => view.onEye(s.id, o.id)}
|
||||
>
|
||||
<EyeIcon open={shown} />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className={`reno-icon-btn dop-pen${editing ? " is-on" : ""}`}
|
||||
aria-pressed={editing}
|
||||
aria-label={`${t("designOption.pen")}: ${o.name}`}
|
||||
title={editing ? t("designOption.pen.on") : t("designOption.pen.off")}
|
||||
data-testid={`design-option-pen-${s.id}-${o.id}`}
|
||||
onClick={() => view.onPen(s.id, o.id)}
|
||||
>
|
||||
<span className="material-symbols-outlined" aria-hidden="true">{editing ? "edit_square" : "edit"}</span>
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
<input
|
||||
type="radio"
|
||||
className="rm-design-option-primary"
|
||||
@@ -106,7 +152,8 @@ export function DesignOptionsTab({ project, handlers, embedded }: { project: Pro
|
||||
<span className="material-symbols-outlined" aria-hidden="true">delete</span>
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -70,7 +70,8 @@ import { pointCloudSyncItems } from "./pointCloudSync";
|
||||
import { usePointClouds } from "../state/pointCloudStore";
|
||||
import { sun3dFor, sun3dKey } from "./sun3d";
|
||||
import { useStore } from "../state/appStore";
|
||||
import { projectGeoOrigin, storedChoice } from "../core";
|
||||
import { designOptionEditArg, projectGeoOrigin, storedChoice } from "../core";
|
||||
import type { DesignOptionEditArg } from "../core";
|
||||
import {
|
||||
FOV_Y,
|
||||
PITCH_LIMIT,
|
||||
@@ -632,6 +633,11 @@ export function Wasm3DViewport({
|
||||
const c = l ? storedChoice(s.project, l) : undefined;
|
||||
return c ? JSON.stringify(c) : "";
|
||||
});
|
||||
// [272] Bearbeitungsvariante (Stift) samt Häkchen „grau“: sichtbar, ausserhalb grau (nur Bildschirm).
|
||||
const editKey = useStore((s) => {
|
||||
const e = designOptionEditArg(s.project, s.drawDesignOption, s.designOptionGrey);
|
||||
return e ? JSON.stringify(e) : "";
|
||||
});
|
||||
const hide = useMemo<Hide3d>(() => {
|
||||
const split = (k: string) => (k ? k.split("\u0001") : []);
|
||||
const codes = split(hiddenKey);
|
||||
@@ -640,10 +646,11 @@ export function Wasm3DViewport({
|
||||
const [renovation, renovationPhase] = split(renKey);
|
||||
const ren = renovation ? { renovation, ...(renovationPhase ? { renovationPhase } : {}) } : {};
|
||||
const opts = optKey ? { designOptions: JSON.parse(optKey) as Record<string, string> } : {};
|
||||
return onlyIds || hiddenIds.length || floors.length || dim.grey.length || dim.lock.length || dim.greyFloors.length || renovation || optKey
|
||||
? { ...toFilter3d({ only: onlyIds, hidden: hiddenIds }, codes, floors, dim), ...ren, ...opts }
|
||||
const edit = editKey ? { designOptionEdit: JSON.parse(editKey) as DesignOptionEditArg } : {};
|
||||
return onlyIds || hiddenIds.length || floors.length || dim.grey.length || dim.lock.length || dim.greyFloors.length || renovation || optKey || editKey
|
||||
? { ...toFilter3d({ only: onlyIds, hidden: hiddenIds }, codes, floors, dim), ...ren, ...opts, ...edit }
|
||||
: codes;
|
||||
}, [hiddenKey, floorsKey, greyKey, greyFloorsKey, lockKey, onlyIds, hiddenIds, renKey, optKey]);
|
||||
}, [hiddenKey, floorsKey, greyKey, greyFloorsKey, lockKey, onlyIds, hiddenIds, renKey, optKey, editKey]);
|
||||
const hideRef = useRef(hide);
|
||||
hideRef.current = hide;
|
||||
// Versatz je Geschoss ([65]) für Griffe und gezogene Höhen (Modell bleibt unversetzt).
|
||||
|
||||
@@ -43,6 +43,7 @@ import { useClashSession } from "../panels/clashSession";
|
||||
import { greyedFloorIds, hiddenFloorIds } from "../panels/displayMode";
|
||||
import { applyGroupDimmingToPlan } from "../state/groupActions";
|
||||
import { useStore } from "../state/appStore";
|
||||
import { useDesignOptionEdit } from "../state/designOptionEdit";
|
||||
import { planFitKey } from "../state/viewTabs";
|
||||
import { classDisplay3d } from "../state/view3dFilter";
|
||||
import { PlanView } from "./plan/PlanView";
|
||||
@@ -766,6 +767,7 @@ function LevelPlanView({
|
||||
gripHandlers: GripHandlers;
|
||||
}) {
|
||||
const projectEpoch = useStore((s) => s.projectEpoch);
|
||||
const designOptionEdit = useDesignOptionEdit(project);
|
||||
// Fremd-Art-Referenz-Unterlage (Nutzer-Wunsch: "will mal etwas vom Schnitt
|
||||
// abzeichnen" — UND umgekehrt "in der Ansicht auch mal einen Grundriss
|
||||
// zeigen"): jede andere sichtbare Zeichnungsebene ANDERER Art (Auge an,
|
||||
@@ -804,6 +806,8 @@ function LevelPlanView({
|
||||
// Kompakte Linien-Unterlage (s. Plan.underlay): hält Kataster-Importe
|
||||
// handhabbar; PlanView materialisiert sie, wo echte Primitive nötig sind.
|
||||
true,
|
||||
// [272] Bearbeitungsvariante (Stift): sichtbar, ausserhalb grau — nur hier, nie im Druck.
|
||||
designOptionEdit,
|
||||
);
|
||||
// Überlagerung anhängen, ohne die Primitive des Plans zu lesen (lazy, [K3d]).
|
||||
const withOverlay = overlayPrimitives.length === 0 ? p : planWithExtra(p, [], overlayPrimitives);
|
||||
@@ -822,6 +826,7 @@ function LevelPlanView({
|
||||
floorDisplay,
|
||||
overlayPrimitives,
|
||||
groupPath,
|
||||
designOptionEdit,
|
||||
]);
|
||||
// [205] Pausfolie des Reiters unter (bzw. über) dem Grundriss — nicht anwählbar (ohne Ids), nicht gedimmt.
|
||||
const trace = useTracePlan(project, level, basePlan.bounds, visibleCodes, categoryDisplay, detail, referenceLines, mono, scaleDenominator);
|
||||
@@ -1011,6 +1016,7 @@ function SectionPlanView({
|
||||
gripHandlers: GripHandlers;
|
||||
}) {
|
||||
const projectEpoch = useStore((s) => s.projectEpoch);
|
||||
const designOptionEdit = useDesignOptionEdit(project);
|
||||
// Kontext-Objekte hebt der Schnitt (wie bisher) nicht hervor.
|
||||
const sectionSelection = useMemo(
|
||||
() => (selection.contextObjects.length ? { ...selection, contextObjects: [] } : selection),
|
||||
@@ -1077,9 +1083,9 @@ function SectionPlanView({
|
||||
const elevationPlan = useMemo(
|
||||
() =>
|
||||
isElevation
|
||||
? generateElevationPlan(inputs.project, inputs.level, { mono, visibleCodes, categoryDisplay, scaleDenominator })
|
||||
? generateElevationPlan(inputs.project, inputs.level, { mono, visibleCodes, categoryDisplay, scaleDenominator, designOptionEdit })
|
||||
: null,
|
||||
[isElevation, inputs, mono, visibleCodes, categoryDisplay, scaleDenominator],
|
||||
[isElevation, inputs, mono, visibleCodes, categoryDisplay, scaleDenominator, designOptionEdit],
|
||||
);
|
||||
|
||||
const sectionPlan = useMemo(
|
||||
@@ -1092,9 +1098,10 @@ function SectionPlanView({
|
||||
openings: true,
|
||||
scaleDenominator,
|
||||
detail,
|
||||
designOptionEdit,
|
||||
})
|
||||
: null,
|
||||
[isElevation, output, mono, level.hiddenLines, visibleCodes, categoryDisplay, inputs, scaleDenominator, detail],
|
||||
[isElevation, output, mono, level.hiddenLines, visibleCodes, categoryDisplay, inputs, scaleDenominator, detail, designOptionEdit],
|
||||
);
|
||||
const rawPlan = isElevation ? elevationPlan : sectionPlan;
|
||||
// [205] Pausfolie des Reiters (früher nur die Grundriss-Unterlage `planUnderlayId`): jede andere Ebene, ein
|
||||
|
||||
Reference in new issue
Block a user