[218] Raumstempel: Abschnitt in den Objekteinstellungen statt Dialog, Schrift je Zeile, Bezugspunkt/Masse nur im Panel
- Doppelklick auf Raumstempel öffnet das Fenster Objekteinstellungen mit fokussiertem Abschnitt „Raumstempel“ (RoomStampSection, openObjectSettings(deps, "roomStamp")); Overlay-Dialog RoomStampEditor(Host) und TextEditorDialog entfernt. - Modell RoomStampFont (Familie, Grösse, fett, kursiv, Farbe) am Stempel und je Zeile; Kern löst Zeile > Stempel > Vorgabe auf, Zusatzzeilen tragen StampLine.marks; stamp_block*, Anzeige-Szene (gemessene Grundlinien), SVG, Druck-SVG, DXF und HTML-Block lesen sie. Eigene Grössen gehen vor Überdeckung (fit_room_stamp_with). - Mehrfachauswahl: „gemischt“, ein Undo-Schritt für alle gewählten Räume (state/roomStampEdit.ts). - Bezugspunkt und Masse nur im Objekt-Info-Panel, nicht im Fenster (ObjectInfoPanel showPlacement=false). - Tests: Rust (Schrift/Fallback/Überdeckung/Szene), vitest (Abschnitt, gemischt, Undo, Fenster ohne Platzierung, Doppelklick-Ziel), e2e roomStamp218.
This commit is contained in:
49 files changed
+1073
-757
No files matched your search
+14
-13
@@ -60,6 +60,7 @@ import { useCommandEngineHost } from "./state/useCommandEngineHost";
|
||||
import { TRANSFORM_COMMANDS, useToolInput } from "./state/useToolInput";
|
||||
import { useSelectionCommands } from "./state/useSelectionCommands";
|
||||
import { openObjectSettings } from "./state/objectSettings";
|
||||
import type { InfoGroupId } from "./panels/objectInfo/groups";
|
||||
import { openObjectSettingsWindowNative, useObjectSettingsWindowHost } from "./native/objectSettingsWindow";
|
||||
import { isTauriRuntime } from "./native/projectFile";
|
||||
import {
|
||||
@@ -183,7 +184,7 @@ export default function App() {
|
||||
// ── Kontextmenüs (transienter UI-State, bleibt lokal) ─────────────────────
|
||||
const {
|
||||
layerClipboard, setLayerClipboard, drawingStyleClipboard, setDrawingStyleClipboard, menu, setMenu, editor,
|
||||
setEditor, nativeLayerSettingsCode, setNativeLayerSettingsCode, stampEditorRoomId, setStampEditorRoomId,
|
||||
setEditor, nativeLayerSettingsCode, setNativeLayerSettingsCode,
|
||||
editTextId, setEditTextId, editTextMinHeightM, setEditTextMinHeightM,
|
||||
} = useContextMenuState();
|
||||
|
||||
@@ -504,14 +505,16 @@ export default function App() {
|
||||
|
||||
// [195] Taste T / Menü „Objekteinstellungen…" (state/objectSettings.ts): unter Tauri natives Nebenfenster ([195b]),
|
||||
// sonst schwebendes Panel.
|
||||
const openSettingsOfObject = () =>
|
||||
openObjectSettings({
|
||||
activeTool,
|
||||
revealObjectSettings: (group) =>
|
||||
isTauriRuntime()
|
||||
? void openObjectSettingsWindowNative(group)
|
||||
: setLayout((l) => revealPanel(l, "object-settings", { x: 96, y: 96, w: 360, h: 560 })),
|
||||
});
|
||||
const settingsDeps = () => ({
|
||||
activeTool,
|
||||
revealObjectSettings: (group: InfoGroupId | null) =>
|
||||
isTauriRuntime()
|
||||
? void openObjectSettingsWindowNative(group)
|
||||
: setLayout((l) => revealPanel(l, "object-settings", { x: 96, y: 96, w: 360, h: 560 })),
|
||||
});
|
||||
const openSettingsOfObject = () => openObjectSettings(settingsDeps());
|
||||
// [218] Doppelklick auf einen Raumstempel: dieselben Objekteinstellungen, Abschnitt „Raumstempel" fokussiert.
|
||||
const openRoomStampSettings = () => openObjectSettings(settingsDeps(), "roomStamp");
|
||||
useObjectSettingsShortcut(shortcutOverrides, engineRef, openSettingsOfObject);
|
||||
useCloseObjectSettingsOnEscape(activeTool !== "select" || commandActive);
|
||||
|
||||
@@ -606,7 +609,8 @@ export default function App() {
|
||||
categoryDisplay,
|
||||
floorDisplay,
|
||||
selectionState: { selection, setSelection, groupPath },
|
||||
contextMenuState: { setMenu, setStampEditorRoomId, editTextId, setEditTextId, setEditTextMinHeightM },
|
||||
contextMenuState: { setMenu, editTextId, setEditTextId, setEditTextMinHeightM },
|
||||
openRoomStampSettings,
|
||||
});
|
||||
|
||||
// „Bild einfügen" (Werkzeug „image") — siehe state/useImportHandling.ts.
|
||||
@@ -655,7 +659,6 @@ export default function App() {
|
||||
onToggleSection3dCut,
|
||||
openLayerSettings,
|
||||
openSettings,
|
||||
onOpenStampEditor,
|
||||
openResources,
|
||||
dxfInputRef,
|
||||
planViewRef,
|
||||
@@ -1034,8 +1037,6 @@ export default function App() {
|
||||
pendingCopyMode={pendingCopyMode}
|
||||
setPendingCopyMode={setPendingCopyMode}
|
||||
commitCopyCount={commitCopyCount}
|
||||
stampEditorRoomId={stampEditorRoomId}
|
||||
setStampEditorRoomId={setStampEditorRoomId}
|
||||
/>
|
||||
|
||||
{/* Aktives Kontextmenü (genau eines), verdrahtet in menus/AppContextMenu.tsx. */}
|
||||
|
||||
@@ -39,7 +39,7 @@ export interface RichTextEditorProps {
|
||||
autoFocus?: boolean;
|
||||
/**
|
||||
* "pt" (Default) — absolute Schriftgrösse, passend für ein schwebendes
|
||||
* Dialogfenster ohne Zoom-Bezug (TextEditorDialog). "em" — Grösse relativ
|
||||
* Dialogfenster ohne Zoom-Bezug. "em" — Grösse relativ
|
||||
* zur geerbten Schriftgrösse des `.rt-surface`-Containers: für die beiden
|
||||
* Inline-Editoren AUF der Zeichenfläche/dem Blatt (PlanView/LayoutSheet),
|
||||
* die die Basisgrösse selbst per CSS-Variable aus dem echten Zoom setzen —
|
||||
|
||||
+21
-10
@@ -961,7 +961,6 @@ export const de = {
|
||||
"objinfo.room.buildUp": "Aufbau",
|
||||
"objinfo.room.finishes": "Oberflächen (Raumbuch)",
|
||||
"objinfo.room.finishHint": "Material wählen oder Freitext eingeben",
|
||||
"objinfo.room.editStamp": "Stempel bearbeiten …",
|
||||
// ── Extrusions-Attribute (truck-Integration, Object-Info-Panel) ─────────
|
||||
"objinfo.sectionLine.section": "Schnittlinie",
|
||||
"objinfo.dimText.section": "Masszahl",
|
||||
@@ -3288,21 +3287,33 @@ export const de = {
|
||||
"text.editTitle": "Text bearbeiten",
|
||||
"text.apply": "Übernehmen",
|
||||
"text.cancel": "Abbrechen",
|
||||
"roomStamp.title": "Raumstempel bearbeiten",
|
||||
"roomStamp.title": "Raumstempel",
|
||||
"roomStamp.number": "Raumnummer",
|
||||
"roomStamp.name": "Raumname",
|
||||
"roomStamp.nameLine2": "Raumname Zeile 2",
|
||||
"roomStamp.showFloorArea": "Bodenfläche anzeigen",
|
||||
"roomStamp.floorAreaPrefix": "Präfix Bodenfläche",
|
||||
"roomStamp.name": "Name",
|
||||
"roomStamp.nameLine2": "Name Zeile 2",
|
||||
"roomStamp.showFloorArea": "Bodenfläche",
|
||||
"roomStamp.floorAreaPrefix": "Präfix",
|
||||
"roomStamp.asModelView": "Wie Modelldarstellung",
|
||||
"roomStamp.on": "An",
|
||||
"roomStamp.off": "Aus",
|
||||
"roomStamp.showUsage": "SIA-Kategorie anzeigen",
|
||||
"roomStamp.showDivider": "Trennlinie unter dem Namen",
|
||||
"roomStamp.showFinish": "Bodenbelag anzeigen",
|
||||
"roomStamp.roundingStep": "Flächen-Rundung",
|
||||
"roomStamp.showUsage": "SIA-Kategorie",
|
||||
"roomStamp.showDivider": "Trennlinie",
|
||||
"roomStamp.showFinish": "Bodenbelag",
|
||||
"roomStamp.roundingStep": "Rundung",
|
||||
"roomStamp.roundingStepDefault": "Standard (2 Nachkommastellen)",
|
||||
"roomStamp.occupancy": "Personenzahl",
|
||||
"roomStamp.font.section": "Schrift",
|
||||
"roomStamp.font.all": "Ganzer Stempel",
|
||||
"roomStamp.font.name": "Name",
|
||||
"roomStamp.font.line2": "Zeile 2",
|
||||
"roomStamp.font.number": "Nummer",
|
||||
"roomStamp.font.area": "Fläche",
|
||||
"roomStamp.font.usage": "Kategorie",
|
||||
"roomStamp.font.default": "Standard",
|
||||
"roomStamp.font.family": "Schriftart",
|
||||
"roomStamp.font.size": "Schriftgrösse (pt)",
|
||||
"roomStamp.font.color": "Schriftfarbe",
|
||||
"roomStamp.font.reset": "Auf Standard zurücksetzen",
|
||||
"text.selectedHint": "Formatierung wirkt auf den ausgewählten Text",
|
||||
|
||||
// ── Rich-Text-Editor ────────────────────────────────────────────────────────
|
||||
|
||||
+21
-10
@@ -957,7 +957,6 @@ export const en: Record<TranslationKey, string> = {
|
||||
"objinfo.room.buildUp": "Build-up",
|
||||
"objinfo.room.finishes": "Finishes (room book)",
|
||||
"objinfo.room.finishHint": "Choose a material or type free text",
|
||||
"objinfo.room.editStamp": "Edit stamp …",
|
||||
// ── Extruded solid attributes (truck integration, object info panel) ────
|
||||
"objinfo.sectionLine.section": "Section line",
|
||||
"objinfo.dimText.section": "Dimension text",
|
||||
@@ -3276,21 +3275,33 @@ export const en: Record<TranslationKey, string> = {
|
||||
"text.editTitle": "Edit text",
|
||||
"text.apply": "Apply",
|
||||
"text.cancel": "Cancel",
|
||||
"roomStamp.title": "Edit room stamp",
|
||||
"roomStamp.title": "Room stamp",
|
||||
"roomStamp.number": "Room number",
|
||||
"roomStamp.name": "Room name",
|
||||
"roomStamp.nameLine2": "Room name line 2",
|
||||
"roomStamp.showFloorArea": "Show floor area",
|
||||
"roomStamp.floorAreaPrefix": "Floor area prefix",
|
||||
"roomStamp.name": "Name",
|
||||
"roomStamp.nameLine2": "Name line 2",
|
||||
"roomStamp.showFloorArea": "Floor area",
|
||||
"roomStamp.floorAreaPrefix": "Prefix",
|
||||
"roomStamp.asModelView": "As model view",
|
||||
"roomStamp.on": "On",
|
||||
"roomStamp.off": "Off",
|
||||
"roomStamp.showUsage": "Show SIA category",
|
||||
"roomStamp.showDivider": "Divider line below the name",
|
||||
"roomStamp.showFinish": "Show floor finish",
|
||||
"roomStamp.roundingStep": "Area rounding",
|
||||
"roomStamp.showUsage": "SIA category",
|
||||
"roomStamp.showDivider": "Divider",
|
||||
"roomStamp.showFinish": "Floor finish",
|
||||
"roomStamp.roundingStep": "Rounding",
|
||||
"roomStamp.roundingStepDefault": "Default (2 decimal places)",
|
||||
"roomStamp.occupancy": "Occupancy",
|
||||
"roomStamp.font.section": "Font",
|
||||
"roomStamp.font.all": "Whole stamp",
|
||||
"roomStamp.font.name": "Name",
|
||||
"roomStamp.font.line2": "Line 2",
|
||||
"roomStamp.font.number": "Number",
|
||||
"roomStamp.font.area": "Area",
|
||||
"roomStamp.font.usage": "Category",
|
||||
"roomStamp.font.default": "Default",
|
||||
"roomStamp.font.family": "Font family",
|
||||
"roomStamp.font.size": "Font size (pt)",
|
||||
"roomStamp.font.color": "Font color",
|
||||
"roomStamp.font.reset": "Reset to default",
|
||||
"text.selectedHint": "Formatting applies to the selected text",
|
||||
|
||||
"rt.bold": "Bold",
|
||||
|
||||
@@ -30,8 +30,6 @@ export function useContextMenuState() {
|
||||
const [nativeLayerSettingsCode, setNativeLayerSettingsCode] = useState<string | null>(
|
||||
null,
|
||||
);
|
||||
// Offener Raum-Stempel-Editor (Rich-Text) — per Doppelklick/Button geöffnet.
|
||||
const [stampEditorRoomId, setStampEditorRoomId] = useState<string | null>(null);
|
||||
// Text-Inhalt-Editor: Id des per Doppelklick bearbeiteten Text-2D-Elements.
|
||||
const [editTextId, setEditTextId] = useState<string | null>(null);
|
||||
// Mindesthöhe (Meter) des Inline-Editors, wenn `editTextId` aus einem frisch
|
||||
@@ -51,8 +49,6 @@ export function useContextMenuState() {
|
||||
setEditor,
|
||||
nativeLayerSettingsCode,
|
||||
setNativeLayerSettingsCode,
|
||||
stampEditorRoomId,
|
||||
setStampEditorRoomId,
|
||||
editTextId,
|
||||
setEditTextId,
|
||||
editTextMinHeightM,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { defaultRoomStamp, roomDisplayName } from "./roomStamp";
|
||||
import { defaultRoomStamp, roomDisplayName, setStampFontAttr } from "./roomStamp";
|
||||
import type { Room } from "./types";
|
||||
|
||||
function makeRoom(over: Partial<Room> = {}): Room {
|
||||
@@ -50,3 +50,20 @@ describe("roomDisplayName", () => {
|
||||
expect(roomDisplayName(room)).toBe("Küche");
|
||||
});
|
||||
});
|
||||
|
||||
describe("setStampFontAttr [218]", () => {
|
||||
const base = { name: "Wohnen" };
|
||||
it("setzt und entfernt Eigenschaften je Zeile, eine leere Schrift entfällt", () => {
|
||||
const a = setStampFontAttr(base, "nameFont", "sizePt", 18);
|
||||
expect(a.nameFont).toEqual({ sizePt: 18 });
|
||||
const b = setStampFontAttr(a, "nameFont", "family", "Jost");
|
||||
expect(b.nameFont).toEqual({ sizePt: 18, family: "Jost" });
|
||||
const c = setStampFontAttr(setStampFontAttr(b, "nameFont", "sizePt", undefined), "nameFont", "family", "");
|
||||
expect("nameFont" in c).toBe(false);
|
||||
expect(a).toEqual({ name: "Wohnen", nameFont: { sizePt: 18 } }); // unverändert (rein)
|
||||
});
|
||||
it("Unsinn (Grösse <= 0) setzt nichts", () => {
|
||||
expect("font" in setStampFontAttr(base, "font", "sizePt", 0)).toBe(false);
|
||||
expect(setStampFontAttr(base, "areaFont", "bold", true).areaFont).toEqual({ bold: true });
|
||||
});
|
||||
});
|
||||
+34
-1
@@ -2,7 +2,7 @@
|
||||
// für Listen. Das Stempel-Dokument und die Live-Zeilen (Fläche, Nutzung, Personen) baut der Kern
|
||||
// beim Plan-Aufbau (`src-tauri/core/src/plan/domains.rs`, [K3d]).
|
||||
|
||||
import type { Room, RoomStamp } from "./types";
|
||||
import type { Marks, Room, RoomStamp, RoomStampFont } from "./types";
|
||||
import type { Align } from "../text/richText";
|
||||
|
||||
/**
|
||||
@@ -21,6 +21,8 @@ export function defaultRoomStamp(room: Room): RoomStamp {
|
||||
export interface RoomStampLine {
|
||||
text: string;
|
||||
align: Align;
|
||||
/** [218] Schrift der Zeile (Familie, Grösse in pt bei Grundschrift 10, fett, kursiv, Farbe); fehlt: 0.8 × Grundschrift. */
|
||||
marks?: Marks;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,3 +35,34 @@ export function roomDisplayName(room: Room): string {
|
||||
const line2 = (stamp.nameLine2 ?? "").trim();
|
||||
return line2 ? `${stamp.name} ${line2}` : stamp.name;
|
||||
}
|
||||
|
||||
// ── [218] Schrift des Stempels (Objekteinstellungen, Abschnitt „Raumstempel") ────────────────────────
|
||||
// Der Kern setzt sie beim Plan-Aufbau um (`plan/domains.rs::stamp_line_marks`): Zeilenschrift > Stempelschrift >
|
||||
// eingebaute Werte der Zeile.
|
||||
|
||||
/** Schrift-Schlüssel am Stempel: der ganze Stempel und je Zeile. */
|
||||
export type StampFontKey = "font" | "nameFont" | "line2Font" | "numberFont" | "areaFont" | "usageFont";
|
||||
|
||||
/** Eigenschaft einer Stempelschrift. */
|
||||
export type StampFontAttr = keyof RoomStampFont;
|
||||
|
||||
/** Zeilen mit eigener Schrift in Anzeige-Reihenfolge samt den eingebauten Werten (Anzeige, wenn nichts gesetzt ist). */
|
||||
export const STAMP_FONT_LINES: readonly { key: StampFontKey; labelKey: string; size: number; bold: boolean; italic: boolean }[] = [
|
||||
{ key: "font", labelKey: "roomStamp.font.all", size: 10, bold: false, italic: false },
|
||||
{ key: "nameFont", labelKey: "roomStamp.font.name", size: 12, bold: true, italic: false },
|
||||
{ key: "line2Font", labelKey: "roomStamp.font.line2", size: 9, bold: false, italic: true },
|
||||
{ key: "numberFont", labelKey: "roomStamp.font.number", size: 9, bold: false, italic: false },
|
||||
{ key: "areaFont", labelKey: "roomStamp.font.area", size: 8, bold: false, italic: false },
|
||||
{ key: "usageFont", labelKey: "roomStamp.font.usage", size: 8, bold: false, italic: false },
|
||||
];
|
||||
|
||||
/** Schrift einer Zeile setzen (`value` = `undefined`: Eigenschaft entfernen ⇒ Vorgabe); eine leere Schrift entfällt. */
|
||||
export function setStampFontAttr<K extends StampFontAttr>(stamp: RoomStamp, key: StampFontKey, attr: K, value: RoomStampFont[K] | undefined): RoomStamp {
|
||||
const font: RoomStampFont = { ...(stamp[key] ?? {}) };
|
||||
if (value === undefined || value === "" || (typeof value === "number" && !(value > 0))) delete font[attr];
|
||||
else font[attr] = value;
|
||||
const next: RoomStamp = { ...stamp };
|
||||
if (Object.keys(font).length === 0) delete next[key];
|
||||
else next[key] = font;
|
||||
return next;
|
||||
}
|
||||
@@ -3322,6 +3322,34 @@ export type RoomStamp = {
|
||||
showFinish?: boolean;
|
||||
/** [177] Trennlinie unter dem Namen anzeigen. Fehlt/false: keine Linie. */
|
||||
showDivider?: boolean;
|
||||
/** [218] Schrift des ganzen Stempels (Vorgabe für alle Zeilen ohne eigene Angabe). */
|
||||
font?: RoomStampFont;
|
||||
/** [218] Schrift der Namenszeile (Vorgabe: Stempelschrift, sonst 12 pt fett). */
|
||||
nameFont?: RoomStampFont;
|
||||
/** [218] Schrift der zweiten Namenszeile (Vorgabe: Stempelschrift, sonst 9 pt kursiv). */
|
||||
line2Font?: RoomStampFont;
|
||||
/** [218] Schrift der Raumnummer (Vorgabe: Stempelschrift, sonst 9 pt). */
|
||||
numberFont?: RoomStampFont;
|
||||
/** [218] Schrift der Bodenflächen-Zeile (Vorgabe: Stempelschrift, sonst 0.8 × Grundschrift). */
|
||||
areaFont?: RoomStampFont;
|
||||
/** [218] Schrift der Nutzungs-Zeile (Vorgabe: Stempelschrift, sonst 0.8 × Grundschrift). */
|
||||
usageFont?: RoomStampFont;
|
||||
};
|
||||
|
||||
/**
|
||||
* [218] Schrift einer Zeile des Raumstempels; fehlende Werte gelten als „wie die Vorgabe" (Stempelschrift, dann
|
||||
* die eingebauten Werte der Zeile). Grösse in typografischen Punkt auf dem Papier bei der Grundschrift 10 pt
|
||||
* (kleinere Massstäbe verkleinern sie im Verhältnis).
|
||||
*/
|
||||
export type RoomStampFont = {
|
||||
/** Schriftfamilie (eine der gebündelten Schriften, z. B. "Work Sans"). */
|
||||
family?: string;
|
||||
/** Schriftgrösse in pt. */
|
||||
sizePt?: number;
|
||||
bold?: boolean;
|
||||
italic?: boolean;
|
||||
/** Farbe als "#rrggbb". */
|
||||
color?: string;
|
||||
};
|
||||
|
||||
/** [158] Nutzung eines Raums (Raumbuch). Nassräume: Bad, WC, Dusche, Waschküche. */
|
||||
|
||||
@@ -54,7 +54,11 @@ function toDeg360(rad: number): number {
|
||||
}
|
||||
|
||||
|
||||
export function ObjectInfoPanel() {
|
||||
/**
|
||||
* `showPlacement` = false: ohne Bezugspunkt/Lage und Masse (Breite/Höhe/Drehen) — so zeigt sie das Fenster
|
||||
* Objekteinstellungen ([218], Wunsch Maintainer: Platzierung und Masse gehören nur ins Objekt-Info-Panel).
|
||||
*/
|
||||
export function ObjectInfoPanel({ showPlacement = true }: { showPlacement?: boolean } = {}) {
|
||||
const host = usePanelHost();
|
||||
const storeProject = useStore((st) => st.project);
|
||||
const sel = useSelectionInfo();
|
||||
@@ -183,10 +187,9 @@ export function ObjectInfoPanel() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="objinfo-sep" />
|
||||
|
||||
{(
|
||||
{showPlacement && (
|
||||
<>
|
||||
<div className="objinfo-sep" />
|
||||
{/* Bezugspunkt-Würfel (3×3, immer quadratisch) links, X/Y/Z als Spalte
|
||||
rechts daneben (Nutzer-Wunsch). */}
|
||||
<div className="objinfo-section-label">{t("objinfo.refpoint")}</div>
|
||||
|
||||
@@ -21,10 +21,10 @@ Kern; hier stehen Eingabe und Darstellung. Zustand über den Store (`src/state`)
|
||||
|---|---|
|
||||
| `ToolsPanel.tsx`, `AttributesPanel.tsx`, `ObjectInfoPanel.tsx` | Werkzeug-Palette, Attribute, Objekt-Info der Auswahl (`ContextObjectProps.tsx`, `UValueRow.tsx`, `SurfacePatternPlacement.tsx` sind Teile davon) |
|
||||
| `objectSettings/` | Fenster „Objekteinstellungen" ([195], Taste T): `ObjectSettingsPanel` (schwebendes Panel `object-settings`) zeigt Bereich Objekt = `ObjectInfoPanel` und Darstellung = `AttributesPanel` (dieselben Komponenten, keine Doppelspur); `areas.ts` = Bereichs-Zuordnung, `areaState.ts` = gewählter Bereich |
|
||||
| `objectInfo/*.tsx` | Abschnitte je Element-Art (`WallSection`, `CeilingSection`, `RoofSections`, `OpeningSections`, `StairSection`, `RoomSection`, `SolidSections`, `SectionLineSection`, `RefSections`, `TreeSection`), gemeinsame Felder (`fields.tsx`) und Info-Blöcke (`InfoBlocks.tsx`); `ObjectInfoPanel` zeigt sie als einklappbare Gruppen (`InfoGroups.tsx`, `InfoGroup.tsx`, Zustand `infoGroupState.ts`); `groups.ts` hält die Zuordnung (Attribute = nur Gestaltung, Objekt-Info = Bauteil/BIM) und das Ziel der Taste T (`[189]`) |
|
||||
| `objectInfo/*.tsx` | Abschnitte je Element-Art (`WallSection`, `CeilingSection`, `RoofSections`, `OpeningSections`, `StairSection`, `RoomSection`, `RoomStampSection` (Raumstempel samt Schrift, [218]), `SolidSections`, `SectionLineSection`, `RefSections`, `TreeSection`), gemeinsame Felder (`fields.tsx`) und Info-Blöcke (`InfoBlocks.tsx`); `ObjectInfoPanel` zeigt sie als einklappbare Gruppen (`InfoGroups.tsx`, `InfoGroup.tsx`, Zustand `infoGroupState.ts`); `groups.ts` hält die Zuordnung (Attribute = nur Gestaltung, Objekt-Info = Bauteil/BIM) und das Ziel der Taste T (`[189]`) |
|
||||
| `DrawingLevelsPanel.tsx`, `LayersPanel.tsx`, `ElementTreePanel.tsx` | Zeichnungsebenen, Ebenen, Baum Geschoss → Bauteilklasse → Element |
|
||||
| `LayoutsPanel.tsx`, `PublishSection.tsx`, `ViewSnapshotsPanel.tsx` | Layouts als Baum, Publikationssätze (`[79]`), gespeicherte Ansichten |
|
||||
| `RoomBalancePanel.tsx` | Flächenbilanz mit den Abschnitten `AreaTableSection.tsx`, `KennzahlenSection.tsx`, `ProgramCompareSection.tsx`, `ElementScheduleSection.tsx`, `OpeningScheduleSection.tsx`, `RoomBookSection.tsx`; Stempel-Editor `RoomStampEditor.tsx` |
|
||||
| `RoomBalancePanel.tsx` | Flächenbilanz mit den Abschnitten `AreaTableSection.tsx`, `KennzahlenSection.tsx`, `ProgramCompareSection.tsx`, `ElementScheduleSection.tsx`, `OpeningScheduleSection.tsx`, `RoomBookSection.tsx` |
|
||||
| `SitePanel.tsx` | Aktionen zu Gelände und Lage (Import, Gelände erzeugen, Baugrube; keine Import-Liste, [181]), mit `SiteRulesSection.tsx` (Baurecht), `SunStudySection.tsx` (Schatten) und `PointCloudSection.tsx` |
|
||||
| `BcfPanel.tsx`, `ClashPanel.tsx` | BCF-Themen und Kollisionsliste; Sitzungszustand in `bcfSession.ts` und `clashSession.ts` |
|
||||
| `HistoryPanel.tsx` | Undo-Verlauf mit Sprung auf einen Schritt |
|
||||
|
||||
@@ -1,276 +0,0 @@
|
||||
// Schwebender Dialog zum Bearbeiten des strukturierten Raum-Stempels (Feldmodell):
|
||||
// Raumnummer, Raumname (+ Zeile 2), Bodenfläche (mit Präfix) und Nutzung. Jede
|
||||
// Zeile trägt zusätzlich eine eigene Ausrichtung (links/mitte/rechts). Ersetzt
|
||||
// für neue Räume den freien Text-Editor. Kontrolliert (value/onApply/onCancel);
|
||||
// arbeitet auf einem lokalen Entwurf, erst „Übernehmen" schreibt zurück.
|
||||
// Bezeichner englisch, UI-Text über t().
|
||||
//
|
||||
// Folge-Arbeit: Zeilen-Layout-Editor (welches Feld auf welche Zeile),
|
||||
// Per-Feld-Typografie, Fensterfläche.
|
||||
|
||||
import { useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import type { RoomStamp } from "../model/types";
|
||||
import type { Align } from "../text/richText";
|
||||
|
||||
export interface RoomStampEditorProps {
|
||||
/** Ausgangsstempel (wird beim Öffnen kopiert; Editor arbeitet lokal). */
|
||||
value: RoomStamp;
|
||||
/** „Übernehmen" — den bearbeiteten Stempel zurückschreiben. */
|
||||
onApply: (stamp: RoomStamp) => void;
|
||||
/** „Abbrechen"/Schliessen — ohne Übernahme. */
|
||||
onCancel: () => void;
|
||||
}
|
||||
|
||||
/** Die drei Ausrichtungen mit Icon und Beschriftung (für die Umschalter). */
|
||||
const ALIGN_CELLS: { align: Align; icon: string; titleKey: string }[] = [
|
||||
{ align: "left", icon: "format_align_left", titleKey: "text.align.left" },
|
||||
{ align: "center", icon: "format_align_center", titleKey: "text.align.center" },
|
||||
{ align: "right", icon: "format_align_right", titleKey: "text.align.right" },
|
||||
];
|
||||
|
||||
/**
|
||||
* Drei-Wege-Umschalter für die Zeilen-Ausrichtung. `value` ist der aktuelle Wert
|
||||
* (fehlt er, gilt `fallback`); `onChange` liefert die gewählte Ausrichtung.
|
||||
*/
|
||||
function AlignToggle({
|
||||
value,
|
||||
fallback,
|
||||
onChange,
|
||||
disabled,
|
||||
label,
|
||||
}: {
|
||||
value: Align | undefined;
|
||||
fallback: Align;
|
||||
onChange: (align: Align) => void;
|
||||
disabled?: boolean;
|
||||
label: string;
|
||||
}) {
|
||||
const current = value ?? fallback;
|
||||
return (
|
||||
<div className="roomstamp-align" role="group" aria-label={label}>
|
||||
{ALIGN_CELLS.map((cell) => (
|
||||
<button
|
||||
key={cell.align}
|
||||
type="button"
|
||||
className={`roomstamp-align-btn${current === cell.align ? " active" : ""}`}
|
||||
disabled={disabled}
|
||||
aria-pressed={current === cell.align}
|
||||
title={t(cell.titleKey)}
|
||||
aria-label={t(cell.titleKey)}
|
||||
onClick={() => onChange(cell.align)}
|
||||
>
|
||||
<span className="material-symbols-outlined" aria-hidden="true">
|
||||
{cell.icon}
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** [173] Dreifach-Wahl: fehlt = wie Modelldarstellung (Stufe), sonst an/aus am Stempel. */
|
||||
function TriState({ value, onChange }: { value: boolean | undefined; onChange: (v: boolean | undefined) => void }) {
|
||||
return (
|
||||
<select
|
||||
value={value === undefined ? "" : value ? "1" : "0"}
|
||||
onChange={(e) => onChange(e.target.value === "" ? undefined : e.target.value === "1")}
|
||||
>
|
||||
<option value="">{t("roomStamp.asModelView")}</option>
|
||||
<option value="1">{t("roomStamp.on")}</option>
|
||||
<option value="0">{t("roomStamp.off")}</option>
|
||||
</select>
|
||||
);
|
||||
}
|
||||
|
||||
export function RoomStampEditor({ value, onApply, onCancel }: RoomStampEditorProps) {
|
||||
const [draft, setDraft] = useState<RoomStamp>(value);
|
||||
|
||||
const patch = (p: Partial<RoomStamp>) => setDraft((d) => ({ ...d, ...p }));
|
||||
|
||||
const hasLine2 = (draft.nameLine2 ?? "").trim().length > 0;
|
||||
|
||||
return (
|
||||
<div
|
||||
className="texteditor-overlay"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={t("roomStamp.title")}
|
||||
onMouseDown={(e) => {
|
||||
if (e.target === e.currentTarget) onCancel();
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Escape") onCancel();
|
||||
}}
|
||||
>
|
||||
<div className="texteditor-dialog roomstamp-dialog">
|
||||
<div className="texteditor-head">
|
||||
<span className="texteditor-title">{t("roomStamp.title")}</span>
|
||||
<button
|
||||
type="button"
|
||||
className="texteditor-x"
|
||||
onClick={onCancel}
|
||||
title={t("text.cancel")}
|
||||
aria-label={t("text.cancel")}
|
||||
>
|
||||
<span className="material-symbols-outlined" aria-hidden="true">
|
||||
close
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="texteditor-body roomstamp-body">
|
||||
<label className="roomstamp-field">
|
||||
<span className="roomstamp-label">{t("roomStamp.number")}</span>
|
||||
<input
|
||||
type="text"
|
||||
className="roomstamp-input"
|
||||
value={draft.number ?? ""}
|
||||
onChange={(e) => patch({ number: e.target.value })}
|
||||
autoFocus
|
||||
/>
|
||||
</label>
|
||||
|
||||
<div className="roomstamp-row">
|
||||
<label className="roomstamp-field">
|
||||
<span className="roomstamp-label">{t("roomStamp.name")}</span>
|
||||
<input
|
||||
type="text"
|
||||
className="roomstamp-input"
|
||||
value={draft.name}
|
||||
onChange={(e) => patch({ name: e.target.value })}
|
||||
/>
|
||||
</label>
|
||||
<AlignToggle
|
||||
value={draft.nameAlign}
|
||||
fallback="left"
|
||||
label={`${t("roomStamp.name")} — ${t("text.group")}`}
|
||||
onChange={(nameAlign) => patch({ nameAlign })}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="roomstamp-row">
|
||||
<label className="roomstamp-field">
|
||||
<span className="roomstamp-label">{t("roomStamp.nameLine2")}</span>
|
||||
<input
|
||||
type="text"
|
||||
className="roomstamp-input"
|
||||
value={draft.nameLine2 ?? ""}
|
||||
onChange={(e) => patch({ nameLine2: e.target.value })}
|
||||
/>
|
||||
</label>
|
||||
<AlignToggle
|
||||
value={draft.line2Align}
|
||||
fallback="left"
|
||||
disabled={!hasLine2}
|
||||
label={`${t("roomStamp.nameLine2")} — ${t("text.group")}`}
|
||||
onChange={(line2Align) => patch({ line2Align })}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="roomstamp-row">
|
||||
<label className="roomstamp-check">
|
||||
<span>{t("roomStamp.showFloorArea")}</span>
|
||||
<TriState value={draft.showFloorArea} onChange={(showFloorArea) => patch({ showFloorArea })} />
|
||||
</label>
|
||||
<AlignToggle
|
||||
value={draft.floorAreaAlign}
|
||||
fallback="left"
|
||||
disabled={draft.showFloorArea === false}
|
||||
label={`${t("roomStamp.showFloorArea")} — ${t("text.group")}`}
|
||||
onChange={(floorAreaAlign) => patch({ floorAreaAlign })}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<label className="roomstamp-field">
|
||||
<span className="roomstamp-label">{t("roomStamp.floorAreaPrefix")}</span>
|
||||
<input
|
||||
type="text"
|
||||
className="roomstamp-input"
|
||||
value={draft.floorAreaPrefix ?? ""}
|
||||
disabled={draft.showFloorArea === false}
|
||||
onChange={(e) => patch({ floorAreaPrefix: e.target.value })}
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label className="roomstamp-field">
|
||||
<span className="roomstamp-label">{t("roomStamp.roundingStep")}</span>
|
||||
<select
|
||||
className="roomstamp-input"
|
||||
value={draft.roundingStep ?? ""}
|
||||
disabled={draft.showFloorArea === false}
|
||||
onChange={(e) => {
|
||||
const v = e.target.value;
|
||||
patch({ roundingStep: v === "" ? undefined : Number(v) });
|
||||
}}
|
||||
>
|
||||
<option value="">{t("roomStamp.roundingStepDefault")}</option>
|
||||
<option value="0.01">0.01 m²</option>
|
||||
<option value="0.1">0.1 m²</option>
|
||||
<option value="0.5">0.5 m²</option>
|
||||
<option value="1">1 m²</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<div className="roomstamp-row">
|
||||
<label className="roomstamp-check">
|
||||
<span>{t("roomStamp.showUsage")}</span>
|
||||
<TriState value={draft.showUsage} onChange={(showUsage) => patch({ showUsage })} />
|
||||
</label>
|
||||
<AlignToggle
|
||||
value={draft.usageAlign}
|
||||
fallback="left"
|
||||
disabled={draft.showUsage === false}
|
||||
label={`${t("roomStamp.showUsage")} — ${t("text.group")}`}
|
||||
onChange={(usageAlign) => patch({ usageAlign })}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="roomstamp-row">
|
||||
<label className="roomstamp-check">
|
||||
<input type="checkbox" checked={draft.showDivider === true} onChange={(e) => patch({ showDivider: e.target.checked ? true : undefined })} />
|
||||
<span>{t("roomStamp.showDivider")}</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div className="roomstamp-row">
|
||||
<label className="roomstamp-check">
|
||||
<input type="checkbox" checked={draft.showFinish === true} onChange={(e) => patch({ showFinish: e.target.checked ? true : undefined })} />
|
||||
<span>{t("roomStamp.showFinish")}</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<label className="roomstamp-field">
|
||||
<span className="roomstamp-label">{t("roomStamp.occupancy")}</span>
|
||||
<input
|
||||
type="number"
|
||||
min={0}
|
||||
step={1}
|
||||
className="roomstamp-input"
|
||||
value={draft.occupancy ?? ""}
|
||||
onChange={(e) => {
|
||||
const v = e.target.value;
|
||||
patch({ occupancy: v === "" ? undefined : Number(v) });
|
||||
}}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div className="texteditor-foot">
|
||||
<button type="button" className="texteditor-btn" onClick={onCancel}>
|
||||
{t("text.cancel")}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="texteditor-btn texteditor-btn-primary"
|
||||
onClick={() => onApply(draft)}
|
||||
>
|
||||
{t("text.apply")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default RoomStampEditor;
|
||||
@@ -573,8 +573,6 @@ export interface PanelHostValue {
|
||||
onSetRoomName: (name: string) => void;
|
||||
/** Setzt die SIA-416-Blatt-Kategorie des Raums. */
|
||||
onSetRoomSia: (category: SiaCategory) => void;
|
||||
/** Öffnet den Rich-Text-Editor des Raum-Stempels (per ID). */
|
||||
onEditRoomStamp: (roomId: string) => void;
|
||||
|
||||
// ── Extrusions-Attribute (truck-Integration; nur der selektierte Körper) ──
|
||||
/** Setzt die Extrusionshöhe (Meter, > 0) — löst eine Re-Extrusion aus. */
|
||||
|
||||
@@ -15,6 +15,7 @@ import { OpeningSection } from "./OpeningSections";
|
||||
import { DetailRefSection, DimRefsSection, DimTextSection } from "./RefSections";
|
||||
import { RoofSection } from "./RoofSections";
|
||||
import { RoomSection } from "./RoomSection";
|
||||
import { RoomStampSection } from "./RoomStampSection";
|
||||
import { SectionLineSection } from "./SectionLineSection";
|
||||
import { ColumnSection, ExtrudedSolidSection } from "./SolidSections";
|
||||
import { StairSection } from "./StairSection";
|
||||
@@ -50,6 +51,7 @@ export function InfoGroups({ sel, drawing, host }: { sel: SelectionInfo | null;
|
||||
case "openingEditor": return sel?.opening ? <OpeningEditorSection openingId={sel.opening.id} host={host} /> : null;
|
||||
case "stair": return sel?.stair ? <StairSection stair={sel.stair} host={host} /> : null;
|
||||
case "room": return sel?.room ? <RoomSection room={sel.room} roomId={sel.id} host={host} /> : null;
|
||||
case "roomStamp": return sel?.room ? <RoomStampSection roomId={sel.id} /> : null;
|
||||
case "extrudedSolid": return sel?.extrudedSolid ? <ExtrudedSolidSection solid={sel.extrudedSolid} host={host} /> : null;
|
||||
case "column": return sel?.column ? <ColumnSection column={sel.column} host={host} /> : null;
|
||||
case "detailRef": return sel?.detailRef ? <DetailRefSection detailRef={sel.detailRef} drawingId={sel.id} host={host} /> : null;
|
||||
|
||||
@@ -16,8 +16,8 @@ import { useMulti } from "./useMulti";
|
||||
|
||||
// ── Raum-Attribut-Abschnitt ──────────────────────────────────────────────────
|
||||
// Editierbarer Name, SIA-416-Kategorie (5 Blatt-Kategorien), abgeleitete Fläche
|
||||
// + Umfang (read-only), Referenzgeschoss, sowie ein Button, der den Rich-Text-
|
||||
// Stempel-Editor öffnet. Alle Werte/Setter über den Host.
|
||||
// + Umfang (read-only), Referenzgeschoss. Alle Werte/Setter über den Host. Der Stempel hat seit [218] einen
|
||||
// eigenen Abschnitt (`RoomStampSection`).
|
||||
export function RoomSection({
|
||||
room,
|
||||
roomId,
|
||||
@@ -82,15 +82,6 @@ export function RoomSection({
|
||||
|
||||
{/* [158] Raumbuch: Nutzung und Oberflächen. */}
|
||||
<RoomFinishFields roomId={roomId} />
|
||||
|
||||
{/* Stempel bearbeiten (öffnet den Rich-Text-Editor). */}
|
||||
<button
|
||||
type="button"
|
||||
className="objinfo-btn"
|
||||
onClick={() => host.onEditRoomStamp(roomId)}
|
||||
>
|
||||
{t("objinfo.room.editStamp")}
|
||||
</button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
// [218] Raumstempel als Abschnitt der Objekteinstellungen (kein Dialog im Fenster): Abschnitt vorhanden, Schrift je Zeile,
|
||||
// „gemischt" bei Mehrfachauswahl, eine Änderung für alle Räume in einem Undo-Schritt; Bezugspunkt und Masse nur im
|
||||
// Objekt-Info-Panel, nicht im Fenster. Ohne DOM: Server-Render der Panels.
|
||||
import { createElement } from "react";
|
||||
import { renderToString } from "react-dom/server";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { buildComplexSampleProject } from "../../model/sampleProjectComplex";
|
||||
import { setStampFontAttr } from "../../model/roomStamp";
|
||||
import { editRoomStamps } from "../../state/roomStampEdit";
|
||||
import { getState, setState } from "../../state/appStore";
|
||||
import { EMPTY_SELECTION } from "../../state/selection";
|
||||
import { PanelHostProvider } from "../host";
|
||||
import type { PanelHost } from "../types";
|
||||
import { ObjectInfoPanel } from "../ObjectInfoPanel";
|
||||
import { ObjectSettingsPanel } from "../objectSettings/ObjectSettingsPanel";
|
||||
|
||||
const host = { activeTool: "select", sectionLine: null, displayMode: { mode: "all", setMode: () => {} } } as unknown as PanelHost;
|
||||
const wrap = (el: ReturnType<typeof createElement>) => renderToString(createElement(PanelHostProvider, { value: host }, el));
|
||||
const windowHtml = () => wrap(createElement(ObjectSettingsPanel));
|
||||
const panelHtml = () => wrap(createElement(ObjectInfoPanel));
|
||||
|
||||
function twoRooms() {
|
||||
getState().loadProject(buildComplexSampleProject());
|
||||
const rooms = getState().project.rooms!;
|
||||
return [rooms[0].id, rooms[1].id] as const;
|
||||
}
|
||||
|
||||
describe("Raumstempel in den Objekteinstellungen [218]", () => {
|
||||
it("Raum gewählt: Abschnitt „Raumstempel“ mit Schrift je Zeile, kein Overlay-Dialog", () => {
|
||||
const [a] = twoRooms();
|
||||
setState({ selection: { ...EMPTY_SELECTION, rooms: [a] } });
|
||||
const html = windowHtml();
|
||||
expect(html).toContain('data-group="roomStamp"');
|
||||
expect(html).toContain('data-testid="roomstamp-section"');
|
||||
for (const k of ["font", "nameFont", "line2Font", "numberFont", "areaFont", "usageFont"]) expect(html).toContain(`data-testid="roomstamp-font-${k}"`);
|
||||
expect(html).not.toContain("texteditor-overlay");
|
||||
expect(html).not.toContain('role="dialog"');
|
||||
});
|
||||
|
||||
it("Bezugspunkt und Masse nur im Objekt-Info-Panel, nicht im Fenster (Raum und Wand)", () => {
|
||||
const p = buildComplexSampleProject();
|
||||
getState().loadProject(p);
|
||||
for (const sel of [{ rooms: [p.rooms![0].id] }, { walls: [p.walls[0].id] }]) {
|
||||
setState({ selection: { ...EMPTY_SELECTION, ...sel } });
|
||||
const panel = panelHtml();
|
||||
expect(panel).toContain("objinfo-cube");
|
||||
expect(panel).toContain("objinfo-refrow");
|
||||
const win = windowHtml();
|
||||
expect(win).not.toContain("objinfo-cube");
|
||||
expect(win).not.toContain("objinfo-refrow");
|
||||
expect(win).not.toContain("objinfo-xyzcol");
|
||||
expect(win).not.toContain('data-testid="objinfo-dim"');
|
||||
}
|
||||
});
|
||||
|
||||
it("zwei Räume mit abweichender Namensschrift: „gemischt“, bei gleicher nicht", () => {
|
||||
const [a, b] = twoRooms();
|
||||
editRoomStamps([a], (st) => ({ ...st, nameFont: { sizePt: 20 } }), "k1");
|
||||
editRoomStamps([b], (st) => ({ ...st, nameFont: { sizePt: 14 } }), "k2");
|
||||
setState({ selection: { ...EMPTY_SELECTION, rooms: [a, b] } });
|
||||
expect(windowHtml()).toContain('data-mixed="font-nameFont"');
|
||||
// Nummer und Namen bleiben je Raum eigen: gesperrt.
|
||||
expect(windowHtml()).toMatch(/data-testid="roomstamp-number"[^>]*disabled/);
|
||||
setState({ selection: { ...EMPTY_SELECTION, rooms: [a] } });
|
||||
expect(windowHtml()).not.toContain('data-mixed="font-nameFont"');
|
||||
});
|
||||
|
||||
it("Schrift für alle gewählten Räume in EINEM Undo-Schritt", () => {
|
||||
const [a, b] = twoRooms();
|
||||
setState({ selection: { ...EMPTY_SELECTION, rooms: [a, b] } });
|
||||
const before = JSON.stringify(getState().project.rooms!.map((r) => r.stamp ?? null));
|
||||
editRoomStamps([a, b], (s) => setStampFontAttr(setStampFontAttr(s, "nameFont", "family", "Jost"), "nameFont", "sizePt", 18), "stamp:test");
|
||||
const sizes = () => getState().project.rooms!.filter((r) => r.id === a || r.id === b).map((r) => [r.stamp?.nameFont?.family, r.stamp?.nameFont?.sizePt]);
|
||||
expect(sizes()).toEqual([["Jost", 18], ["Jost", 18]]);
|
||||
getState().undo();
|
||||
expect(JSON.stringify(getState().project.rooms!.map((r) => r.stamp ?? null))).toBe(before);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,275 @@
|
||||
// [218] Abschnitt „Raumstempel" der Objekteinstellungen (Doppelklick auf einen Stempel öffnet das Fenster mit diesem
|
||||
// Abschnitt; vorher Overlay-Dialog „Fenster im Fenster"): Nummer, Namenszeilen mit Ausrichtung, Flächen-/Nutzungs-/
|
||||
// Belagszeile und die Schrift (Familie, Grösse, fett, kursiv, Farbe) für den ganzen Stempel und je Zeile.
|
||||
// Schreibt über die Ops des Stores (`applyChange`, wie die Oberflächenfelder des Raums), darum läuft der Abschnitt
|
||||
// im Nebenfenster unverändert über die Spiegelung. Mehrfachauswahl: gleiche Werte zeigen, abweichende „gemischt";
|
||||
// eine Änderung gilt für alle gewählten Räume in EINEM Undo-Schritt; Nummer und Namen bleiben je Raum eigen.
|
||||
|
||||
import { t } from "../../i18n";
|
||||
import type { TranslationKey } from "../../i18n";
|
||||
import { defaultRoomStamp, setStampFontAttr, STAMP_FONT_LINES, type StampFontAttr, type StampFontKey } from "../../model/roomStamp";
|
||||
import type { Room, RoomStamp, RoomStampFont } from "../../model/types";
|
||||
import { useStore } from "../../state/appStore";
|
||||
import { commonValue, type Common } from "../../state/mixedValues";
|
||||
import { editRoomStamps, stampTargetIds } from "../../state/roomStampEdit";
|
||||
import { TEXT_FONTS } from "../../text/fontList";
|
||||
import type { Align } from "../../text/richText";
|
||||
import { Dropdown } from "../../ui/Dropdown";
|
||||
import { MixedMark } from "./fields";
|
||||
|
||||
const NO_ROOMS: Room[] = [];
|
||||
type AlignKey = "nameAlign" | "line2Align" | "floorAreaAlign" | "usageAlign";
|
||||
const RESET_ICON = "restart_alt";
|
||||
const ALIGN_CELLS: { align: Align; icon: string; titleKey: TranslationKey }[] = [
|
||||
{ align: "left", icon: "format_align_left", titleKey: "text.align.left" },
|
||||
{ align: "center", icon: "format_align_center", titleKey: "text.align.center" },
|
||||
{ align: "right", icon: "format_align_right", titleKey: "text.align.right" },
|
||||
];
|
||||
|
||||
function AlignToggle({ value, mixed, disabled, label, onChange }: { value: Align | undefined; mixed?: boolean; disabled?: boolean; label: string; onChange: (a: Align) => void }) {
|
||||
const current = mixed ? undefined : (value ?? "left");
|
||||
return (
|
||||
<div className="roomstamp-align" role="group" aria-label={label}>
|
||||
{ALIGN_CELLS.map((cell) => (
|
||||
<button
|
||||
key={cell.align}
|
||||
type="button"
|
||||
className={`roomstamp-align-btn${current === cell.align ? " active" : ""}`}
|
||||
disabled={disabled}
|
||||
aria-pressed={current === cell.align}
|
||||
title={t(cell.titleKey)}
|
||||
aria-label={t(cell.titleKey)}
|
||||
onClick={() => onChange(cell.align)}
|
||||
>
|
||||
<span className="material-symbols-outlined" aria-hidden="true">{cell.icon}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Dreifach-Wahl: fehlt = wie Modelldarstellung (Stufe), sonst an/aus am Stempel. */
|
||||
function TriState({ value, mixed, onChange, testId }: { value: boolean | undefined; mixed?: boolean; onChange: (v: boolean | undefined) => void; testId?: string }) {
|
||||
return (
|
||||
<select
|
||||
className="objinfo-text"
|
||||
data-testid={testId}
|
||||
value={mixed ? "mixed" : value === undefined ? "" : value ? "1" : "0"}
|
||||
onChange={(e) => onChange(e.target.value === "" ? undefined : e.target.value === "1")}
|
||||
>
|
||||
{mixed && <option value="mixed" disabled>{t("objsettings.mixed")}</option>}
|
||||
<option value="">{t("roomStamp.asModelView")}</option>
|
||||
<option value="1">{t("roomStamp.on")}</option>
|
||||
<option value="0">{t("roomStamp.off")}</option>
|
||||
</select>
|
||||
);
|
||||
}
|
||||
|
||||
export function RoomStampSection({ roomId }: { roomId: string }) {
|
||||
const rooms = useStore((s) => s.project.rooms) ?? NO_ROOMS;
|
||||
const selected = useStore((s) => s.selection.rooms);
|
||||
const ids = stampTargetIds(selected, roomId);
|
||||
const multi = ids.length > 1;
|
||||
const targets = rooms.filter((r) => ids.includes(r.id));
|
||||
const stamps = targets.map((r) => r.stamp ?? defaultRoomStamp(r));
|
||||
|
||||
/** Gemeinsamer Wert eines Stempelfelds über die gewählten Räume. */
|
||||
const common = <T,>(pick: (s: RoomStamp) => T): Common<T> => commonValue(stamps.map(pick));
|
||||
/** Änderung am Stempel aller gewählten Räume (ein Undo-Schritt; gleicher Schlüssel = ein Schritt beim Tippen). */
|
||||
const edit = (fn: (s: RoomStamp) => RoomStamp, key: string) => editRoomStamps(ids, fn, `stamp:${roomId}:${key}`);
|
||||
/** Feld setzen; leer/`undefined` entfernt es (⇒ Vorgabe). */
|
||||
const setField = <K extends keyof RoomStamp>(key: K, value: RoomStamp[K] | undefined) =>
|
||||
edit((s) => {
|
||||
const next = { ...s };
|
||||
if (value === undefined || value === "") delete next[key];
|
||||
else next[key] = value as RoomStamp[K];
|
||||
return next;
|
||||
}, String(key));
|
||||
|
||||
if (targets.length === 0) return null;
|
||||
|
||||
const alignOf = (key: AlignKey, label: TranslationKey, disabled = false) => {
|
||||
const c = common((s) => s[key] ?? "left");
|
||||
return <AlignToggle value={c.value} mixed={c.mixed} disabled={disabled} label={t(label)} onChange={(a) => setField(key, a)} />;
|
||||
};
|
||||
const text = (label: TranslationKey, key: "number" | "name" | "nameLine2" | "floorAreaPrefix", perRoom: boolean, testId: string, align?: AlignKey) => {
|
||||
const c = common((s) => (s[key] as string | undefined) ?? "");
|
||||
const locked = perRoom && multi;
|
||||
return (
|
||||
<div className="objinfo-field">
|
||||
<span className="objinfo-flabel" title={t(label)}>{t(label)}</span>
|
||||
<input
|
||||
type="text"
|
||||
className="objinfo-text"
|
||||
data-testid={testId}
|
||||
value={locked ? "" : (c.value ?? "")}
|
||||
placeholder={c.mixed ? t("objsettings.mixed") : undefined}
|
||||
disabled={locked}
|
||||
onChange={(e) => setField(key, key === "name" ? e.target.value : e.target.value || undefined)}
|
||||
title={t(label)}
|
||||
/>
|
||||
{align && alignOf(align, label)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
const tri = (label: TranslationKey, key: "showFloorArea" | "showUsage", testId: string, align: AlignKey, off: boolean) => {
|
||||
const c = common((s) => s[key]);
|
||||
return (
|
||||
<div className="objinfo-field">
|
||||
<span className="objinfo-flabel" title={t(label)}>{t(label)}</span>
|
||||
<TriState testId={testId} value={c.value} mixed={c.mixed} onChange={(v) => setField(key, v)} />
|
||||
{alignOf(align, label, off)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
const check = (label: TranslationKey, key: "showDivider" | "showFinish") => {
|
||||
const c = common((s) => s[key] === true);
|
||||
return (
|
||||
<div className="objinfo-field">
|
||||
<span className="objinfo-flabel">{t(label)}</span>
|
||||
<input type="checkbox" checked={c.value === true} ref={(el) => { if (el) el.indeterminate = c.mixed; }} onChange={(e) => setField(key, e.target.checked ? true : undefined)} />
|
||||
<MixedMark on={c.mixed} what={key} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
const floorOff = common((s) => s.showFloorArea === false).value === true;
|
||||
const usageOff = common((s) => s.showUsage === false).value === true;
|
||||
const rounding = common((s) => s.roundingStep);
|
||||
const occupancy = common((s) => s.occupancy);
|
||||
|
||||
return (
|
||||
<div data-testid="roomstamp-section">
|
||||
{text("roomStamp.number", "number", true, "roomstamp-number")}
|
||||
{text("roomStamp.name", "name", true, "roomstamp-name", "nameAlign")}
|
||||
{text("roomStamp.nameLine2", "nameLine2", true, "roomstamp-line2", "line2Align")}
|
||||
{tri("roomStamp.showFloorArea", "showFloorArea", "roomstamp-showFloorArea", "floorAreaAlign", floorOff)}
|
||||
{text("roomStamp.floorAreaPrefix", "floorAreaPrefix", false, "roomstamp-prefix")}
|
||||
<div className="objinfo-field">
|
||||
<span className="objinfo-flabel">{t("roomStamp.roundingStep")}</span>
|
||||
<select
|
||||
className="objinfo-text"
|
||||
value={rounding.mixed ? "mixed" : (rounding.value ?? "")}
|
||||
disabled={floorOff}
|
||||
onChange={(e) => setField("roundingStep", e.target.value === "" ? undefined : Number(e.target.value))}
|
||||
>
|
||||
{rounding.mixed && <option value="mixed" disabled>{t("objsettings.mixed")}</option>}
|
||||
<option value="">{t("roomStamp.roundingStepDefault")}</option>
|
||||
<option value="0.01">0.01 m²</option>
|
||||
<option value="0.1">0.1 m²</option>
|
||||
<option value="0.5">0.5 m²</option>
|
||||
<option value="1">1 m²</option>
|
||||
</select>
|
||||
</div>
|
||||
{tri("roomStamp.showUsage", "showUsage", "roomstamp-showUsage", "usageAlign", usageOff)}
|
||||
{check("roomStamp.showDivider", "showDivider")}
|
||||
{check("roomStamp.showFinish", "showFinish")}
|
||||
<div className="objinfo-field">
|
||||
<span className="objinfo-flabel">{t("roomStamp.occupancy")}</span>
|
||||
<input
|
||||
type="number"
|
||||
min={0}
|
||||
step={1}
|
||||
className="objinfo-text"
|
||||
value={occupancy.mixed ? "" : (occupancy.value ?? "")}
|
||||
placeholder={occupancy.mixed ? t("objsettings.mixed") : undefined}
|
||||
onChange={(e) => setField("occupancy", e.target.value === "" ? undefined : Number(e.target.value))}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="objinfo-section-label">{t("roomStamp.font.section")}</div>
|
||||
{STAMP_FONT_LINES.map((line) => (
|
||||
<FontRow key={line.key} line={line} stamps={stamps} edit={edit} />
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Eine Schriftzeile: Familie, Grösse (pt), fett, kursiv, Farbe, Zurücksetzen auf die Vorgabe. */
|
||||
function FontRow({
|
||||
line,
|
||||
stamps,
|
||||
edit,
|
||||
}: {
|
||||
line: (typeof STAMP_FONT_LINES)[number];
|
||||
stamps: readonly RoomStamp[];
|
||||
edit: (fn: (s: RoomStamp) => RoomStamp, key: string) => void;
|
||||
}) {
|
||||
const key: StampFontKey = line.key;
|
||||
const attr = <K extends StampFontAttr>(a: K): Common<RoomStampFont[K]> => commonValue(stamps.map((s) => s[key]?.[a]));
|
||||
const set = <K extends StampFontAttr>(a: K, v: RoomStampFont[K] | undefined) => edit((s) => setStampFontAttr(s, key, a, v), `${key}.${a}`);
|
||||
const family = attr("family");
|
||||
const size = attr("sizePt");
|
||||
const bold = attr("bold");
|
||||
const italic = attr("italic");
|
||||
const color = attr("color");
|
||||
const anySet = stamps.some((s) => s[key] !== undefined);
|
||||
const label = t(line.labelKey as TranslationKey);
|
||||
const toggle = (a: "bold" | "italic", c: Common<boolean | undefined>, builtin: boolean, icon: string) => {
|
||||
const on = c.mixed ? false : (c.value ?? builtin);
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className={`roomstamp-align-btn roomstamp-fontbtn${on ? " active" : ""}`}
|
||||
data-testid={`roomstamp-${key}-${a}`}
|
||||
aria-pressed={on}
|
||||
title={t(a === "bold" ? "text.bold" : "text.italic")}
|
||||
aria-label={t(a === "bold" ? "text.bold" : "text.italic")}
|
||||
onClick={() => set(a, !on)}
|
||||
>
|
||||
<span className="material-symbols-outlined" aria-hidden="true">{icon}</span>
|
||||
</button>
|
||||
);
|
||||
};
|
||||
return (
|
||||
<div className="roomstamp-fontrow" data-testid={`roomstamp-font-${key}`}>
|
||||
<div className="objinfo-field">
|
||||
<span className="objinfo-flabel" title={label}>{label}</span>
|
||||
<Dropdown
|
||||
value={family.mixed ? "" : (family.value ?? "")}
|
||||
onChange={(v) => set("family", v || undefined)}
|
||||
options={[{ value: "", label: family.mixed ? t("objsettings.mixed") : t("roomStamp.font.default") }, ...TEXT_FONTS.map((f) => ({ value: f, label: f }))]}
|
||||
title={`${label} — ${t("roomStamp.font.family")}`}
|
||||
width={150}
|
||||
/>
|
||||
</div>
|
||||
<div className="objinfo-field roomstamp-fontattrs">
|
||||
<input
|
||||
type="number"
|
||||
min={1}
|
||||
max={200}
|
||||
step={0.5}
|
||||
className="objinfo-text roomstamp-size"
|
||||
data-testid={`roomstamp-${key}-size`}
|
||||
value={size.mixed ? "" : (size.value ?? "")}
|
||||
placeholder={size.mixed ? t("objsettings.mixed") : String(line.size)}
|
||||
title={`${label} — ${t("roomStamp.font.size")}`}
|
||||
aria-label={`${label} — ${t("roomStamp.font.size")}`}
|
||||
onChange={(e) => set("sizePt", e.target.value === "" ? undefined : Number(e.target.value))}
|
||||
/>
|
||||
<span className="objinfo-muted">pt</span>
|
||||
{toggle("bold", bold, line.bold, "format_bold")}
|
||||
{toggle("italic", italic, line.italic, "format_italic")}
|
||||
<input
|
||||
type="color"
|
||||
className="roomstamp-color"
|
||||
data-testid={`roomstamp-${key}-color`}
|
||||
value={color.mixed ? "#000000" : (color.value ?? "#000000")}
|
||||
title={`${label} — ${t("roomStamp.font.color")}`}
|
||||
aria-label={`${label} — ${t("roomStamp.font.color")}`}
|
||||
onChange={(e) => set("color", e.target.value)}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
className="roomstamp-align-btn roomstamp-fontbtn"
|
||||
disabled={!anySet}
|
||||
title={t("roomStamp.font.reset")}
|
||||
aria-label={t("roomStamp.font.reset")}
|
||||
onClick={() => edit((s) => { const n = { ...s }; delete n[key]; return n; }, `${key}.reset`)}
|
||||
>
|
||||
<span className="material-symbols-outlined" aria-hidden="true">{RESET_ICON}</span>
|
||||
</button>
|
||||
<MixedMark on={family.mixed || size.mixed || bold.mixed || italic.mixed || color.mixed} what={`font-${key}`} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ describe("Panel-Zuordnung [189]", () => {
|
||||
});
|
||||
|
||||
it("jede Gruppe hat einen Titel", () => {
|
||||
const all: InfoGroupId[] = ["newComponent", "sectionLine", "wall", "ceiling", "roof", "surfacePattern", "opening", "openingEditor", "stair", "room", "extrudedSolid", "column", "detailRef", "dimRefs", "dimText", "grid"];
|
||||
const all: InfoGroupId[] = ["newComponent", "sectionLine", "wall", "ceiling", "roof", "surfacePattern", "opening", "openingEditor", "stair", "room", "roomStamp", "extrudedSolid", "column", "detailRef", "dimRefs", "dimText", "grid"];
|
||||
for (const g of all) expect(INFO_GROUP_TITLE[g]).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -18,6 +18,7 @@ export type InfoGroupId =
|
||||
| "openingEditor"
|
||||
| "stair"
|
||||
| "room"
|
||||
| "roomStamp"
|
||||
| "extrudedSolid"
|
||||
| "column"
|
||||
| "detailRef"
|
||||
@@ -36,6 +37,7 @@ export const INFO_GROUP_TITLE: Record<InfoGroupId, TranslationKey> = {
|
||||
openingEditor: "objinfo.openingEditor.section",
|
||||
stair: "objinfo.stair.section",
|
||||
room: "objinfo.room.section",
|
||||
roomStamp: "roomStamp.title",
|
||||
extrudedSolid: "objinfo.extrudedSolid.section",
|
||||
column: "objinfo.column.section",
|
||||
detailRef: "objinfo.detailRef.section",
|
||||
@@ -69,7 +71,7 @@ export function infoGroups(c: InfoGroupContext): InfoGroupId[] {
|
||||
if (sel.wall || sel.roof) out.push("surfacePattern");
|
||||
if (sel.opening) out.push("opening", "openingEditor");
|
||||
if (sel.stair) out.push("stair");
|
||||
if (sel.room) out.push("room");
|
||||
if (sel.room) out.push("room", "roomStamp");
|
||||
if (sel.extrudedSolid) out.push("extrudedSolid");
|
||||
if (sel.column) out.push("column");
|
||||
if (sel.detailRef) out.push("detailRef");
|
||||
|
||||
@@ -58,7 +58,7 @@ export function ObjectSettingsPanel() {
|
||||
</div>
|
||||
)}
|
||||
<div className="objset-body" role="tabpanel" aria-label={t(AREA_TITLE[area])}>
|
||||
{area === "object" ? <ObjectInfoPanel /> : <AttributesPanel />}
|
||||
{area === "object" ? <ObjectInfoPanel showPlacement={false} /> : <AttributesPanel />}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// [218] Doppelklick auf einen Raumstempel öffnet die Objekteinstellungen mit fokussiertem Abschnitt „Raumstempel"
|
||||
// (Taste T dagegen mit dem ersten Abschnitt der Auswahl).
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import { buildComplexSampleProject } from "../model/sampleProjectComplex";
|
||||
import { getInfoGroupState, resetInfoGroupsForTest } from "../panels/objectInfo/infoGroupState";
|
||||
import { getSettingsArea } from "../panels/objectSettings/areaState";
|
||||
import { getState, setState } from "./appStore";
|
||||
import { openObjectSettings } from "./objectSettings";
|
||||
import { EMPTY_SELECTION } from "./selection";
|
||||
|
||||
describe("openObjectSettings [218]", () => {
|
||||
let revealed: (string | null)[] = [];
|
||||
const deps = { activeTool: "select", revealObjectSettings: (g: string | null) => void revealed.push(g) };
|
||||
beforeEach(() => {
|
||||
revealed = [];
|
||||
resetInfoGroupsForTest();
|
||||
getState().loadProject(buildComplexSampleProject());
|
||||
});
|
||||
|
||||
it("Raum gewählt: T zeigt den Abschnitt „Raum“, der Doppelklick auf den Stempel „Raumstempel“", () => {
|
||||
setState({ selection: { ...EMPTY_SELECTION, rooms: [getState().project.rooms![0].id] } });
|
||||
expect(openObjectSettings(deps)).toBe(true);
|
||||
expect(revealed).toEqual(["room"]);
|
||||
expect(openObjectSettings(deps, "roomStamp")).toBe(true);
|
||||
expect(revealed).toEqual(["room", "roomStamp"]);
|
||||
expect(getInfoGroupState().focus?.id).toBe("roomStamp");
|
||||
expect(getSettingsArea()).toBe("object");
|
||||
});
|
||||
|
||||
it("ein Abschnitt, den die Auswahl nicht hat, wird nicht erzwungen", () => {
|
||||
setState({ selection: { ...EMPTY_SELECTION, walls: [getState().project.walls[0].id] } });
|
||||
openObjectSettings(deps, "roomStamp");
|
||||
expect(revealed).toEqual(["wall"]);
|
||||
});
|
||||
});
|
||||
@@ -4,7 +4,7 @@
|
||||
// und fokussiert; ohne Auswahl die Voreinstellung des aktiven Werkzeugs (Wand/Decke: Typ des neuen Bauteils), sonst
|
||||
// nichts. Die Zuordnung Auswahl → Abschnitt ist rein (`panels/objectInfo/groups.ts::objectSettingsTarget`).
|
||||
|
||||
import { objectSettingsTarget, type InfoGroupId } from "../panels/objectInfo/groups";
|
||||
import { infoGroups, objectSettingsTarget, type InfoGroupId } from "../panels/objectInfo/groups";
|
||||
import { setSettingsArea } from "../panels/objectSettings/areaState";
|
||||
import { expandAndFocusInfoGroup } from "../panels/objectInfo/infoGroupState";
|
||||
import { getState } from "./appStore";
|
||||
@@ -17,8 +17,11 @@ export interface ObjectSettingsDeps {
|
||||
revealObjectSettings: (group: InfoGroupId | null) => void;
|
||||
}
|
||||
|
||||
/** Öffnet die Einstellungen; `false`, wenn es nichts zu öffnen gibt. */
|
||||
export function openObjectSettings(deps: ObjectSettingsDeps): boolean {
|
||||
/**
|
||||
* Öffnet die Einstellungen; `false`, wenn es nichts zu öffnen gibt. `group` wählt den Abschnitt (statt des ersten der
|
||||
* Auswahl), z. B. „roomStamp" beim Doppelklick auf einen Raumstempel ([218]); er muss zur Auswahl gehören.
|
||||
*/
|
||||
export function openObjectSettings(deps: ObjectSettingsDeps, group?: InfoGroupId): boolean {
|
||||
const { project, selection } = getState();
|
||||
const sel = selectionInfoFor(project, selection);
|
||||
let target = objectSettingsTarget(sel, deps.activeTool, isGridDrawing(sel?.kind === "drawing2d" ? sel.id : undefined));
|
||||
@@ -27,6 +30,7 @@ export function openObjectSettings(deps: ObjectSettingsDeps): boolean {
|
||||
target = { group: selection.sectionLines.length > 0 ? "sectionLine" : null };
|
||||
}
|
||||
if (!target) return false;
|
||||
if (group && sel && infoGroups({ sel, isGrid: false, sectionLine: false, newComponentTool: false }).includes(group)) target = { group };
|
||||
setSettingsArea("object");
|
||||
if (target.group) expandAndFocusInfoGroup(target.group);
|
||||
deps.revealObjectSettings(target.group);
|
||||
|
||||
@@ -45,7 +45,7 @@ function targetIds(collection: MultiCollection, id: string): string[] {
|
||||
const ROOF_OWN_KEYS: ReadonlySet<string> = new Set(["outline", "holes", "outlineBulge", "holesBulge", "edgePitchDeg", "dormers"]);
|
||||
|
||||
export function buildElementAttributesHost(c: FlatHostOpts) {
|
||||
const { applyChange, onOpenStampEditor, onToggleSection3dCut, openResources, patchLevel, project, section3dCutId, sectionLine, selection, patchDoorType, patchWindowType, saveOpeningStyle, setCeilingThickness, setWallThickness, slideOpening, updateCeiling, updateOpening, updateRoof, updateRoom, updateStair, updateWall } = c;
|
||||
const { applyChange, onToggleSection3dCut, openResources, patchLevel, project, section3dCutId, sectionLine, selection, patchDoorType, patchWindowType, saveOpeningStyle, setCeilingThickness, setWallThickness, slideOpening, updateCeiling, updateOpening, updateRoof, updateRoom, updateStair, updateWall } = c;
|
||||
/** Wie {@link patchAll}, aber mit Änderungsfunktion je Element (z. B. Stützen-Profil). */
|
||||
function mapAll<K extends MultiCollection>(collection: K, id: string, fn: (e: EntityOf<(typeof PROJECT_LIST)[K]>) => EntityOf<(typeof PROJECT_LIST)[K]>, coalesceKey?: string): void {
|
||||
const ids = targetIds(collection, id);
|
||||
@@ -308,7 +308,6 @@ export function buildElementAttributesHost(c: FlatHostOpts) {
|
||||
onSetRoomSia: (category) => {
|
||||
if (selection?.kind === "room") patchAll("rooms", selection.id, { siaCategory: category });
|
||||
},
|
||||
onEditRoomStamp: (roomId) => onOpenStampEditor(roomId),
|
||||
// ── Extrusions-Attribute (truck-Integration; nur bei selektiertem Körper) ──
|
||||
onSetExtrudedSolidHeight: (height) => {
|
||||
if (selection?.kind !== "extrudedSolid" || !(height > 0)) return;
|
||||
|
||||
@@ -48,7 +48,6 @@ export type PanelHostOpts = {
|
||||
onToggleSection3dCut: (id: string) => void;
|
||||
openLayerSettings: (code: string, x: number, y: number) => void;
|
||||
openSettings: () => void;
|
||||
onOpenStampEditor: (roomId: string) => void;
|
||||
openResources: (tab?: ResourceTabId) => void;
|
||||
dxfInputRef: RefObject<HTMLInputElement | null>;
|
||||
planViewRef: RefObject<PlanViewHandle | null>;
|
||||
|
||||
@@ -497,11 +497,6 @@ export interface ProjectSlice {
|
||||
roomId: string,
|
||||
doc: import("../model/types").RichTextDoc,
|
||||
) => void;
|
||||
/** Setzt den strukturierten Raum-Stempel (Feldmodell). */
|
||||
setRoomStamp: (
|
||||
roomId: string,
|
||||
stamp: import("../model/types").RoomStamp,
|
||||
) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1412,9 +1407,6 @@ export function createProjectSlice(
|
||||
|
||||
setRoomStampDoc: (roomId, doc) =>
|
||||
applyChange((p) => mapRoom(p, roomId, (r) => ({ ...r, stampDoc: doc }))),
|
||||
|
||||
setRoomStamp: (roomId, stamp) =>
|
||||
applyChange((p) => mapRoom(p, roomId, (r) => ({ ...r, stamp }))),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// [218] Raumstempel mehrerer Räume in EINEM Undo-Schritt ändern (Abschnitt „Raumstempel" der Objekteinstellungen).
|
||||
// Fehlt einem Raum der Stempel, beginnt die Änderung beim Standard-Stempel des Raums. Gleicher `key` (Tippen,
|
||||
// Regler) fasst aufeinanderfolgende Änderungen zu einem Schritt zusammen.
|
||||
|
||||
import { patchItems } from "../core";
|
||||
import { defaultRoomStamp } from "../model/roomStamp";
|
||||
import type { Project, Room, RoomStamp } from "../model/types";
|
||||
import { getState } from "./appStore";
|
||||
|
||||
export function editRoomStamps(ids: readonly string[], fn: (stamp: RoomStamp) => RoomStamp, key: string): void {
|
||||
getState().applyChange((p: Project) => patchItems(p, "rooms", [...ids], (r) => ({ ...r, stamp: fn(r.stamp ?? defaultRoomStamp(r)) }) as Room), key);
|
||||
}
|
||||
|
||||
/** Räume, die eine Änderung trifft: bei Mehrfachauswahl alle gewählten (wenn `roomId` dazugehört), sonst nur `roomId`. */
|
||||
export function stampTargetIds(selected: readonly string[], roomId: string): string[] {
|
||||
return selected.length > 1 && selected.includes(roomId) ? [...selected] : [roomId];
|
||||
}
|
||||
@@ -79,6 +79,10 @@ declare global {
|
||||
stairHole: (stairId: string, ceilingId: string) => { start: { x: number; y: number }; center: { x: number; y: number } | null; hole0: { x: number; y: number } | null; lines: number };
|
||||
/** [203] Grundriss der aktiven Ebene wie in der Ansicht (Geschoss-Überlagerung nach Zeichnungsebenen-Modus): Raumstempel je Geschoss (gesamt/gedimmt) und Zahl der Achs-Beschriftungen `axis`. */
|
||||
planStamps: (axis: string) => { floors: Record<string, { n: number; greyed: number }>; axis: number };
|
||||
/** [218] Stempel des Raums `roomId` im Grundriss der aktiven Ebene (wie angezeigt): Lage, Schrift der Namenszeile und Zusatzzeilen; `null` ohne Stempel. */
|
||||
roomStamp: (roomId: string) => { at: { x: number; y: number }; basePt: number; name: { sizePt?: number; font?: string; bold?: boolean }; extra: { text: string; marks?: { sizePt?: number; font?: string; italic?: boolean } }[] } | null;
|
||||
/** [218] Räume der aktiven Ebene mit Mittelpunkt des Umrisses (Modell-m). */
|
||||
roomCenters: () => { id: string; name: string; x: number; y: number }[];
|
||||
/** [205] Pausfolie des Reiters (Store) und ihr Plan für die aktive Ebene: Zahl der Primitive, Linienfarben, Zahl mit Auswahl-Ids, Ausmass. */
|
||||
trace: () => { trace: unknown; n: number; colors: string[]; withIds: number; bounds: { minX: number; minY: number; maxX: number; maxY: number } | null; probe: { x: number; y: number } | null };
|
||||
};
|
||||
@@ -219,6 +223,23 @@ export function installTestHooks(): void {
|
||||
}
|
||||
return { floors, axis: n };
|
||||
},
|
||||
roomStamp: (roomId) => {
|
||||
const s = getState();
|
||||
const p = s.project;
|
||||
const mode = s.displayModes[BUILTIN_PANEL_IDS.drawingLevels] ?? "all";
|
||||
const display = (id: string) => itemDisplay(mode, id === s.activeLevelId, p.drawingLevels.find((l) => l.id === id)?.visible ?? false);
|
||||
const plan = materializeGreyed(materializeUnderlay(generateVisibleLevelsPlan(p, s.activeLevelId, collectVisibleCodes(p.layers), undefined, s.detail, false, false, display, s.scaleDenominator)), true);
|
||||
for (const q of plan.primitives) {
|
||||
if (q.kind !== "text" || q.roomId !== roomId) continue;
|
||||
const m = q.doc.paragraphs[0]?.runs[0]?.marks ?? {};
|
||||
return { at: q.at, basePt: q.basePt, name: { sizePt: m.sizePt, font: m.font, bold: m.bold }, extra: (q.extraLines ?? []).map((l) => ({ text: l.text, marks: l.marks })) };
|
||||
}
|
||||
return null;
|
||||
},
|
||||
roomCenters: () => {
|
||||
const s = getState();
|
||||
return (s.project.rooms ?? []).filter((r) => r.floorId === s.activeLevelId && r.boundary.length >= 3).map((r) => ({ id: r.id, name: r.name, x: r.boundary.reduce((a, v) => a + v.x, 0) / r.boundary.length, y: r.boundary.reduce((a, v) => a + v.y, 0) / r.boundary.length }));
|
||||
},
|
||||
trace: () => {
|
||||
const s = getState();
|
||||
const level = s.project.drawingLevels.find((l) => l.id === s.activeLevelId);
|
||||
|
||||
@@ -58,22 +58,24 @@ export function useMouseSelectionHandlers(opts: {
|
||||
selectionState: Pick<ReturnType<typeof useSelectionState>, "selection" | "setSelection" | "groupPath">;
|
||||
contextMenuState: Pick<
|
||||
ReturnType<typeof useContextMenuState>,
|
||||
"setMenu" | "setStampEditorRoomId" | "editTextId" | "setEditTextId" | "setEditTextMinHeightM"
|
||||
"setMenu" | "editTextId" | "setEditTextId" | "setEditTextMinHeightM"
|
||||
>;
|
||||
/** [218] Fenster Objekteinstellungen mit dem Abschnitt „Raumstempel" öffnen (Doppelklick auf einen Stempel). */
|
||||
openRoomStampSettings: () => void;
|
||||
}) {
|
||||
// [121] Das Projekt liest jeder Handler beim Aufruf aus dem Store (App abonniert es nicht mehr).
|
||||
const { setProject, activeLevelId, visibleCodes, categoryDisplay, floorDisplay, selectionState, contextMenuState } = opts;
|
||||
const { selection, setSelection, groupPath } = selectionState;
|
||||
const { setMenu, setStampEditorRoomId, editTextId, setEditTextId, setEditTextMinHeightM } = contextMenuState;
|
||||
const { setMenu, editTextId, setEditTextId, setEditTextMinHeightM } = contextMenuState;
|
||||
|
||||
// ── Maus-Schema: Auswahl + Kontextmenü aus Grundriss / 3D ─────────────────
|
||||
// Links-Klick im Grundriss: genau eine Wand wählen (Menge ersetzen) bzw.
|
||||
// Leerraum → Auswahl löschen.
|
||||
// Doppelklick auf einen Raum-Stempel: den Raum wählen + den Stempel-Editor
|
||||
// öffnen (Rich-Text-Popup).
|
||||
// Doppelklick auf einen Raum-Stempel: den Raum wählen + die Objekteinstellungen mit dem Abschnitt „Raumstempel"
|
||||
// öffnen ([218], kein Dialog im Fenster mehr). Gehört der Raum schon zur Auswahl, bleibt sie (Mehrfachwerte).
|
||||
const onOpenStampEditor = (roomId: string) => {
|
||||
setSelection({ ...clearKinds(), rooms: [roomId] });
|
||||
setStampEditorRoomId(roomId);
|
||||
if (!getState().selection.rooms.includes(roomId)) setSelection({ ...clearKinds(), rooms: [roomId] });
|
||||
opts.openRoomStampSettings();
|
||||
};
|
||||
// Doppelklick auf ein Text-2D-Element: selektieren + Inhalts-Editor öffnen.
|
||||
const onEditDrawingText = (drawingId: string) => {
|
||||
|
||||
@@ -398,7 +398,6 @@ export function useProjectActions(
|
||||
const moveRoomEdge = useStore((s) => s.moveRoomEdge);
|
||||
const moveRoomStamp = useStore((s) => s.moveRoomStamp);
|
||||
const setRoomStampDoc = useStore((s) => s.setRoomStampDoc);
|
||||
const setRoomStamp = useStore((s) => s.setRoomStamp);
|
||||
|
||||
return {
|
||||
toggleLevelVisible,
|
||||
@@ -523,6 +522,5 @@ export function useProjectActions(
|
||||
moveRoomEdge,
|
||||
moveRoomStamp,
|
||||
setRoomStampDoc,
|
||||
setRoomStamp,
|
||||
};
|
||||
}
|
||||
+22
-154
@@ -6981,169 +6981,37 @@ body {
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
/* Schwebendes Dialog-Fenster zum Bearbeiten eines Rich-Text-Dokuments
|
||||
(Raum-Stempel / Textobjekt) — DOSSIER §4: zentriert, --shadow-3, radius 8,
|
||||
Titel „Text bearbeiten", Kopf mit Schliessen-✕, Fuss Abbrechen/Übernehmen. */
|
||||
.texteditor-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0, 0, 0, 0.28);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1000;
|
||||
/* [218] Abschnitt „Raumstempel" der Objekteinstellungen (früher Dialog). */
|
||||
.roomstamp-fontrow {
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.texteditor-dialog {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 560px;
|
||||
max-width: calc(100vw - 32px);
|
||||
height: 420px;
|
||||
max-height: calc(100vh - 32px);
|
||||
background: var(--panel);
|
||||
.roomstamp-fontrow .objinfo-field {
|
||||
border-bottom: none;
|
||||
}
|
||||
.roomstamp-fontattrs {
|
||||
gap: 4px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.roomstamp-size {
|
||||
flex: 0 0 56px;
|
||||
width: 56px;
|
||||
min-width: 0;
|
||||
}
|
||||
.roomstamp-fontbtn {
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
box-shadow: var(--shadow-3);
|
||||
overflow: hidden;
|
||||
border-radius: 6px;
|
||||
min-width: 26px;
|
||||
height: 26px;
|
||||
}
|
||||
.texteditor-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 10px 12px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.texteditor-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: var(--ink);
|
||||
}
|
||||
.texteditor-x {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 26px;
|
||||
.roomstamp-color {
|
||||
width: 28px;
|
||||
height: 26px;
|
||||
padding: 0;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 999px;
|
||||
background: transparent;
|
||||
color: var(--muted);
|
||||
cursor: pointer;
|
||||
transition: background 0.14s, color 0.14s, border-color 0.14s;
|
||||
}
|
||||
.texteditor-x:hover {
|
||||
background: var(--accent-dim);
|
||||
border-color: var(--accent-border);
|
||||
color: var(--accent);
|
||||
}
|
||||
.texteditor-x .material-symbols-outlined {
|
||||
font-size: 18px;
|
||||
line-height: 1;
|
||||
}
|
||||
.texteditor-body {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
padding: 12px;
|
||||
overflow: auto;
|
||||
}
|
||||
.texteditor-body .rt-editor {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
}
|
||||
.texteditor-foot {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
padding: 10px 12px;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
.texteditor-btn {
|
||||
border: 1px solid var(--border);
|
||||
background: var(--input);
|
||||
color: var(--ink);
|
||||
font-family: inherit;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
padding: 5px 14px;
|
||||
border-radius: 999px;
|
||||
cursor: pointer;
|
||||
transition: background 0.14s, color 0.14s, border-color 0.14s;
|
||||
}
|
||||
.texteditor-btn:hover {
|
||||
border-color: var(--accent-border);
|
||||
background: var(--accent-dim);
|
||||
color: var(--accent);
|
||||
}
|
||||
.texteditor-btn-primary {
|
||||
background: var(--accent);
|
||||
border-color: var(--accent);
|
||||
color: #fff;
|
||||
}
|
||||
.texteditor-btn-primary:hover {
|
||||
background: var(--accent);
|
||||
border-color: var(--accent);
|
||||
color: #fff;
|
||||
filter: brightness(1.08);
|
||||
}
|
||||
|
||||
/* Strukturierter Raum-Stempel-Editor (Feldmodell). */
|
||||
.roomstamp-dialog {
|
||||
height: auto;
|
||||
}
|
||||
.roomstamp-body {
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
overflow: auto;
|
||||
}
|
||||
.roomstamp-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
.roomstamp-label {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: var(--muted);
|
||||
}
|
||||
.roomstamp-input {
|
||||
border: 1px solid var(--border);
|
||||
background: var(--input);
|
||||
color: var(--ink);
|
||||
font-family: inherit;
|
||||
font-size: 13px;
|
||||
padding: 5px 8px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.roomstamp-input:focus {
|
||||
outline: none;
|
||||
border-color: var(--accent-border);
|
||||
}
|
||||
.roomstamp-input:disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.roomstamp-check {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 13px;
|
||||
color: var(--ink);
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
}
|
||||
/* Zeile mit Feld/Häkchen links und Ausrichtungs-Umschalter rechts. */
|
||||
.roomstamp-row {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
gap: 8px;
|
||||
}
|
||||
.roomstamp-row .roomstamp-field {
|
||||
flex: 1;
|
||||
}
|
||||
.roomstamp-row .roomstamp-check {
|
||||
flex: 1;
|
||||
}
|
||||
/* Drei-Wege-Umschalter (links/mitte/rechts) je Stempelzeile. */
|
||||
.roomstamp-align {
|
||||
display: inline-flex;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
// Gebündelte Schriften (SIL Open Font License), die Textwerkzeug, Textstile und Raumstempel anbieten
|
||||
// ([218] aus `ui/TopBar.tsx` hierher, damit auch die Objekteinstellungen sie ohne Umweg über die Oberleiste nutzen).
|
||||
// Bezeichner englisch, Kommentare deutsch.
|
||||
|
||||
/**
|
||||
* Schriftauswahl der Text-Gruppe: 15 kuratierte, lokal gebuendelte
|
||||
* Open-Source-Schriften (SIL Open Font License, siehe `src/text/fonts.css`
|
||||
* und `public/fonts/<slug>/OFL.txt`). Bewusst KEINE Systemfonts mehr — die
|
||||
* Darstellung soll unabhaengig vom Betriebssystem und der PDF-Export
|
||||
* deterministisch sein. Ein spaeterer Einstellungen-Dialog kann weitere
|
||||
* Schriften nachladen; das hier ist die Standardliste.
|
||||
*/
|
||||
export const TEXT_FONTS: string[] = [
|
||||
"Inter",
|
||||
"Work Sans",
|
||||
"IBM Plex Sans",
|
||||
"IBM Plex Mono",
|
||||
"Source Sans 3",
|
||||
"Space Grotesk",
|
||||
"Manrope",
|
||||
"Outfit",
|
||||
"DM Sans",
|
||||
"Public Sans",
|
||||
"Karla",
|
||||
"Rubik",
|
||||
"Jost",
|
||||
"Archivo",
|
||||
"Source Serif 4",
|
||||
];
|
||||
|
||||
@@ -70,7 +70,7 @@ const SCRIPT_SCALE = 0.7;
|
||||
* `sizeUnit`:
|
||||
* • "pt" (Default) — ABSOLUTE CSS-`pt`-Grösse, unabhängig vom umgebenden
|
||||
* Kontext. Richtig für ein schwebendes Dialogfenster ohne "echten"
|
||||
* Massstab (TextEditorDialog).
|
||||
* Massstab.
|
||||
* • "em" — Grösse RELATIV zur geerbten Schriftgrösse des Containers
|
||||
* (`sizePt/basePt` als `em`). Nötig für die beiden Inline-Editoren AUF
|
||||
* der Zeichenfläche/dem Blatt (PlanView/LayoutSheet): die setzen die
|
||||
|
||||
+2
-20
@@ -18,7 +18,6 @@ import type { useProjectActions } from "../state/useProjectActions";
|
||||
import type { useProjectFileActions } from "../state/useProjectFileActions";
|
||||
import type { useSettingsHost } from "../state/useSettingsHost";
|
||||
import type { useTopBarState } from "../state/useTopBarState";
|
||||
import type { useContextMenuState } from "../menus/useContextMenuState";
|
||||
import { t } from "../i18n";
|
||||
import { AiActivityPanel } from "./AiActivityPanel";
|
||||
import { BusyOverlay } from "./BusyOverlay";
|
||||
@@ -32,14 +31,12 @@ import { PresentationDialogHost } from "./PresentationDialog";
|
||||
import { PromptDialog } from "./PromptDialog";
|
||||
import { RecoverAutosaveDialog } from "./RecoverAutosaveDialog";
|
||||
import { ResourceManager, type ResourceManagerHandlers } from "./ResourceManager";
|
||||
import { RoomStampEditorHost } from "./RoomStampEditorHost";
|
||||
import { SettingsDialog } from "./SettingsDialog";
|
||||
import { UnsavedChangesDialog } from "./UnsavedChangesDialog";
|
||||
|
||||
type TopBar = ReturnType<typeof useTopBarState>;
|
||||
type EngineHost = ReturnType<typeof useCommandEngineHost>;
|
||||
type ToolState = ReturnType<typeof useDrawingToolState>;
|
||||
type Menu = ReturnType<typeof useContextMenuState>;
|
||||
|
||||
export function AppDialogs(props: {
|
||||
applyChange: RootState["applyChange"];
|
||||
@@ -67,8 +64,6 @@ export function AppDialogs(props: {
|
||||
pendingCopyMode: ToolState["pendingCopyMode"];
|
||||
setPendingCopyMode: ToolState["setPendingCopyMode"];
|
||||
commitCopyCount: ToolState["commitCopyCount"];
|
||||
stampEditorRoomId: Menu["stampEditorRoomId"];
|
||||
setStampEditorRoomId: Menu["setStampEditorRoomId"];
|
||||
}) {
|
||||
const {
|
||||
applyChange,
|
||||
@@ -88,8 +83,6 @@ export function AppDialogs(props: {
|
||||
pendingCopyMode,
|
||||
setPendingCopyMode,
|
||||
commitCopyCount,
|
||||
stampEditorRoomId,
|
||||
setStampEditorRoomId,
|
||||
} = props;
|
||||
const {
|
||||
resourcesOpen,
|
||||
@@ -128,7 +121,6 @@ export function AppDialogs(props: {
|
||||
const { pendingIfc, setPendingIfc, ifcReport, setIfcReport, runIfcImport } = props.modelImport;
|
||||
const { themeMode, setThemeMode, offline, onOfflineChange, aiAccess, setScaleLineWeights, setLineEnds } = props.settings;
|
||||
const { exportContentMeters, onExportPdf, onExportSvg, onExportDxf } = props.planExport;
|
||||
const { setRoomStamp, setRoomStampDoc } = props.pa;
|
||||
// Das Projekt nur abonnieren, solange ein Dialog offen ist, der es zeigt ([121]): sonst rendert eine Op
|
||||
// am Modell hier nichts. `App` reicht es nicht mehr durch.
|
||||
const needsProject = resourcesOpen || !!importState || settingsOpen;
|
||||
@@ -332,18 +324,8 @@ export function AppDialogs(props: {
|
||||
`text`/`textbox` (sofort nach Platzieren, s. host.focusDrawing) oder
|
||||
Doppelklick auf ein bestehendes Element (onEditDrawingText). */}
|
||||
|
||||
{/* Text-Editor (schwebendes Fenster): Doppelklick auf einen Raumstempel bzw.
|
||||
Button in der Objekt-Info öffnet ihn. „Übernehmen" schreibt das
|
||||
bearbeitete Rich-Text-Dokument über setRoomStampDoc. Die Formatier-
|
||||
Leiste in der Oberleiste wirkt ebenfalls live auf den gewählten Raum. */}
|
||||
{stampEditorRoomId && (
|
||||
<RoomStampEditorHost
|
||||
roomId={stampEditorRoomId}
|
||||
onClose={() => setStampEditorRoomId(null)}
|
||||
setRoomStamp={setRoomStamp}
|
||||
setRoomStampDoc={setRoomStampDoc}
|
||||
/>
|
||||
)}
|
||||
{/* Raumstempel: kein Dialog mehr ([218]) — Doppelklick auf einen Stempel öffnet die Objekteinstellungen mit dem
|
||||
Abschnitt „Raumstempel". Die Formatier-Leiste in der Oberleiste wirkt weiter live auf den Alt-Text eines Raums. */}
|
||||
|
||||
{/* Dezenter Drop-Rahmen, solange eine Datei über die App gezogen wird. */}
|
||||
{dropActive && (
|
||||
|
||||
@@ -38,7 +38,6 @@ liegen in `src/panels`, Befehle in `src/commands`.
|
||||
| Datei | Inhalt |
|
||||
|---|---|
|
||||
| `LayoutSheet.tsx`, `layoutSheetMath.ts`, `LayoutCreateDialogs.tsx`, `SheetTableHud.tsx` | Layout-Blatt im Haupt-Viewport, Treffer- und Resize-Rechnung der Viewports, Erstell-Dialoge, Eigenschaften einer Blatt-Tabelle |
|
||||
| `TextEditorDialog.tsx`, `RoomStampEditorHost.tsx` | Rich-Text-Editor, Stempel-Editor eines Raums |
|
||||
| `OpeningDetailPanels.tsx`, `ElevationPreview.tsx` | Detail-Panels des Fenster-/Türeditors (der Editor selbst: `panels/objectInfo/OpeningEditor.tsx`), Ansichtsvorschau |
|
||||
|
||||
## Unterordner
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
// Stempel-Editor eines Raums als schwebendes Fenster ([121] aus App.tsx herausgelöst): Doppelklick
|
||||
// auf einen Raumstempel bzw. Button in der Objekt-Info öffnet ihn. Strukturierter Stempel für neue
|
||||
// Räume, freier Rich-Text nur noch als Fallback für Alt-Räume. Liest die Räume selbst aus dem Store.
|
||||
//
|
||||
// Bezeichner englisch, Kommentare deutsch (CONVENTIONS.md).
|
||||
|
||||
import { defaultRoomStamp } from "../model/roomStamp";
|
||||
import type { Room } from "../model/types";
|
||||
import { RoomStampEditor } from "../panels/RoomStampEditor";
|
||||
import { useStore } from "../state/appStore";
|
||||
import { docFromText, type RichTextDoc } from "../text/richText";
|
||||
import { TextEditorDialog } from "./TextEditorDialog";
|
||||
|
||||
const NO_ROOMS: Room[] = [];
|
||||
|
||||
export function RoomStampEditorHost({
|
||||
roomId,
|
||||
onClose,
|
||||
setRoomStamp,
|
||||
setRoomStampDoc,
|
||||
}: {
|
||||
roomId: string;
|
||||
onClose: () => void;
|
||||
setRoomStamp: (id: string, stamp: NonNullable<Room["stamp"]>) => void;
|
||||
setRoomStampDoc: (id: string, doc: RichTextDoc) => void;
|
||||
}) {
|
||||
const rooms = useStore((s) => s.project.rooms) ?? NO_ROOMS;
|
||||
const room = rooms.find((r) => r.id === roomId);
|
||||
if (!room) return null;
|
||||
// Strukturierter Stempel für neue Räume (kein Alt-Rich-Text) bzw. sobald
|
||||
// einer gesetzt ist; freier Text nur noch als Fallback für Alt-Räume,
|
||||
// die einen stampDoc, aber keinen strukturierten Stempel tragen.
|
||||
const useStructured = Boolean(room.stamp) || !room.stampDoc;
|
||||
if (useStructured) {
|
||||
return (
|
||||
<RoomStampEditor
|
||||
value={room.stamp ?? defaultRoomStamp(room)}
|
||||
onApply={(edited) => {
|
||||
setRoomStamp(room.id, edited);
|
||||
onClose();
|
||||
}}
|
||||
onCancel={() => onClose()}
|
||||
/>
|
||||
);
|
||||
}
|
||||
const doc = room.stampDoc ?? docFromText(room.name);
|
||||
return (
|
||||
<TextEditorDialog
|
||||
value={doc}
|
||||
onApply={(edited) => {
|
||||
setRoomStampDoc(room.id, edited);
|
||||
onClose();
|
||||
}}
|
||||
onCancel={() => onClose()}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
// Schwebendes Dialog-Fenster zum Bearbeiten eines Rich-Text-Dokuments (Raum-
|
||||
// Stempel / Textobjekt). Doppelklick auf einen Stempel öffnet es (nicht den
|
||||
// Footer). Der Body ist der bestehende RichTextEditor (mit eigener Mini-Toolbar,
|
||||
// hier ok, weil eigenes Fenster). „Übernehmen" schreibt das bearbeitete Dokument
|
||||
// zurück, „Abbrechen" verwirft. Bezeichner englisch, UI-Text deutsch.
|
||||
|
||||
import { useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { RichTextEditor } from "../editors/RichTextEditor";
|
||||
import type { RichTextDoc } from "../text/richText";
|
||||
|
||||
export interface TextEditorDialogProps {
|
||||
/** Ausgangsdokument (wird beim Öffnen kopiert; Editor arbeitet lokal). */
|
||||
value: RichTextDoc;
|
||||
/** „Übernehmen" — das bearbeitete Dokument zurückschreiben. */
|
||||
onApply: (doc: RichTextDoc) => void;
|
||||
/** „Abbrechen"/Schliessen — ohne Übernahme. */
|
||||
onCancel: () => void;
|
||||
}
|
||||
|
||||
export function TextEditorDialog({ value, onApply, onCancel }: TextEditorDialogProps) {
|
||||
// Lokaler Arbeitszustand — erst „Übernehmen" schreibt zurück (echtes
|
||||
// Abbrechen möglich). Start = übergebenes Dokument.
|
||||
const [draft, setDraft] = useState<RichTextDoc>(value);
|
||||
|
||||
return (
|
||||
<div
|
||||
className="texteditor-overlay"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={t("text.editTitle")}
|
||||
onMouseDown={(e) => {
|
||||
if (e.target === e.currentTarget) onCancel();
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Escape") onCancel();
|
||||
}}
|
||||
>
|
||||
<div className="texteditor-dialog">
|
||||
<div className="texteditor-head">
|
||||
<span className="texteditor-title">{t("text.editTitle")}</span>
|
||||
<button
|
||||
type="button"
|
||||
className="texteditor-x"
|
||||
onClick={onCancel}
|
||||
title={t("text.cancel")}
|
||||
aria-label={t("text.cancel")}
|
||||
>
|
||||
<span className="material-symbols-outlined" aria-hidden="true">
|
||||
close
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div className="texteditor-body">
|
||||
<RichTextEditor value={draft} onChange={setDraft} autoFocus />
|
||||
</div>
|
||||
<div className="texteditor-foot">
|
||||
<button type="button" className="texteditor-btn" onClick={onCancel}>
|
||||
{t("text.cancel")}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="texteditor-btn texteditor-btn-primary"
|
||||
onClick={() => onApply(draft)}
|
||||
>
|
||||
{t("text.apply")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default TextEditorDialog;
|
||||
+1
-26
@@ -8,6 +8,7 @@
|
||||
// aus App, Aktionen melden sich über Callbacks zurück. Bezeichner englisch,
|
||||
// UI-Text/Kommentare deutsch (CONVENTIONS.md).
|
||||
|
||||
import { TEXT_FONTS } from "../text/fontList";
|
||||
import { t } from "../i18n";
|
||||
import { checkForUpdate } from "../update/checkForUpdate";
|
||||
import { getRunningVersion } from "../update/version";
|
||||
@@ -523,32 +524,6 @@ function Segment({
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Schriftauswahl der Text-Gruppe: 15 kuratierte, lokal gebuendelte
|
||||
* Open-Source-Schriften (SIL Open Font License, siehe `src/text/fonts.css`
|
||||
* und `public/fonts/<slug>/OFL.txt`). Bewusst KEINE Systemfonts mehr — die
|
||||
* Darstellung soll unabhaengig vom Betriebssystem und der PDF-Export
|
||||
* deterministisch sein. Ein spaeterer Einstellungen-Dialog kann weitere
|
||||
* Schriften nachladen; das hier ist die Standardliste.
|
||||
*/
|
||||
export const TEXT_FONTS: string[] = [
|
||||
"Inter",
|
||||
"Work Sans",
|
||||
"IBM Plex Sans",
|
||||
"IBM Plex Mono",
|
||||
"Source Sans 3",
|
||||
"Space Grotesk",
|
||||
"Manrope",
|
||||
"Outfit",
|
||||
"DM Sans",
|
||||
"Public Sans",
|
||||
"Karla",
|
||||
"Rubik",
|
||||
"Jost",
|
||||
"Archivo",
|
||||
"Source Serif 4",
|
||||
];
|
||||
|
||||
/** Grössen-Presets (pt) der Text-Gruppe. */
|
||||
const TEXT_SIZES: number[] = [8, 9, 10, 11, 12, 14, 18, 24, 36, 48];
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import type { TextStylePreset } from "../../text/richText";
|
||||
import { TEXT_FONTS } from "../TopBar";
|
||||
import { TEXT_FONTS } from "../../text/fontList";
|
||||
import { t } from "../../i18n";
|
||||
import { ColorField, DeleteButton, FieldRow, NumberField, SelectField } from "./fields";
|
||||
|
||||
|
||||
Reference in new issue
Block a user