[272] Varianten: Auge/Stift, grau einfärben und sperren wie Archicad
Panel „Varianten“: je Variante Auge (Kombination der aktiven Ansicht, Op mit Undo; ersetzt die Selects) und Stift (Bearbeitungsvariante, ersetzt „Neue Elemente zeichnen in …“; Stift impliziert Auge; Hauptmodell-Stift beendet). Chip „Bearbeite: …“. Häkchen „ausserhalb grau einfärben“ (nur Bildschirm: Anfrage-Feld designOptionEdit → renovation::View::editing → ghost_style in Resolved.styled, Grundriss/Schnitt/Ansicht/ Axo/3D) und „ausserhalb sperren“ (selectionSlice filtert die Auswahl). Stift und Häkchen sind Sitzungszustand. Goldens unverändert. Tests: Kern design_options_tests (+3), vitest designOptions (+5), e2e designOptions272 (+1, 2× grün Port 5195), renderCount grün.
This commit is contained in:
36 files changed
+910
-81
No files matched your search
@@ -688,7 +688,7 @@ Kennwort, anonym) als PDF; Austausch mit Fachplanern über DXF/IFC.
|
||||
Grünfläche nur per Eingabe, Grenzabstand als Verstossfläche statt kleinster Abstand, Fassadenhöhe nur über ±0.00, Mac/Tauri nicht geprüft. · S
|
||||
UI-Review 14.11.: Flächenbilanz-Panel: Tabellen brechen Text/Köpfe um (Nachweis- und Grundlagen-Tabelle jetzt in 340 px ganz sichtbar, de/en); die breite Flächentabelle (11 Spalten) scrollt nicht mehr: in der schmalen Dock-Spalte (Container ≤ 460 px) wird jede Zeile zur Karte (Geschoss oben, Kennwerte 5 je Zeile mit Kopf über der Zahl; `.area-table.wide`, de/en bei 340 px vollständig lesbar, CSV/PDF unverändert); Fenster-/Türliste (15–20 Spalten) und Raumbuch (12–16) nutzen dasselbe Muster als gemeinsame Komponente `src/panels/CardTable.tsx` (Köpfe per Effekt als `data-label`, lange Textzellen belegen 2–3 Rasterspalten, leere Zellen entfallen; Container-Query ≤ 460 px, sonst normale Tabelle; 14.11. spät, Chromium de/en, 303 px Dock, kein waagrechtes Scrollen mehr; Kosten- und Bauteil-Tabelle (≤ 6 Spalten) scrollten nicht und blieben). Icon-Schrift „settings“ als Text: Schrift ist lokal gebündelt (npm `material-symbols`, `main.tsx`, NOTICE [117]) — Ursache war nur der verlinkte `node_modules` im Worktree (Vite `/@fs` 403), kein App-Fehler. Blatt-Tabelle Baurecht (14.11. spät, als Primitive in Chromium angesehen, nicht in der Blatt-Ansicht der App): Kopf „Reserve (+) / Überschr. (−)“ und „Zulässig“/„Erfüllt“ wurden mit „…“ gekürzt → kurzer Blatt-Kopf „Reserve“, Spaltenbreiten neu (Köpfe passen ab 100 mm Rahmenbreite, Test `baurecht_tabelle_koepfe_passen`); lange Zeilentexte kürzen bei < 150 mm weiterhin mit „…“ (kein Umbruch im Blatt-Tabellenkern).
|
||||
|
||||
- ◐ **[272]** Varianten wie Archicad „Design Options“ (17.11., Wunsch Maintainer, für 1.0). **Stand 17.11.:** Modell (Rust, gen:types, KNOWN_KEYS): `Project.designOptionSets` (Sätze, Varianten, Hauptvariante), `designOption: {set, option}` an Wand, Öffnung, Decke, Dach, Treppe, Stütze, Körper, Raum, 2D-Element (samt Bibliotheksobjekt), Kombination `designOptions` an Ebene/Vorlage/Ausschnitt/Layout-Viewport. Sichtbarkeit im EINEN Kern-Ort `renovation::View` (Kombination neben dem Umbaufilter, `doc/ARCHITEKTUR.md` 3.9): Grundriss, Schnitt, Ansicht, Vektor-Axo, 3D-Fenster (Kombination der aktiven Ebene), Kennzahlen, Kosten, Baurecht, Raumbuch, DXF (über den Plan), IFC/Netz-Exporte (Hauptvarianten bzw. JSON-Text), PDF/Blatt (Viewport-Kombination + Titelzusatz). Kern `design_options.rs`: Übernehmen, Satz/Variante löschen, Zuweisen, In Variante kopieren (je ein Undo-Schritt), Zeichen-Variante neuer Elemente, Vergleich (Kreuzprodukt ≤ 24). Oberfläche: Panel „Varianten“ (Kombination, neue Elemente zeichnen in …, Zuweisen/Kopieren, Sätze verwalten, Übernehmen, Vergleich), Chip „Variante: …“ in der Statusleiste (öffnet das Panel, Überlauf „⋯“), Objekt-Info „Variante“, Ressourcen-Tab „Varianten“, Befehle `variante`/`variantekopieren`, Varianten-Vergleich + CSV in der Flächenbilanz, Viewport-Wahl je Satz im Blatt; Vorlage „Beispiel Varianten“ (CLI `:varianten`); CLI `--options`, `designoptions`. Tests: Kern `design_options_tests.rs` (13), Robustheit, vitest `model/designOptions.test.ts`, `commands/cmds/designOption.test.ts`, e2e `designOptions272.spec.ts` (2× grün, Port 5195); Bilder `doc/review-272/`. **Nachtrag 17.11. (benannte Kombinationen wie Archicad):** `Project.designOptionCombinations` (`{id, name, choices}`), `designOptionCombination` (Id) an Ebene/Vorlage/Ausschnitt/Layout-Viewport; Rangfolge in `design_options::stored_choice` (gültiger Verweis gilt vollständig, fehlende Sätze = Hauptvariante, übergeht die freie Wahl desselben Objekts; sonst freie Wahl; zwischen Objekten Ebene < Vorlage < Ausschnitt < Viewport < Anfrage), Sichtbarkeit weiter nur in `renovation::View`. Löschen von Variante/Satz/Übernehmen bereinigt Kombinationen (ein Undo-Schritt), `designOptionCombinationDeleteOps` löscht eine Kombination samt Verweisen. Panel „Varianten“: Bereich „Kombinationen“ (Aktuell/Eigene, „Als Kombination speichern …“, umbenennen, Wahl je Satz, Zuweisen, Löschen mit Rückfrage), Chip zeigt den Namen; Viewport-Feld „Kombination“ (Titelzusatz = Name); Vergleich je gespeicherte Kombination (Name als Zeilentitel, „Alle Kombinationen“ = Kreuzprodukt, CSV) und **Blatt-Tabelle „Variantenvergleich“** (`sheet_table.rs`, Quelle `designOptionCompare`); CLI `--combination "<Name>"`, `designoptions` (`--all`); Beispiel `:varianten` mit „Studie 1 Flachdach/Lochfenster“ und „Studie 2 Satteldach/Bandfenster“. Nebenbei behoben: `Project::set_field` (generated.rs) kannte `renovation` und `designOptionSets` nicht (typisierte Sicht blieb nach einer Op auf diese Felder alt) — jetzt samt Kombinationen, Test `set_field_kennt_alle_wurzelfelder`. Tests: Kern `design_options_tests.rs` (+8), `sheet_table.rs` (+1), vitest `model/designOptions.test.ts`, e2e `designOptions272.spec.ts` (3 Tests, 2× grün, Port 5194), Bild `doc/review-272/04-kombinationen.png`. **Offen:** Blatt-Tabelle ohne Umbau-Zustand/Kombination der Ansicht (zeigt immer die gespeicherten Kombinationen); Ausschnitt/Vorlage nur im Modell (keine Oberfläche ausser Ebene und Viewport); App-IFC-Export und Cycles-Szene nehmen die Hauptvarianten, nicht die Kombination der Ansicht; Variantensatz-Wahl in Ansichtsvorlagen/Ausschnitten nur im Modell (keine Oberfläche ausser Ebene und Viewport); nicht geprüft, ob Wandanschlüsse im Grundriss Wände anderer Varianten noch berücksichtigen (gleicher Weg wie die Regel „Ausblenden“); 3D-Bild und Tauri/Mac nicht geprüft (Prüfschritt `doc/RELEASE-1.0.md` 13.38). **Nachtrag 17.11. (Panel gestaltet):** Panel „Varianten“ jetzt Reiter der rechten oberen Dock-Gruppe neben Objekt-Info/Flächenbilanz/Umbau (Layout-Version 17; schwebend nur, wenn man es so ablegt), Gestaltung wie das Umbau-Panel (`.reno-*`: Kapitälchen-Köpfe 10 px, Zeilen 12 px, Label/Select-Raster, Aktionen als Icon-Knöpfe mit Tooltip); Namen von Kombinationen, Sätzen und Varianten inline umbenennbar (`ui/InlineName.tsx`, Doppelklick oder Stift, Enter übernimmt, Esc verwirft); Löschen von Satz/Variante jetzt mit ConfirmDialog (Ressourcen-Tab und Panel); Ressourcen-Tabs „Umbau“/„Varianten“ (`rm-*`) mit eigenen Stilen im Stil der übrigen Tabs. Keine Funktionsänderung. e2e `designOptions272.spec.ts` (+1 Test: Dock-Reiter, Inline-Umbenennen, Löschen mit Rückfrage), Bild `doc/review-272/05-panel-varianten.png`; hell und dunkel bei 1280×800 angesehen, nicht in der Tauri-App/auf dem Mac geprüft. · M–L
|
||||
- ◐ **[272]** Varianten wie Archicad „Design Options“ (17.11., Wunsch Maintainer, für 1.0). **Stand 17.11.:** Modell (Rust, gen:types, KNOWN_KEYS): `Project.designOptionSets` (Sätze, Varianten, Hauptvariante), `designOption: {set, option}` an Wand, Öffnung, Decke, Dach, Treppe, Stütze, Körper, Raum, 2D-Element (samt Bibliotheksobjekt), Kombination `designOptions` an Ebene/Vorlage/Ausschnitt/Layout-Viewport. Sichtbarkeit im EINEN Kern-Ort `renovation::View` (Kombination neben dem Umbaufilter, `doc/ARCHITEKTUR.md` 3.9): Grundriss, Schnitt, Ansicht, Vektor-Axo, 3D-Fenster (Kombination der aktiven Ebene), Kennzahlen, Kosten, Baurecht, Raumbuch, DXF (über den Plan), IFC/Netz-Exporte (Hauptvarianten bzw. JSON-Text), PDF/Blatt (Viewport-Kombination + Titelzusatz). Kern `design_options.rs`: Übernehmen, Satz/Variante löschen, Zuweisen, In Variante kopieren (je ein Undo-Schritt), Zeichen-Variante neuer Elemente, Vergleich (Kreuzprodukt ≤ 24). Oberfläche: Panel „Varianten“ (Kombination, neue Elemente zeichnen in …, Zuweisen/Kopieren, Sätze verwalten, Übernehmen, Vergleich), Chip „Variante: …“ in der Statusleiste (öffnet das Panel, Überlauf „⋯“), Objekt-Info „Variante“, Ressourcen-Tab „Varianten“, Befehle `variante`/`variantekopieren`, Varianten-Vergleich + CSV in der Flächenbilanz, Viewport-Wahl je Satz im Blatt; Vorlage „Beispiel Varianten“ (CLI `:varianten`); CLI `--options`, `designoptions`. Tests: Kern `design_options_tests.rs` (13), Robustheit, vitest `model/designOptions.test.ts`, `commands/cmds/designOption.test.ts`, e2e `designOptions272.spec.ts` (2× grün, Port 5195); Bilder `doc/review-272/`. **Nachtrag 17.11. (benannte Kombinationen wie Archicad):** `Project.designOptionCombinations` (`{id, name, choices}`), `designOptionCombination` (Id) an Ebene/Vorlage/Ausschnitt/Layout-Viewport; Rangfolge in `design_options::stored_choice` (gültiger Verweis gilt vollständig, fehlende Sätze = Hauptvariante, übergeht die freie Wahl desselben Objekts; sonst freie Wahl; zwischen Objekten Ebene < Vorlage < Ausschnitt < Viewport < Anfrage), Sichtbarkeit weiter nur in `renovation::View`. Löschen von Variante/Satz/Übernehmen bereinigt Kombinationen (ein Undo-Schritt), `designOptionCombinationDeleteOps` löscht eine Kombination samt Verweisen. Panel „Varianten“: Bereich „Kombinationen“ (Aktuell/Eigene, „Als Kombination speichern …“, umbenennen, Wahl je Satz, Zuweisen, Löschen mit Rückfrage), Chip zeigt den Namen; Viewport-Feld „Kombination“ (Titelzusatz = Name); Vergleich je gespeicherte Kombination (Name als Zeilentitel, „Alle Kombinationen“ = Kreuzprodukt, CSV) und **Blatt-Tabelle „Variantenvergleich“** (`sheet_table.rs`, Quelle `designOptionCompare`); CLI `--combination "<Name>"`, `designoptions` (`--all`); Beispiel `:varianten` mit „Studie 1 Flachdach/Lochfenster“ und „Studie 2 Satteldach/Bandfenster“. Nebenbei behoben: `Project::set_field` (generated.rs) kannte `renovation` und `designOptionSets` nicht (typisierte Sicht blieb nach einer Op auf diese Felder alt) — jetzt samt Kombinationen, Test `set_field_kennt_alle_wurzelfelder`. Tests: Kern `design_options_tests.rs` (+8), `sheet_table.rs` (+1), vitest `model/designOptions.test.ts`, e2e `designOptions272.spec.ts` (3 Tests, 2× grün, Port 5194), Bild `doc/review-272/04-kombinationen.png`. **Offen:** Blatt-Tabelle ohne Umbau-Zustand/Kombination der Ansicht (zeigt immer die gespeicherten Kombinationen); Ausschnitt/Vorlage nur im Modell (keine Oberfläche ausser Ebene und Viewport); App-IFC-Export und Cycles-Szene nehmen die Hauptvarianten, nicht die Kombination der Ansicht; Variantensatz-Wahl in Ansichtsvorlagen/Ausschnitten nur im Modell (keine Oberfläche ausser Ebene und Viewport); nicht geprüft, ob Wandanschlüsse im Grundriss Wände anderer Varianten noch berücksichtigen (gleicher Weg wie die Regel „Ausblenden“); 3D-Bild und Tauri/Mac nicht geprüft (Prüfschritt `doc/RELEASE-1.0.md` 13.38). **Nachtrag 17.11. (Panel gestaltet):** Panel „Varianten“ jetzt Reiter der rechten oberen Dock-Gruppe neben Objekt-Info/Flächenbilanz/Umbau (Layout-Version 17; schwebend nur, wenn man es so ablegt), Gestaltung wie das Umbau-Panel (`.reno-*`: Kapitälchen-Köpfe 10 px, Zeilen 12 px, Label/Select-Raster, Aktionen als Icon-Knöpfe mit Tooltip); Namen von Kombinationen, Sätzen und Varianten inline umbenennbar (`ui/InlineName.tsx`, Doppelklick oder Stift, Enter übernimmt, Esc verwirft); Löschen von Satz/Variante jetzt mit ConfirmDialog (Ressourcen-Tab und Panel); Ressourcen-Tabs „Umbau“/„Varianten“ (`rm-*`) mit eigenen Stilen im Stil der übrigen Tabs. Keine Funktionsänderung. e2e `designOptions272.spec.ts` (+1 Test: Dock-Reiter, Inline-Umbenennen, Löschen mit Rückfrage), Bild `doc/review-272/05-panel-varianten.png`; hell und dunkel bei 1280×800 angesehen, nicht in der Tauri-App/auf dem Mac geprüft. **Nachtrag 17.11. (bedienen wie Archicads Design-Options-Manager):**Line truncated
|
||||
### Phase 4 (4.–12.12.): Härten und veröffentlichen
|
||||
- Nur noch Fehler aus dem Referenz-Ablauf; Leistung mit grossen Kontext-Importen; keine neuen Funktionen.
|
||||
- Release 1.0.0: Tag, signierte Pakete, Release-Notes (ehrlich: was nicht geht), Download-Seite.
|
||||
|
||||
@@ -504,6 +504,16 @@ löscht eine Kombination samt Verweisen — je ein Undo-Schritt. Vergleich `desi
|
||||
Kreuzprodukt; `compare_scope(.., all)`), Blatt-Tabelle `sheet_table.rs` Quelle `designOptionCompare`; TS: `model/designOptions.ts`
|
||||
(`storedChoice`, `assignCombinationOps` …), Panel `DesignOptionsPanel.tsx`; CLI `--combination`.
|
||||
|
||||
**Bearbeiten wie im Archicad-Manager** (Nachtrag): Auge und Stift je Variante im Panel. Auge = Wahl der Ebene (Op, Undo). Stift =
|
||||
`drawDesignOption` (Sitzung, kein Undo-Schritt; neue Elemente über `stamp_ops`). Die Bildschirm-Ansichten (Grundriss
|
||||
`generateVisibleLevelsPlan`, Schnitt/Ansicht `opts.designOptionEdit`, 3D `Filter3d.designOptionEdit`; Hook `state/designOptionEdit.ts`)
|
||||
schicken `designOptionEdit: {set, option, grey}` mit — Druck, PDF, Exporte, Kennzahlen und Goldens nie. Im Kern liest
|
||||
`design_options::parse_edit` es, `renovation::View::editing` erzwingt die Variante in der Kombination (Stift impliziert Auge) und legt mit
|
||||
`grey` alles ausserhalb (`Edit::outside`, Öffnung folgt ihrer Wand) als `ghost_style()` in `Resolved.styled` — also derselbe Weg wie die
|
||||
Umbau-Farben (Plan `restyle_range`, Schnitt `CutRules::with_renovation`, Ansicht `renovation_faces`, Axo, 3D `color_parts` über
|
||||
`screen_view_from_text`). „Sperren“ ist Auswahl-Logik der Oberfläche: `selectionSlice.setSelection` filtert über
|
||||
`model/designOptions.ts::unlockedSelection` (ein Ort für Klick, Rechteck, 3D-Pick, Alles wählen; Griffe/Objekt-Info/Befehle sehen nur die Auswahl).
|
||||
|
||||
---
|
||||
|
||||
## 4. Schnitt
|
||||
|
||||
+12
-3
@@ -382,9 +382,18 @@ Design Options in Archicad). Ein Variantensatz (z. B. Dachform) hat Varianten (A
|
||||
Flachdach/Satteldach und Fassade: Lochfenster/Bandfenster).
|
||||
|
||||
- **Panel:** ein Klick auf den Knopf Variante rechts in der Statusleiste (nur mit Variantensätzen; bei wenig Platz unter ⋯)
|
||||
öffnet das Panel „Varianten“. Dort: „Kombination dieser Ansicht“ (je Satz eine Variante, Vorgabe die „Hauptvariante“), „Neue
|
||||
Elemente zeichnen in“ (neue Bauteile und 2D-Elemente gehören dieser Variante), die Auswahl einer Variante „Zuweisen“ oder
|
||||
„Kopieren in“ eine Variante, die Sätze verwalten („Satz hinzufügen“, umbenennen, löschen) und „Übernehmen“.
|
||||
öffnet das Panel „Varianten“. Dort: unter „Variantensätze“ je Variante ein Auge und ein Stift (s. unten), die Auswahl einer
|
||||
Variante „Zuweisen“ oder „Kopieren in“ eine Variante, die Sätze verwalten („Satz hinzufügen“, umbenennen, löschen) und
|
||||
„Übernehmen“.
|
||||
- **Auge und Stift (wie Archicads Design-Options-Manager):** Das Auge schaltet, welche Variante die aktive Ansicht zeigt (je Satz
|
||||
genau eine, Vorgabe die „Hauptvariante“). Der Stift macht eine Variante zur Bearbeitungsvariante: neue Bauteile und
|
||||
2D-Elemente landen in ihr, die Ansicht zeigt sie (Stift heisst immer auch Auge), und die Statusleiste meldet deutlich
|
||||
Bearbeite: Dachform B. Der Stift beim „Hauptmodell“ (Abschnitt „Bearbeiten“) oder ein zweiter Klick auf den Stift der
|
||||
Variante beendet die Bearbeitung. Zwei Häkchen wirken beim Bearbeiten: „Elemente ausserhalb der Variante grau einfärben“
|
||||
(Hauptmodell und andere Varianten hellgrau in Grundriss, Schnitt, Ansicht, Axonometrie und 3D — nur auf dem Bildschirm, Druck,
|
||||
PDF und Exporte bleiben unverändert) und „Elemente ausserhalb der Variante sperren“ (sie lassen sich nicht wählen, also auch
|
||||
nicht verschieben, löschen oder in der Objekt-Info ändern). Stift und Häkchen gehören zur Sitzung, nicht zum Projekt, und sind
|
||||
kein Undo-Schritt; das Auge ändert die Ebene und lässt sich rückgängig machen.
|
||||
- **Kombination:** gehört zur Ebene wie der Umbaufilter, also je Reiter (Geschoss, Schnitt, Ansicht) eigen und mit Undo; der
|
||||
Grundriss, der Schnitt, die Ansicht, die Axonometrie und das 3D zeigen nur die gewählten Varianten. Ausschnitte merken die
|
||||
Kombination; ein Viewport auf dem Blatt kann dieselbe Ansicht in einer anderen Kombination zeigen (je Satz eine Wahl im
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 157 KiB After Width: | Height: | Size: 126 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 135 KiB |
@@ -2,7 +2,7 @@
|
||||
// Variante zuweisen (Undo), Kombination der Ansicht umschalten (Grundriss zeigt das Bandfenster statt des Lochfensters),
|
||||
// Vergleichstabelle, Variante übernehmen und Undo. Geprüft über die UI und den Plan (Test-Nähte), nicht über Pixel.
|
||||
import type { Page } from "@playwright/test";
|
||||
import { blurFocus, discardIfAsked, expect, fileMenu, openTab, test } from "./app";
|
||||
import { blurFocus, commandInput, discardIfAsked, expect, fileMenu, finishCommand, openTab, test, typeCommand } from "./app";
|
||||
|
||||
test("Varianten: Satz, Zuweisen, Kombination, Vergleich, Übernehmen, Undo ([272])", async ({ page }) => {
|
||||
await page.goto("/?dossierTest");
|
||||
@@ -39,8 +39,10 @@ test("Varianten: Satz, Zuweisen, Kombination, Vergleich, Übernehmen, Undo ([272
|
||||
await page.keyboard.press("ControlOrMeta+z");
|
||||
await expect.poll(async () => (await dopt()).elements.W1).toBe("");
|
||||
|
||||
// Kombination der Ansicht: Fassade B → Bandfenster statt Lochfenster; der Chip nennt die Abweichung.
|
||||
await panel.getByTestId("design-option-combo-fassade").selectOption("b");
|
||||
// Kombination der Ansicht über das Auge: Fassade B → Bandfenster statt Lochfenster; der Chip nennt die Abweichung.
|
||||
await panel.getByTestId("design-option-eye-fassade-b").click();
|
||||
await expect(panel.getByTestId("design-option-eye-fassade-b")).toHaveAttribute("aria-pressed", "true");
|
||||
await expect(panel.getByTestId("design-option-eye-fassade-a")).toHaveAttribute("aria-pressed", "false");
|
||||
await expect.poll(async () => (await dopt()).level).toEqual({ fassade: "b" });
|
||||
await expect.poll(openings).toContain("O-band");
|
||||
expect(await openings()).not.toContain("O2");
|
||||
@@ -86,7 +88,7 @@ test("Variantenkombinationen: speichern, zuweisen, umschalten, Vergleich, Lösch
|
||||
await expect(panel.getByTestId("design-option-current-name")).toHaveText("Studie 1 Flachdach/Lochfenster");
|
||||
|
||||
// Eine Wahl, die zu keiner Kombination passt, heisst „Eigene“ und wird unter neuem Namen gespeichert.
|
||||
await panel.getByTestId("design-option-combo-dachform").selectOption("b");
|
||||
await panel.getByTestId("design-option-eye-dachform-b").click();
|
||||
await expect(panel.getByTestId("design-option-current-name")).toHaveText("Eigene");
|
||||
await expect(chip).toContainText("Eigene");
|
||||
await panel.getByTestId("design-option-combo-save").click();
|
||||
@@ -206,3 +208,81 @@ test("Panel Varianten im Dock: Reiter, Namen inline umbenennen, Löschen mit Rü
|
||||
await page.getByTestId("confirm-dialog-ok").click();
|
||||
await expect.poll(async () => (await dopt()).sets).toEqual(["fassade"]);
|
||||
});
|
||||
|
||||
test("Varianten bearbeiten wie Archicad: Stift, Zeichnen in die Variante, grau, sperren, zurück, Undo ([272])", async ({ page }) => {
|
||||
await page.setViewportSize({ width: 1280, height: 800 });
|
||||
await page.goto("/?dossierTest");
|
||||
await page.getByRole("button", { name: /Neues Projekt/ }).first().click();
|
||||
await expect(page.getByRole("group", { name: "Befehlszeile" })).toBeVisible();
|
||||
await fileMenu(page, /^Neu aus Vorlage: Beispiel Varianten$/);
|
||||
await discardIfAsked(page);
|
||||
const dopt = () => page.evaluate(() => window.__dossierTest!.designOptions());
|
||||
const plan = () => page.evaluate(() => window.__dossierTest!.designOptionPlan());
|
||||
const chip = page.getByTestId("design-option-toggle");
|
||||
await chip.click();
|
||||
const panel = page.getByTestId("design-options-panel");
|
||||
await expect(panel).toBeVisible();
|
||||
// Ohne Stift: Hauptmodell wird bearbeitet, nichts grau.
|
||||
await expect(panel.getByTestId("design-option-pen-main")).toHaveAttribute("aria-pressed", "true");
|
||||
expect((await plan()).grey).toEqual([]);
|
||||
|
||||
// Stift auf „Dachform B“: Bearbeitungsmodus, Chip deutlich, Auge folgt (Stift impliziert Auge), Ebene unverändert.
|
||||
await panel.getByTestId("design-option-pen-dachform-b").click();
|
||||
await expect.poll(async () => (await dopt()).draw).toBe("dachform/b");
|
||||
await expect(chip).toContainText("Bearbeite: Dachform B");
|
||||
await expect(panel.getByTestId("design-option-eye-dachform-b")).toHaveAttribute("aria-pressed", "true");
|
||||
await expect(panel.getByTestId("design-option-pen-dachform-b")).toHaveAttribute("aria-pressed", "true");
|
||||
expect((await dopt()).level).toEqual({});
|
||||
|
||||
// Wand zeichnen: sie landet in Variante B.
|
||||
const before = (await dopt()).elements;
|
||||
await page.getByRole("button", { name: "Wand", exact: true }).click();
|
||||
await expect(page.locator(".cmdline-prompt")).toHaveText("Startpunkt der Wand:");
|
||||
await commandInput(page).focus();
|
||||
await typeCommand(page, "0,5");
|
||||
await typeCommand(page, "4.5,5");
|
||||
await finishCommand(page);
|
||||
let added = "";
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const el = (await dopt()).elements;
|
||||
added = Object.keys(el).find((id) => !(id in before)) ?? "";
|
||||
return added ? el[added] : "";
|
||||
})
|
||||
.toBe("dachform/b");
|
||||
|
||||
// Häkchen „grau“ (Vorgabe an): Hauptmodell grau, die neue Wand nicht — nur Bildschirm, nie im Druck.
|
||||
await expect(panel.getByTestId("design-option-grey")).toBeChecked();
|
||||
await expect.poll(async () => (await plan()).grey.length).toBeGreaterThan(0);
|
||||
expect((await plan()).grey).not.toContain(added);
|
||||
expect((await plan()).grey).toContain("W1");
|
||||
expect((await plan()).printGrey).toBe(0);
|
||||
const shots = process.env.DOSSIER_SHOTS;
|
||||
await page.screenshot({ path: shots ? `${shots}/06-auge-stift-grau.png` : "test-results/designOptions272-auge-stift-grau.png" });
|
||||
// Häkchen aus: nichts grau.
|
||||
await panel.getByTestId("design-option-grey").uncheck();
|
||||
await expect.poll(async () => (await plan()).grey).toEqual([]);
|
||||
await panel.getByTestId("design-option-grey").check();
|
||||
|
||||
// Häkchen „sperren“: Hauptmodell-Wand nicht wählbar, die eigene schon.
|
||||
await panel.getByTestId("design-option-lock").check();
|
||||
await page.evaluate(() => window.__dossierTest!.select({ walls: ["W1"] }));
|
||||
expect(JSON.parse((await page.evaluate(() => window.__dossierTest!.selected())).all).walls).toEqual([]);
|
||||
await page.evaluate((id) => window.__dossierTest!.select({ walls: [id] }), added);
|
||||
expect(JSON.parse((await page.evaluate(() => window.__dossierTest!.selected())).all).walls).toEqual([added]);
|
||||
// Ohne Sperre wieder wählbar.
|
||||
await panel.getByTestId("design-option-lock").uncheck();
|
||||
await page.evaluate(() => window.__dossierTest!.select({ walls: ["W1"] }));
|
||||
expect(JSON.parse((await page.evaluate(() => window.__dossierTest!.selected())).all).walls).toEqual(["W1"]);
|
||||
|
||||
// Stift zurück aufs Hauptmodell: kein Grau, Chip wieder „Variante: …“, die B-Wand ist in der Ansicht (A) weg.
|
||||
await panel.getByTestId("design-option-pen-main").click();
|
||||
await expect.poll(async () => (await dopt()).draw).toBe(null);
|
||||
await expect(chip).not.toContainText("Bearbeite");
|
||||
await expect.poll(async () => (await plan()).walls).not.toContain(added);
|
||||
expect((await plan()).grey).toEqual([]);
|
||||
// Undo nimmt die Wand zurück (der Stift war kein Undo-Schritt).
|
||||
await blurFocus(page);
|
||||
await page.keyboard.press("ControlOrMeta+z");
|
||||
await expect.poll(async () => added in (await dopt()).elements).toBe(false);
|
||||
});
|
||||
@@ -216,6 +216,68 @@ impl Combination {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Bearbeiten wie im Archicad-Manager ([272] Nachtrag 17.11.: Stift und „grau einfärben“) ───────────────────────
|
||||
|
||||
/// Bearbeitungsvariante einer **Bildschirm**-Darstellung (Stift im Panel „Varianten“, Zustand der Sitzung): die Variante
|
||||
/// ist sichtbar (Stift impliziert Auge, geht der Kombination der Ebene vor), mit `grey` zeichnet die Darstellung alles
|
||||
/// ausserhalb von ihr (Hauptmodell und andere sichtbare Varianten) grau ([`crate::renovation::ghost_style`]). Kommt nur über
|
||||
/// das Anfrage-Feld `designOptionEdit` der Bildschirm-Ansichten (Grundriss, Schnitt, Ansicht, Axo, 3D) — Druck, PDF,
|
||||
/// Exporte, Kennzahlen und Goldens fragen nie damit. Die Sperre („Elemente ausserhalb sperren“) ist reine Auswahl-Logik
|
||||
/// der Oberfläche (`model/designOptions.ts::designOptionLocked`).
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Edit {
|
||||
pub set: String,
|
||||
pub option: String,
|
||||
pub grey: bool,
|
||||
}
|
||||
|
||||
/// Liest `{"set", "option", "grey"}` (Ids oder Namen); unbekannter Satz/Variante oder Unsinn ⇒ `None`.
|
||||
pub fn parse_edit(p: &Project, v: Option<&Value>) -> Option<Edit> {
|
||||
let v = v?.as_object()?;
|
||||
let s = find_set(p, v.get("set")?.as_str()?)?;
|
||||
let o = find_option(s, v.get("option")?.as_str()?)?;
|
||||
Some(Edit { set: s.id.clone(), option: o.id.clone(), grey: v.get("grey").and_then(Value::as_bool).unwrap_or(false) })
|
||||
}
|
||||
|
||||
impl Edit {
|
||||
/// Gehört ein Element mit dieser Zugehörigkeit zur Bearbeitungsvariante?
|
||||
pub fn holds(&self, r: Option<&DesignOptionRef>) -> bool {
|
||||
r.is_some_and(|r| r.set == self.set && r.option == self.option)
|
||||
}
|
||||
|
||||
/// Ids aller Elemente ausserhalb der Bearbeitungsvariante (Öffnung ohne eigene Variante folgt ihrer Wand).
|
||||
pub fn outside(&self, p: &Project) -> HashSet<String> {
|
||||
let mut out = HashSet::new();
|
||||
for w in &p.walls {
|
||||
if !self.holds(w.design_option.as_ref()) {
|
||||
out.insert(w.id.clone());
|
||||
}
|
||||
}
|
||||
for o in p.openings.iter().flatten() {
|
||||
let r = o.design_option.as_ref().or_else(|| p.walls.iter().find(|w| w.id == o.host_wall_id).and_then(|w| w.design_option.as_ref()));
|
||||
if !self.holds(r) {
|
||||
out.insert(o.id.clone());
|
||||
}
|
||||
}
|
||||
macro_rules! each {
|
||||
($($f:ident),*) => {$(
|
||||
for x in p.$f.iter().flatten() {
|
||||
if !self.holds(x.design_option.as_ref()) {
|
||||
out.insert(x.id.clone());
|
||||
}
|
||||
}
|
||||
)*};
|
||||
}
|
||||
each!(ceilings, roofs, stairs, columns, extruded_solids, rooms);
|
||||
out
|
||||
}
|
||||
|
||||
/// Schlüssel für Caches.
|
||||
pub fn key(&self) -> String {
|
||||
format!("{}={}{}", self.set, self.option, if self.grey { ":grey" } else { "" })
|
||||
}
|
||||
}
|
||||
|
||||
/// Gespeicherte Wahl einer Ebene ([`stored_choice`]; über die verknüpfte Vorlage hat sie schon `level_with_template`).
|
||||
pub fn level_choice(p: &Project, level_id: &str) -> Option<BTreeMap<String, String>> {
|
||||
p.floor(level_id).and_then(|l| stored_choice(p, l.design_option_combination.as_deref(), l.design_options.as_ref()))
|
||||
|
||||
@@ -661,3 +661,102 @@ fn set_field_kennt_alle_wurzelfelder() {
|
||||
d.undo().unwrap();
|
||||
assert_eq!(d.project().unwrap().design_option_combinations.as_ref().unwrap()[0].id, "k1");
|
||||
}
|
||||
|
||||
// ── Bearbeiten wie im Archicad-Manager: Stift, grau einfärben ([272] Nachtrag 17.11.) ───────────────────────────────
|
||||
|
||||
/// Bearbeitungsvariante der Bildschirm-Anfrage (`designOptionEdit`).
|
||||
fn edit(option: &str, grey: bool) -> Value {
|
||||
json!({"designOptionEdit": {"set": "dach", "option": option, "grey": grey}})
|
||||
}
|
||||
|
||||
/// Füllungen der Wand-Polygone von `id`.
|
||||
fn wall_fills(prims: &[Primitive], id: &str) -> Vec<String> {
|
||||
prims
|
||||
.iter()
|
||||
.filter_map(|q| match q {
|
||||
Primitive::Polygon { wall_id: Some(w), opening_id: None, fill, .. } if w == id && fill != "none" => Some(fill.clone()),
|
||||
_ => None,
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bearbeiten_zeigt_die_variante_und_graut_den_rest_nur_auf_anfrage() {
|
||||
let p = project(&fixture());
|
||||
let ghost = crate::renovation::ghost_style();
|
||||
// Ohne Bearbeitung: nichts grau (Druck, PDF, Exporte, Goldens fragen nie mit `designOptionEdit`).
|
||||
let plain = plan_with(&p, json!({}));
|
||||
assert!(wall_fills(&plain, "W1").iter().all(|f| *f != ghost.fill));
|
||||
// Stift auf B: B ist sichtbar (Stift impliziert Auge), obwohl die Ebene A zeigt; A ist weg.
|
||||
let b = plan_with(&p, edit("b", true));
|
||||
assert!(has_wall(&b, "W9") && !has_wall(&b, "W2") && has_opening(&b, "O2"));
|
||||
// Hauptmodell grau (Füllung), die bearbeitete Variante nicht.
|
||||
assert!(!wall_fills(&b, "W1").is_empty() && wall_fills(&b, "W1").iter().all(|f| *f == ghost.fill), "{:?}", wall_fills(&b, "W1"));
|
||||
assert!(wall_fills(&b, "W9").iter().all(|f| *f != ghost.fill));
|
||||
// Häkchen „grau“ aus: sichtbar wie oben, aber keine graue Fläche.
|
||||
let nb = plan_with(&p, edit("b", false));
|
||||
assert!(has_wall(&nb, "W9") && !has_wall(&nb, "W2"));
|
||||
assert!(wall_fills(&nb, "W1").iter().all(|f| *f != ghost.fill));
|
||||
// Stift auf A (= Hauptvariante): B bleibt aus, Hauptmodell grau, W2 (in A) nicht.
|
||||
let a = plan_with(&p, edit("a", true));
|
||||
assert!(has_wall(&a, "W2") && !has_wall(&a, "W9"));
|
||||
assert!(wall_fills(&a, "W1").iter().all(|f| *f == ghost.fill) && wall_fills(&a, "W2").iter().all(|f| *f != ghost.fill));
|
||||
// Unbekannte Variante oder Unsinn: wie ohne Bearbeitung.
|
||||
for bad in [json!({"set": "dach", "option": "zz", "grey": true}), json!({"set": 1}), json!("dach"), json!(null), json!({"option": "b"})] {
|
||||
let q = plan_with(&p, json!({"designOptionEdit": bad}));
|
||||
assert_eq!(format!("{q:?}"), format!("{plain:?}"), "{bad}");
|
||||
}
|
||||
// Cache-Schlüssel unterscheidet die Bearbeitung.
|
||||
let k = |e: Option<Edit>| crate::renovation::View::editing(crate::renovation::View::new(&p, None, None), &p, e).map(|v| v.key());
|
||||
let e = |grey| Some(Edit { set: "dach".into(), option: "b".into(), grey });
|
||||
assert_ne!(k(None), k(e(true)));
|
||||
assert_ne!(k(e(false)), k(e(true)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bearbeiten_grau_in_schnitt_ansicht_axo_und_3d() {
|
||||
let p = project(&fixture());
|
||||
let ghost = crate::renovation::ghost_style();
|
||||
let grey_fill = |prims: &[Primitive]| prims.iter().any(|q| matches!(q, Primitive::Polygon { fill, .. } if *fill == ghost.fill));
|
||||
// Schnitt: das Dach RF1 (B) erscheint, Hauptmodell grau; ohne Anfrage nichts grau.
|
||||
let s = section_prims(&p, edit("b", true));
|
||||
assert!(ids_in(&s).contains("RF1") && grey_fill(&s));
|
||||
assert!(!grey_fill(§ion_prims(&p, json!({}))));
|
||||
assert!(!grey_fill(§ion_prims(&p, edit("b", false))));
|
||||
// Ansicht.
|
||||
assert!(grey_fill(&elevation_prims(&p, edit("b", true))), "Ansicht ohne Grau");
|
||||
assert!(!grey_fill(&elevation_prims(&p, json!({}))));
|
||||
assert_eq!(format!("{:?}", elevation_prims(&p, edit("b", false))), format!("{:?}", elevation_prims(&p, json!({"designOptions": "Dachform=B"}))));
|
||||
// Axo.
|
||||
let axo = |t: Value| crate::queries::run_bin(&p, "axoPlan", &[0.0, 100.0], &t.to_string()).unwrap();
|
||||
assert_ne!(axo(edit("b", true)), axo(edit("b", false)));
|
||||
assert_eq!(axo(edit("b", false)), axo(json!({"designOptions": "Dachform=B"})));
|
||||
// 3D: Hauptmodell-Wand W1 in der Graufarbe, W9 (B) nicht, W2 (A) fehlt.
|
||||
let parts = |t: Value| -> Value { serde_json::from_str(&crate::queries::run(&p, "model3dParts", &[1.0, 1.0, 0.0], &t.to_string()).unwrap()).unwrap() };
|
||||
let rgb = crate::style::hex_to_rgb(&ghost.fill, [0.0; 3]).to_vec();
|
||||
let wall = |v: &Value, id: &str| v["walls"].as_array().unwrap().iter().find(|w| w["wallId"] == id).cloned();
|
||||
let col = |w: Value| w["color"].as_array().unwrap().iter().map(|x| x.as_f64().unwrap()).collect::<Vec<_>>();
|
||||
let g = parts(edit("b", true));
|
||||
assert_eq!(col(wall(&g, "W1").unwrap()), rgb);
|
||||
assert_ne!(col(wall(&g, "W9").unwrap()), rgb);
|
||||
assert!(wall(&g, "W2").is_none());
|
||||
assert_ne!(col(wall(&parts(json!({})), "W1").unwrap()), rgb);
|
||||
// Kennzahlen kennen keine Bearbeitung (gleich wie die Hauptkombination).
|
||||
assert_eq!(crate::queries::run(&p, "kennzahlen", &[], &edit("b", true).to_string()).unwrap(), crate::queries::run(&p, "kennzahlen", &[], "").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bearbeiten_auch_ohne_elemente_in_varianten() {
|
||||
// Sätze ohne Elemente (gerade angelegt): Stift auf B graut alles, was es gibt.
|
||||
let mut v = crate::renovation::tests::umbau_fixture();
|
||||
v["designOptionSets"] = json!([{"id": "dach", "name": "Dachform", "options": [{"id": "a", "name": "A"}, {"id": "b", "name": "B"}], "primary": "a"}]);
|
||||
let p = project(&v);
|
||||
assert!(!active(&p));
|
||||
let ghost = crate::renovation::ghost_style();
|
||||
let b = plan_with(&p, edit("b", true));
|
||||
assert!(!wall_fills(&b, "W1").is_empty() && wall_fills(&b, "W1").iter().all(|f| *f == ghost.fill));
|
||||
// Mit Umbaufilter: Grau geht der Umbau-Farbe vor (ausserhalb der Variante), Ausgeblendetes bleibt weg.
|
||||
let r = plan_with(&p, json!({"renovation": "neubau", "designOptionEdit": {"set": "dach", "option": "b", "grey": true}}));
|
||||
assert!(!has_wall(&r, "W2"));
|
||||
assert!(wall_fills(&r, "W9").iter().all(|f| *f == ghost.fill));
|
||||
}
|
||||
@@ -712,7 +712,9 @@ pub fn axo_plan_buf(p: &Project, args: &[f64], text: &str) -> Result<Vec<u8>, St
|
||||
// [271] Umbaufilter (`renovation`, `renovationPhase`): Ausgeblendetes fehlt, Flächen in der Umbau-Farbe.
|
||||
// [272] Variantenkombination (`designOptions`, sonst die Hauptvarianten): andere Varianten fehlen.
|
||||
let opts = crate::design_options::parse_request(v.get("designOptions"));
|
||||
let ren = crate::renovation::View::with(p, v.get("renovation").and_then(|x| x.as_str()), v.get("renovationPhase").and_then(|x| x.as_str()), &[], &opts).map(|r| r.resolve(p));
|
||||
let ren = crate::renovation::View::with(p, v.get("renovation").and_then(|x| x.as_str()), v.get("renovationPhase").and_then(|x| x.as_str()), &[], &opts);
|
||||
// [272] Bearbeitungsvariante der Bildschirm-Ansicht (`designOptionEdit`).
|
||||
let ren = crate::renovation::View::editing(ren, p, crate::design_options::parse_edit(p, v.get("designOptionEdit"))).map(|r| r.resolve(p));
|
||||
let filtered = ren.as_ref().filter(|r| !r.hidden.is_empty()).map(|r| crate::renovation::without_hidden(p, &r.hidden));
|
||||
let p = filtered.as_ref().unwrap_or(p);
|
||||
let Some(a) = AxoArgs::parse(p, &v) else { return Ok(w.finish()) };
|
||||
|
||||
@@ -150,6 +150,7 @@ pub fn ctx_key(a: &PlanArgs) -> String {
|
||||
+ &a.trace_of.as_deref().map_or(String::new(), |t| format!("\u{1}trace:{t}"))
|
||||
+ &a.renovation.as_deref().map_or(String::new(), |t| format!("\u{1}ren:{t}:{}", a.renovation_phase.as_deref().unwrap_or("")))
|
||||
+ &a.design_options.iter().map(|(k, v)| format!("\u{1}opt:{k}={v}")).collect::<String>()
|
||||
+ &a.design_option_edit.as_ref().map_or(String::new(), |e| format!("\u{1}edit:{e}"))
|
||||
}
|
||||
|
||||
/// Sichtbarkeit und Dimmen als vergleichbarer Text (Mengen sortiert).
|
||||
|
||||
@@ -58,6 +58,7 @@ fn floor_args(a: &PlanArgs, floor: &str) -> PlanArgs {
|
||||
renovation: a.renovation.clone(),
|
||||
renovation_phase: a.renovation_phase.clone(),
|
||||
design_options: a.design_options.clone(),
|
||||
design_option_edit: a.design_option_edit.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,6 +71,9 @@ pub struct PlanArgs {
|
||||
/// [272] Ausdrücklich angefragte Variantenkombination (Blatt-Viewport, CLI `--options`), über der der Ebene
|
||||
/// (`DrawingLevel.designOptions`) und den Hauptvarianten (`design_options.rs`).
|
||||
pub design_options: crate::design_options::Request,
|
||||
/// [272] Bearbeitungsvariante der Bildschirm-Ansicht (`designOptionEdit`: `{set, option, grey}`, nur Bildschirm;
|
||||
/// aufgelöst in [`Ctx::new`] über `design_options::parse_edit`).
|
||||
pub design_option_edit: Option<serde_json::Value>,
|
||||
}
|
||||
|
||||
/// [140] Ab diesem Massstab (1:N) zeichnet der Detailgrad „mittel" wie „grob".
|
||||
@@ -120,6 +123,7 @@ impl PlanArgs {
|
||||
renovation: v.get("renovation").and_then(|m| m.as_str()).filter(|m| !m.is_empty()).map(String::from),
|
||||
renovation_phase: v.get("renovationPhase").and_then(|m| m.as_str()).filter(|m| !m.is_empty()).map(String::from),
|
||||
design_options: crate::design_options::parse_request(v.get("designOptions")),
|
||||
design_option_edit: v.get("designOptionEdit").filter(|e| e.is_object()).cloned(),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -178,7 +182,10 @@ impl<'a> Ctx<'a> {
|
||||
}
|
||||
let mut hidden = overrides::hidden_elements(p, overrides::RuleView::at(a.scale, a.rules.as_ref()).view("plan"));
|
||||
// [271] Umbaufilter: ausgeblendete Bauteile wie bei der Regel „Ausblenden“ (eine Öffnung schliesst ihre Wand).
|
||||
let ren = crate::renovation::View::for_level(p, &a.floor, a.renovation.as_deref(), a.renovation_phase.as_deref(), &a.design_options).map(|v| v.resolve(p)).filter(|r| !r.is_empty());
|
||||
let view = crate::renovation::View::for_level(p, &a.floor, a.renovation.as_deref(), a.renovation_phase.as_deref(), &a.design_options);
|
||||
// [272] Bearbeitungsvariante (Stift, nur Bildschirm): sichtbar, mit „grau“ alles ausserhalb grau.
|
||||
let view = crate::renovation::View::editing(view, p, crate::design_options::parse_edit(p, a.design_option_edit.as_ref()));
|
||||
let ren = view.map(|v| v.resolve(p)).filter(|r| !r.is_empty());
|
||||
if let Some(r) = &ren {
|
||||
hidden.extend(r.hidden.iter().cloned());
|
||||
}
|
||||
@@ -1672,7 +1679,7 @@ pub fn room_stamp_spots(p: &Project, floor: &str, show: &HashSet<String>, scale:
|
||||
return out;
|
||||
}
|
||||
let (detail, auto_coarse) = effective_detail(Detail::Mittel, scale);
|
||||
let a = PlanArgs { floor: floor.to_string(), detail, show: show.clone(), grey: HashSet::new(), reference_lines: false, global: true, scale, for_print: false, compact: false, mono: false, sun_when: None, auto_coarse, rules: None, model_view: None, trace_of: None, renovation: None, renovation_phase: None, design_options: Vec::new() };
|
||||
let a = PlanArgs { floor: floor.to_string(), detail, show: show.clone(), grey: HashSet::new(), reference_lines: false, global: true, scale, for_print: false, compact: false, mono: false, sun_when: None, auto_coarse, rules: None, model_view: None, trace_of: None, renovation: None, renovation_phase: None, design_options: Vec::new(), design_option_edit: None };
|
||||
let Ok(d) = plan_domains(p, &a) else { return out };
|
||||
for q in d.rooms.iter().chain(&d.sections) {
|
||||
if let Primitive::Text { at, room_id: Some(id), .. } = q {
|
||||
|
||||
@@ -1784,6 +1784,7 @@ fn sheets(cx: &mut Ctx, main: &mut Buf, layer_by_code: &HashMap<&str, String>) {
|
||||
renovation: None,
|
||||
renovation_phase: None,
|
||||
design_options: Vec::new(),
|
||||
design_option_edit: None,
|
||||
};
|
||||
if let Some(entries) = plan_domains_buf(p, &args).ok().and_then(|buf| {
|
||||
let view = View::parse(&buf)?;
|
||||
|
||||
@@ -50,7 +50,9 @@ pub fn renovation_view(p: &Project, v: &serde_json::Value, level: &LevelSpec) ->
|
||||
None => (level.renovation.as_deref(), level.renovation_phase.as_deref()),
|
||||
};
|
||||
let own = crate::design_options::stored_choice(p, level.design_option_combination.as_deref(), level.design_options.as_ref());
|
||||
crate::renovation::View::with(p, f, ph, &own.iter().collect::<Vec<_>>(), &crate::design_options::parse_request(v.get("designOptions")))
|
||||
let view = crate::renovation::View::with(p, f, ph, &own.iter().collect::<Vec<_>>(), &crate::design_options::parse_request(v.get("designOptions")));
|
||||
// [272] Bearbeitungsvariante der Bildschirm-Ansicht (`designOptionEdit`, nie im Druck).
|
||||
crate::renovation::View::editing(view, p, crate::design_options::parse_edit(p, v.get("designOptionEdit")))
|
||||
}
|
||||
|
||||
/// Abfrage `sectionPlan`: `args` = `[mono, openings, key]` (`key` > 0
|
||||
|
||||
@@ -190,7 +190,8 @@ pub fn run(p: &Project, name: &str, args: &[f64], text: &str) -> Result<String,
|
||||
return Ok(v.to_string());
|
||||
}
|
||||
// [271] Umbaufilter (`text` = `{"renovation": …, "renovationPhase": …}`): Ausgeblendetes fehlt, Farben je Status.
|
||||
let ren = crate::renovation::view_from_text(p, text).map(|v| v.resolve(p));
|
||||
// [272] Dazu die Bearbeitungsvariante des 3D-Fensters (`designOptionEdit`, grau ausserhalb).
|
||||
let ren = crate::renovation::screen_view_from_text(p, text).map(|v| v.resolve(p));
|
||||
let filtered = ren.as_ref().filter(|r| !r.hidden.is_empty()).map(|r| crate::renovation::without_hidden(p, &r.hidden));
|
||||
let p = filtered.as_ref().unwrap_or(p);
|
||||
let (detail, rails) = model3d_mv(p, text, args[1]);
|
||||
|
||||
@@ -106,14 +106,24 @@ pub struct Style {
|
||||
pub line: Option<String>,
|
||||
/// Linien gestrichelt ([`DEMOLISH_DASH`]).
|
||||
pub dashed: bool,
|
||||
/// [272] Grau ausserhalb der Bearbeitungsvariante ([`ghost_style`]): alle gefüllten Flächen des Elements (nicht nur
|
||||
/// die Schnittfläche) in der Füllfarbe, ohne Muster.
|
||||
pub ghost: bool,
|
||||
}
|
||||
|
||||
/// [272] Grau für Elemente ausserhalb der Bearbeitungsvariante (Häkchen „Elemente ausserhalb der Variante grau
|
||||
/// einfärben“, nur Bildschirm): helles Grau, mit dem Papier gemischt wie die Pausfolie (`plan/trace.rs::Tone`), damit es
|
||||
/// halbtransparent wirkt und in Ansicht und 3D (nur `#rrggbb`) gleich aussieht.
|
||||
pub fn ghost_style() -> Style {
|
||||
Style { fill: "#e3e3e3".into(), line: Some("#a8a8a8".into()), dashed: false, ghost: true }
|
||||
}
|
||||
|
||||
/// SIA-400-Vorgabe: Bestand grau, Abbruch gelb und gestrichelt, Neu rot.
|
||||
pub fn default_style(s: RenovationStatus) -> Style {
|
||||
match s {
|
||||
RenovationStatus::Demolish => Style { fill: "#ffd800".into(), line: None, dashed: true },
|
||||
RenovationStatus::New => Style { fill: "#e3001b".into(), line: Some("#c00016".into()), dashed: false },
|
||||
_ => Style { fill: "#a6a6a6".into(), line: None, dashed: false },
|
||||
RenovationStatus::Demolish => Style { fill: "#ffd800".into(), line: None, dashed: true, ghost: false },
|
||||
RenovationStatus::New => Style { fill: "#e3001b".into(), line: Some("#c00016".into()), dashed: false, ghost: false },
|
||||
_ => Style { fill: "#a6a6a6".into(), line: None, dashed: false, ghost: false },
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,6 +166,8 @@ pub struct View {
|
||||
pub options: Option<crate::design_options::Combination>,
|
||||
/// Etappe, bis zu der der Filter gilt (Index), `None` = alle.
|
||||
pub upto: Option<usize>,
|
||||
/// [272] Bearbeitungsvariante der Bildschirm-Darstellung (Stift; [`View::editing`]), `None` = keine.
|
||||
pub edit: Option<crate::design_options::Edit>,
|
||||
phases: HashMap<String, usize>,
|
||||
styles: [Style; 3],
|
||||
}
|
||||
@@ -185,7 +197,22 @@ impl View {
|
||||
let upto = if filter.is_some() { phase.filter(|s| !s.trim().is_empty()).and_then(|s| phase_index(p, s)) } else { None };
|
||||
let phases = phases(p).iter().enumerate().map(|(i, x)| (x.id.clone(), i)).collect();
|
||||
let styles = [style(p, RenovationStatus::Existing), style(p, RenovationStatus::Demolish), style(p, RenovationStatus::New)];
|
||||
Some(View { filter, options, upto, phases, styles })
|
||||
Some(View { filter, options, upto, phases, styles, edit: None })
|
||||
}
|
||||
|
||||
/// [272] Mit Bearbeitungsvariante (Stift, nur Bildschirm-Anfragen `designOptionEdit`): die Variante ist sichtbar (geht
|
||||
/// der Kombination vor — Stift impliziert Auge), mit `grey` bekommt alles ausserhalb [`ghost_style`]. Gibt es
|
||||
/// sonst keine `View` (kein Filter, keine Elemente in Varianten), entsteht eine. `edit = None` ⇒ `v` unverändert.
|
||||
pub fn editing(v: Option<View>, p: &Project, edit: Option<crate::design_options::Edit>) -> Option<View> {
|
||||
let Some(e) = edit else { return v };
|
||||
let mut v = v.unwrap_or_else(|| {
|
||||
let styles = [style(p, RenovationStatus::Existing), style(p, RenovationStatus::Demolish), style(p, RenovationStatus::New)];
|
||||
View { filter: None, options: None, upto: None, phases: HashMap::new(), styles, edit: None }
|
||||
});
|
||||
let c = v.options.get_or_insert_with(|| crate::design_options::Combination::primary(p));
|
||||
c.choice.insert(e.set.clone(), e.option.clone());
|
||||
v.edit = Some(e);
|
||||
Some(v)
|
||||
}
|
||||
|
||||
/// Filter einer Darstellung: ausdrücklich angefragt (CLI, Blatt-Ausschnitt), sonst der der Ebene `level_id`
|
||||
@@ -245,10 +272,25 @@ impl View {
|
||||
if let Some(c) = &self.options {
|
||||
out.hidden = c.hidden(p);
|
||||
}
|
||||
if self.filter.is_none() {
|
||||
return out;
|
||||
if self.filter.is_some() {
|
||||
self.resolve_filter(p, &mut out);
|
||||
}
|
||||
let mut put = |id: &str, t: Treat, out: &mut Resolved| match t {
|
||||
// [272] Grau ausserhalb der Bearbeitungsvariante: geht der Umbau-Farbe vor; Ausgeblendetes bleibt weg.
|
||||
if let Some(e) = self.edit.as_ref().filter(|e| e.grey) {
|
||||
let g = ghost_style();
|
||||
for id in e.outside(p) {
|
||||
if !out.hidden.contains(&id) {
|
||||
out.styled.insert(id, g.clone());
|
||||
}
|
||||
}
|
||||
out.patches.retain(|pa| !out.styled.get(&pa.opening_id).is_some_and(|s| s.ghost));
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Ausgeblendetes, Farben und Ersatzstücke des Umbaufilters (mit Filter).
|
||||
fn resolve_filter(&self, p: &Project, out: &mut Resolved) {
|
||||
let put = |id: &str, t: Treat, out: &mut Resolved| match t {
|
||||
Treat::Hide => {
|
||||
out.hidden.insert(id.to_string());
|
||||
}
|
||||
@@ -261,7 +303,7 @@ impl View {
|
||||
for w in &p.walls {
|
||||
let s = self.state(w.renovation.as_ref());
|
||||
wall_state.insert(w.id.as_str(), s);
|
||||
put(&w.id, self.treat_state(s), &mut out);
|
||||
put(&w.id, self.treat_state(s), out);
|
||||
}
|
||||
for o in p.openings.iter().flatten() {
|
||||
let host = wall_state.get(o.host_wall_id.as_str()).copied().flatten();
|
||||
@@ -270,7 +312,7 @@ impl View {
|
||||
continue;
|
||||
}
|
||||
let s = self.state(opening_renovation(p, o));
|
||||
put(&o.id, self.treat_state(s), &mut out);
|
||||
put(&o.id, self.treat_state(s), out);
|
||||
// Ersatzstück nur, wenn die Öffnung einen anderen Zustand hat als ihre (Bestands-)Wand.
|
||||
if o.renovation.is_none() || host != Some(RenovationStatus::Existing) {
|
||||
continue;
|
||||
@@ -285,19 +327,19 @@ impl View {
|
||||
}
|
||||
}
|
||||
for x in p.ceilings.iter().flatten() {
|
||||
put(&x.id, self.treat(x.renovation.as_ref()), &mut out);
|
||||
put(&x.id, self.treat(x.renovation.as_ref()), out);
|
||||
}
|
||||
for x in p.roofs.iter().flatten() {
|
||||
put(&x.id, self.treat(x.renovation.as_ref()), &mut out);
|
||||
put(&x.id, self.treat(x.renovation.as_ref()), out);
|
||||
}
|
||||
for x in p.stairs.iter().flatten() {
|
||||
put(&x.id, self.treat(x.renovation.as_ref()), &mut out);
|
||||
put(&x.id, self.treat(x.renovation.as_ref()), out);
|
||||
}
|
||||
for x in p.columns.iter().flatten() {
|
||||
put(&x.id, self.treat(x.renovation.as_ref()), &mut out);
|
||||
put(&x.id, self.treat(x.renovation.as_ref()), out);
|
||||
}
|
||||
for x in p.extruded_solids.iter().flatten() {
|
||||
put(&x.id, self.treat(x.renovation.as_ref()), &mut out);
|
||||
put(&x.id, self.treat(x.renovation.as_ref()), out);
|
||||
}
|
||||
// Räume: nur sichtbar oder nicht (ein Raum ist kein Bauteil, er bekommt keine Umbau-Farbe).
|
||||
for x in p.rooms.iter().flatten() {
|
||||
@@ -305,7 +347,6 @@ impl View {
|
||||
out.hidden.insert(x.id.clone());
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Füll- und Linienfarben der Status, die der Filter farbig zeigt (bleiben in Schwarz-Weiss erhalten).
|
||||
@@ -324,9 +365,10 @@ impl View {
|
||||
/// Schlüssel für Caches (Filter samt Darstellungen, Etappe, Farben).
|
||||
pub fn key(&self) -> String {
|
||||
let opts = self.options.as_ref().map_or(String::new(), |c| c.key());
|
||||
let edit = self.edit.as_ref().map_or(String::new(), |e| format!("|edit:{}", e.key()));
|
||||
match &self.filter {
|
||||
Some(f) => format!("{}:{:?}{:?}{:?}:{:?}:{:?}|{opts}", f.id, f.existing, f.demolish, f.new, self.upto, self.styles),
|
||||
None => format!("-|{opts}"),
|
||||
Some(f) => format!("{}:{:?}{:?}{:?}:{:?}:{:?}|{opts}{edit}", f.id, f.existing, f.demolish, f.new, self.upto, self.styles),
|
||||
None => format!("-|{opts}{edit}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -452,18 +494,25 @@ pub fn restyle_with(q: &mut Primitive, st: &Style, extra: &mut Vec<Primitive>, w
|
||||
*stroke = "none".into();
|
||||
}
|
||||
}
|
||||
Primitive::Line { color, dash: d, .. } => {
|
||||
Primitive::Line { color, dash: d, greyed, .. } => {
|
||||
if let Some(l) = &st.line {
|
||||
*color = Some(l.clone().into());
|
||||
}
|
||||
// [272] Grau ausserhalb der Bearbeitungsvariante: auch Linien mit Klassenfarbe (Türbogen, Fensterrahmen).
|
||||
if st.ghost {
|
||||
*greyed = Some(true);
|
||||
}
|
||||
if st.dashed {
|
||||
*d = dash();
|
||||
}
|
||||
}
|
||||
Primitive::Arc { color, dash: d, .. } => {
|
||||
Primitive::Arc { color, dash: d, greyed, .. } => {
|
||||
if let Some(l) = &st.line {
|
||||
*color = Some(l.clone().into());
|
||||
}
|
||||
if st.ghost {
|
||||
*greyed = Some(true);
|
||||
}
|
||||
if st.dashed {
|
||||
*d = dash();
|
||||
}
|
||||
@@ -502,7 +551,8 @@ pub fn restyle_range(r: &Resolved, prims: &mut Vec<Primitive>, from: usize, owne
|
||||
let id = prim_element(q).or(owner);
|
||||
if let Some(st) = id.and_then(|id| r.styled.get(id)) {
|
||||
// Symbole und Ansichten (Fenster, Türflügel, Treppenstufen, Decken- und Dachkanten): nur Linien.
|
||||
let f = cut_fill(q);
|
||||
// [272] Grau ausserhalb der Bearbeitungsvariante: alle Flächen.
|
||||
let f = st.ghost || cut_fill(q);
|
||||
restyle_with(q, st, &mut extra, f);
|
||||
}
|
||||
}
|
||||
@@ -558,7 +608,7 @@ pub fn patch_prims(ring: Vec<Vec2>, st: &Style, weight_mm: f64, opening_id: &str
|
||||
};
|
||||
let mut extra = Vec::new();
|
||||
if st.dashed {
|
||||
restyle(&mut q, &Style { fill: st.fill.clone(), line: None, dashed: true }, &mut extra);
|
||||
restyle(&mut q, &Style { fill: st.fill.clone(), line: None, dashed: true, ghost: false }, &mut extra);
|
||||
}
|
||||
// Linien des Stücks tragen die Öffnung (Picken, Kontrast).
|
||||
for l in extra.iter_mut() {
|
||||
@@ -585,6 +635,18 @@ pub fn view_from_text(p: &Project, text: &str) -> Option<View> {
|
||||
View::with(p, f, v.get("renovationPhase").and_then(|x| x.as_str()), &[], &req)
|
||||
}
|
||||
|
||||
/// [272] Wie [`view_from_text`] für Bildschirm-Anfragen (3D-Fenster): dazu die Bearbeitungsvariante `designOptionEdit`
|
||||
/// ([`View::editing`]). Kennzahlen und Exporte nehmen [`view_from_text`] und kennen sie nicht.
|
||||
pub fn screen_view_from_text(p: &Project, text: &str) -> Option<View> {
|
||||
let v = view_from_text(p, text);
|
||||
let t = text.trim();
|
||||
if !t.starts_with('{') {
|
||||
return v;
|
||||
}
|
||||
let Ok(j) = serde_json::from_str::<serde_json::Value>(t) else { return v };
|
||||
View::editing(v, p, crate::design_options::parse_edit(p, j.get("designOptionEdit")))
|
||||
}
|
||||
|
||||
/// 3D: Teile in der Umbau-Farbe (Füllfarbe des Status) — Wände, Decken, Dächer, Stützen, Treppen, Körper.
|
||||
pub fn color_parts(p: &Project, parts: &mut crate::model3d::Parts, r: &Resolved) {
|
||||
if r.styled.is_empty() {
|
||||
@@ -617,6 +679,14 @@ pub fn color_parts(p: &Project, parts: &mut crate::model3d::Parts, r: &Resolved)
|
||||
l.color = c;
|
||||
}
|
||||
}
|
||||
// [272] Grau ausserhalb der Bearbeitungsvariante: auch Fenster und Türen (Umbau-Farben lassen sie, wie sie sind).
|
||||
for m in parts.opening_meshes.iter_mut() {
|
||||
if let Some(st) = m.owner.id(p).and_then(|id| r.styled.get(id)).filter(|s| s.ghost) {
|
||||
m.color = crate::style::hex_to_rgb(&st.fill, crate::style::WALL_RGB);
|
||||
m.vertex_colors = None;
|
||||
m.material_index = None;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Liste der Filter für die Oberfläche (Abfrage `renovationFilters`): eingebaute, dann eigene.
|
||||
|
||||
@@ -184,6 +184,7 @@ pub fn viewport_args(p: &Project, snap: &ViewSnapshot, scale: f64, mono: bool) -
|
||||
renovation_phase: snap.renovation_phase.clone().filter(|s| !s.is_empty()),
|
||||
// [272] Variantenkombination des Ausschnitts (über der der Ebene).
|
||||
design_options: crate::design_options::stored_choice(p, snap.design_option_combination.as_deref(), snap.design_options.as_ref()).into_iter().flatten().collect(),
|
||||
design_option_edit: None,
|
||||
};
|
||||
a.apply_model_view(p);
|
||||
a
|
||||
|
||||
@@ -138,4 +138,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";
|
||||
@@ -4758,6 +4758,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",
|
||||
|
||||
@@ -4744,6 +4744,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