[271] Umbau-Panel im Dock: Zeichen-Status, Umbaufilter mit Vorschau, Status der Auswahl, Etappen; schmale Selektoren beheben 45 Renders je Wand-Änderung
This commit is contained in:
19 files changed
+984
-56
No files matched your search
@@ -73,7 +73,7 @@ Kennwort, anonym) als PDF; Austausch mit Fachplanern über DXF/IFC.
|
||||
Geprüft und in Ordnung: Anonymität (Plakat-PDF Titel „FALKE 7“, Producer leer, Datum 2000, Schriften eingebettet, `pdftotext` ohne Projekt-/Büronamen; Kennzahlen-PDF nach „anonym“ ebenso; DXF/IFC ohne Projektnamen), Ansichten/Schnitt stimmig zum Grundriss (Fensterlagen nachgemessen), Kennzahlen-Tabelle Plakat = Flächenbilanz, ÜZ 127.71/900, Kosten 2’844 CHF/m² GF plausibel (mit Befund 1), IFC mit Georeferenz LV95 (IfcMapConversion). **Nicht geprüft:** Tauri-App/Mac (Metal, 3D-Bild, Schatten, Rendering), Mausbedienung (alles über Befehlszeile und Test-Naht), Druck des A1-Plakats, DXF/IFC in Fremdsoftware. · M (Reste)
|
||||
|
||||
- ◐ **[270]** Blickrichtungen überall gleich, Marken weichen aus (17.11.). **Befund:** das 3D-Fenster (render3d, Browser und Metal) zeigte das Modell **gespiegelt**: Bauteile liegen in der Welt (x, Höhe, y), ein Achsentausch (Determinante −1), und `look_at` ist rechtshändig — von Süden gesehen lag der Erker im Osten links, die Draufsicht stand kopfüber (Süden oben). Gelände, Importe/Verbau und Punktwolken negierten y (Fix 24.9. „swisstopo gespiegelt“) und lagen damit an y = 0 gespiegelt unter dem Haus. Vektor-Axonometrie, Cycles, Blender, glTF/OBJ und die Ansichten Nord/Ost/Süd/West waren seitenrichtig, aber die Namen widersprachen sich: `iso` = von Nordost (3D, Axo-Alias), von Südwest (Cycles/Blender); `front` = von Norden (3D, Axo) bzw. Süden (Cycles); „Axonometrie Südost“ im Musterhaus komplex stand auf `isoFrontLeft`. **Behoben:** eine Tabelle `render3d/src/view_dir.rs` für 3D-Presets (`math::preset_camera`), Axonometrie (`plan/axo.rs::preset`), Cycles (`cycles_scene.rs::preset`, CLI `render --view` nimmt auch `southeast` …), Blender-Skript (Kopie, per vitest geprüft): vorne = Süden, rechts = Osten, `iso` = Südost, `isoFrontLeft` = Südwest, `isoBackRight` = Nordost, `isoBackLeft` = Nordwest, `top` mit Norden oben; Beschriftungen „Isometrie Südost“, „Südwest“ … Die Spiegelung gleicht die Kamera an einer Stelle aus (`math::view_matrix`: Bild-rechts = oben × Blick; Culling `FrontFace::Cw`; Pathtracer-Strahlen; TS `screenRight`/`orbitRight` für Pick-Strahl, Griffe, Pan, Zoom zum Cursor, Begehen, Orbit-Richtung); Gelände/Import/Punktwolke/Luftbild ohne y-Negation. Ausschnitt „Axonometrie Südost“ → `iso`. **Marken ([266]/8):** Ansichtsmarken werden nach den Schnitten gesetzt und weichen Schnittlinien, -pfeilen und anderen Ansichtsmarken aus (zusätzlich seitlich entlang ihrer Linie, bis 15 mm; `plan/context.rs::view_marker`); Schnittpfeile sind Hindernis für Beschriftungen. Tests: Rust render3d `kamera_zeigt_modell_seitenrichtig` (vorher rot), `aussenflaechen_erscheinen_im_uhrzeigersinn`, `view_dir::tests`; Kern `axo::testhaus_seitenrichtig_in_allen_vorgaben`, `cycles_scene::voreinstellungen_heissen_wie_im_3d`, `context::ansichtsmarken_weichen_schnittmarken_aus` (vorher rot); vitest `view270.test.ts`, `viewDirections.test.ts`. Bilder und Testhaus (Erker Ost, Garage West, Turm Nordwest; `testhaus.py`) in `doc/review-270/`. **Offen:** 3D-Bild nur numerisch (Kameramatrix, Pick-Strahl) geprüft, kein Bild aus render3d unter Linux, nicht auf dem Mac/Metal (Prüfschritt `doc/RELEASE-1.0.md` 13.36); natives Spike-Fenster `src-tauri/src/native.rs` (Orbit-Richtung) nicht angepasst; gespeicherte Ausschnitte mit `isoBackRight`/`isoFrontLeft` zeigen jetzt die Richtung ihres Namens (keine produktiven Projekte). · M
|
||||
- ◐ **[271]** Umbaufilter wie Archicad (Wunsch Maintainer 17.11.). **Modell:** `renovation: {status: existing|demolish|new, phase?}` an Wand, Öffnung (ohne eigenen Status folgt sie der Wand), Decke, Dach, Treppe, Stütze, Körper und Raum (Raum nur Sichtbarkeit/Flächen, keine Farbe — kein Bauteil); `Project.renovation` (Etappen, Farben, eigene Filter); `DrawingLevel`/`ViewTemplate`/`ViewSnapshot.renovationFilter`+`renovationPhase` (der Filter gehört zur Ebene wie die Modelldarstellung [173], damit je Reiter/Ausschnitt/Vorlage). **Kern** `renovation.rs` (ein Ort, `doc/ARCHITEKTUR.md` 3.8): Vorgaben Bestand/Abbruch/Neubau/Umbauplan/Endzustand, SIA-400-Farben (Bestand grau, Abbruch gelb gestrichelt, Neu rot, anpassbar), Etappen „bis n“ (Neues früherer Etappen = Bestand, Abbruch früherer weg, spätere Neue fehlen), Öffnung neu in Bestandswand = Abbruch-Stück bzw. zugemauerte Öffnung = Ausfachung (Wand zu, wo die Öffnung ausgeblendet ist). Umbau-Farben bleiben auch in Tusche (Schwarz-Weiss, `extras::KeepColors`); gefüllt werden nur Schnittflächen (Wand, Stütze), Symbole (Fenster, Türflügel, Tritte) nur in Linienfarbe. Angebunden: Grundriss, Schnitt, Ansicht, Vektor-Axo, 3D-Fenster (Filter der aktiven Ebene) und `model3d`, Kennzahlen/Flächen (Zustand Bestand/Endzustand im Panel), DXF (Layer `<Klasse>_Abbruch`/`_Neu`), IFC (`Status` NEW/EXISTING/DEMOLISH im `Pset_*Common`, Etappe in `Dossier_Umbau`). **Bedienung:** Objekt-Info/Objekteinstellungen „Umbau“ + „Etappe“ (Mehrfachauswahl, ein Undo-Schritt), Statusleiste „Umbau: …“ (Zeichen-Status neuer Bauteile, Vorgabe Bestand, Kern `commands::stamp_renovation`; Umbaufilter und Etappe der Ansicht; mit der Pausfolie im Überlauf „⋯“), Befehl `umbau` (B/A/N; die Befehlszeile nimmt getippte Options-Kürzel jetzt auch mit Enter an, `engine.ts`), Ressourcen-Tab „Umbau“ (Etappen, Farben), Vorlage „Beispiel Umbau“ (`model/sampleProjectUmbau.ts`, CLI `:umbau`), CLI `--renovation`/`--phase` (plan, section, elevation, axo, model3d, kennzahlen). Tests: Kern `renovation_tests.rs` (19), Robustheit, vitest `model/renovation.test.ts`, `commands/cmds/renovation.test.ts`, e2e `renovation271.spec.ts` (2× grün, Port 5195; dazu `uxReview263`, `objectSettings`, `modelViews`, `release10`, `editing` grün); Bilder `doc/review-271/` (CLI-SVG `--hatch` in Chromium, App-Screenshot). **Offen:** 3D-Fenster nur im Code angebunden (Kern-Teile per Test geprüft, Bild nicht angesehen: kein render3d unter Linux); Ersatzstücke der Öffnungen nur im Grundriss (Schnitt/Ansicht: Öffnung fehlt bzw. ist da, ohne gelbes/rotes Stück); Linien der Projektion im Schnitt und Öffnungen in der Ansicht ohne Umbau-Farbe; Bogenwände ohne Ersatzstück; Cycles/Blender und Explosionsaxonometrie ohne Filter; Picken im 3D trifft ausgeblendete Bauteile; 2D-Zeichnungen, Bäume (eigener Status [149]) und Bibliotheksobjekte ohne Status; Ansichtsleiste/Werkzeugleiste ohne eigene Filter-Wahl (nur Statusleiste); eigene Filter nur im Modell (keine Bearbeitung in der Oberfläche); Tauri/Mac nicht geprüft (Prüfschritt `doc/RELEASE-1.0.md` 13.37). · M
|
||||
- ◐ **[271]** Umbaufilter wie Archicad (Wunsch Maintainer 17.11.). **Modell:** `renovation: {status: existing|demolish|new, phase?}` an Wand, Öffnung (ohne eigenen Status folgt sie der Wand), Decke, Dach, Treppe, Stütze, Körper und Raum (Raum nur Sichtbarkeit/Flächen, keine Farbe — kein Bauteil); `Project.renovation` (Etappen, Farben, eigene Filter); `DrawingLevel`/`ViewTemplate`/`ViewSnapshot.renovationFilter`+`renovationPhase` (der Filter gehört zur Ebene wie die Modelldarstellung [173], damit je Reiter/Ausschnitt/Vorlage). **Kern** `renovation.rs` (ein Ort, `doc/ARCHITEKTUR.md` 3.8): Vorgaben Bestand/Abbruch/Neubau/Umbauplan/Endzustand, SIA-400-Farben (Bestand grau, Abbruch gelb gestrichelt, Neu rot, anpassbar), Etappen „bis n“ (Neues früherer Etappen = Bestand, Abbruch früherer weg, spätere Neue fehlen), Öffnung neu in Bestandswand = Abbruch-Stück bzw. zugemauerte Öffnung = Ausfachung (Wand zu, wo die Öffnung ausgeblendet ist). Umbau-Farben bleiben auch in Tusche (Schwarz-Weiss, `extras::KeepColors`); gefüllt werden nur Schnittflächen (Wand, Stütze), Symbole (Fenster, Türflügel, Tritte) nur in Linienfarbe. Angebunden: Grundriss, Schnitt, Ansicht, Vektor-Axo, 3D-Fenster (Filter der aktiven Ebene) und `model3d`, Kennzahlen/Flächen (Zustand Bestand/Endzustand im Panel), DXF (Layer `<Klasse>_Abbruch`/`_Neu`), IFC (`Status` NEW/EXISTING/DEMOLISH im `Pset_*Common`, Etappe in `Dossier_Umbau`). **Bedienung:** Objekt-Info/Objekteinstellungen „Umbau“ + „Etappe“ (Mehrfachauswahl, ein Undo-Schritt), Statusleiste „Umbau: …“ (Zeichen-Status neuer Bauteile, Vorgabe Bestand, Kern `commands::stamp_renovation`; Umbaufilter und Etappe der Ansicht; mit der Pausfolie im Überlauf „⋯“), Befehl `umbau` (B/A/N; die Befehlszeile nimmt getippte Options-Kürzel jetzt auch mit Enter an, `engine.ts`), Ressourcen-Tab „Umbau“ (Etappen, Farben), Vorlage „Beispiel Umbau“ (`model/sampleProjectUmbau.ts`, CLI `:umbau`), CLI `--renovation`/`--phase` (plan, section, elevation, axo, model3d, kennzahlen). Tests: Kern `renovation_tests.rs` (19), Robustheit, vitest `model/renovation.test.ts`, `commands/cmds/renovation.test.ts`, e2e `renovation271.spec.ts` (2× grün, Port 5195; dazu `uxReview263`, `objectSettings`, `modelViews`, `release10`, `editing` grün); Bilder `doc/review-271/` (CLI-SVG `--hatch` in Chromium, App-Screenshot). **Offen:** 3D-Fenster nur im Code angebunden (Kern-Teile per Test geprüft, Bild nicht angesehen: kein render3d unter Linux); Ersatzstücke der Öffnungen nur im Grundriss (Schnitt/Ansicht: Öffnung fehlt bzw. ist da, ohne gelbes/rotes Stück); Linien der Projektion im Schnitt und Öffnungen in der Ansicht ohne Umbau-Farbe; Bogenwände ohne Ersatzstück; Cycles/Blender und Explosionsaxonometrie ohne Filter; Picken im 3D trifft ausgeblendete Bauteile; 2D-Zeichnungen, Bäume (eigener Status [149]) und Bibliotheksobjekte ohne Status; Ansichtsleiste/Werkzeugleiste ohne eigene Filter-Wahl (Statusleiste und Panel Umbau); eigene Filter nur im Modell (keine Bearbeitung in der Oberfläche); Tauri/Mac nicht geprüft (Prüfschritt `doc/RELEASE-1.0.md` 13.37). **Nachtrag 17.11. (Panel):** eigenes Dock-Panel „Umbau“ (`panels/RenovationPanel.tsx`, Reiter rechts oben neben Objekt-Info/Flächenbilanz, Layout v16): Zeichen-Status Bestand/Abbruch/Neu mit SIA-Farbmuster + Etappe, Umbaufilter der aktiven Ansicht als Liste mit Vorschau je Status (wie gezeichnet/ausgeblendet/Umbau-Farbe) + „bis Etappe“, Status der Auswahl (gemischt-Marke) mit Setzen und Etappe (ein Undo-Schritt), „Nach Status wählen“ (Geschoss), Etappenliste (anlegen, umbenennen, Reihenfolge, Löschen mit Rückfrage über `ui/ConfirmDialog`, Verweis auf die Farben in den Ressourcen). Statusleisten-Popover und Objekt-Info teilen Zustand und Aktionen mit dem Panel (`state/renovationHook.ts`, keine Doppelspur) und lesen nur schmale Teile des Projekts: behebt die 45 Renders je Wand-Änderung in `renderCount.spec.ts` (jetzt 42, Grenze unverändert; `RenovationField` ist `memo`). Filter-Vorschau der eingebauten Filter spiegelt `renovation::builtin` in `model/renovation.ts` (vitest prüft gegen den Plan des Kerns; sauberer wäre, die Anteile in `filter_list` mitzuliefern). Tests: vitest `model/renovation.test.ts` (+3), e2e `renovationPanel271.spec.ts` (Port 5193); Bild `doc/review-271/05-panel-umbau.png`. Nicht geprüft: Tauri/Mac. **Offen:** Panel-Bild nur hell/1280×800 angesehen (dunkel ebenfalls ok, schmale Leiste nicht eigens). · M
|
||||
- ◐ **[269]** Pläne schöner, Befunde aus Screenshots des Koordinators (16.11.; CLI `plan|section|elevation --hatch --template "Eingabeplan 1:100"`, SVG → Chromium; Bilder vorher/nachher `doc/review-269/`). **Behoben 17.11.:** (1) **Ausschnitt mit Parzelle:** das Plan-Ausmass endet bei Parzelle + 5 m (`SITE_MARGIN_M`) vereinigt mit Haus ± Marken-Reichweite und den nicht weitreichenden Zeichnungen (Titel, Massstab, Bemassung; Kataster/Strassen/Höhenlinien/Bäume/Kontext-Klassen zählen nicht, `drawings::is_far_class`); keine Beschneidung im Situationsplan und bei sichtbarem Schatten (`extras::site_clip`, in beiden Puffer-Wegen von `domains.rs`). Wettbewerb EG 1:200: SVG 85 × 54.9 m → 46 × 37.9 m; Musterhaus komplex EG 99 × 63.6 → 55 × 46.6 m. Layout-Viewports/Plakat croppen schon über [208] (`crop`, Haus + 20 mm) und ändern sich praktisch nicht; Einpassen beim Öffnen nutzt `house`. Die Linien ausserhalb bleiben im SVG (werden von der viewBox abgeschnitten), nicht geometrisch gekappt. (2) **Gartenkörper:** Brunnen, Loft, Rotationskörper im Musterhaus komplex lagen auf „20 Wände“, jetzt Klasse „24 Fahrzeuge & Freiflächen“ (`GARDEN_CLASS`) — in Grundriss, Schnitt und Ansicht ausschaltbar. Die Vorlage „Eingabeplan 1:100“ blendet 24 NICHT aus (würde auch Parkfelder/Fahrzeuge im Grundriss ausblenden; fachlicher Entscheid offen für den Maintainer); im Nachher-Bild `--hide …,24`. Der Standard für neue freie Körper bleibt die aktive Klasse. (3) **Dachziegel/Ansichtsschraffur:** Musterlinien in der Ansicht nie enger als 2.5 mm Papier (`PATTERN_MIN_PAPER_MM`, dünnt bei 1:100 und 1:200 gleich aus, vorher 0.7 mm), Standardstärke 0.05 statt 0.1 mm (höchstens 0.09), Vorgabefarbe unverändert. (4) **Hinweistext:** im Beispiel jetzt im Wohnraum über der Hebeschiebetür mit kurzer Führungslinie; Führungslinien setzen vor Masszahlen, Texten und Koten aus (`cut_at_gaps`, mit Wächter gegen Rekursion in der Hindernisberechnung — erste Fassung stürzte im WASM mit Stack-Überlauf ab, im nativen Test nicht); Titel „Erdgeschoss“ und Massstabsbalken rücken ans Haus. Tests: Rust `ausmass_endet_an_parzelle_plus_rand`, `fuehrungslinie_setzt_vor_masszahlen_aus`, `ansichtsschraffur_massstabsgerecht_und_fein`; Goldens `komplex-ansicht-ansicht-sued`, `komplex-grundriss-eg-100/-50` (Hinweis/Titel/Massstab verschoben, Ansichtsschraffur dünner und seltener). **Offen:** Ausschnitt nur Linux/CLI angesehen (nicht in der App/Metal), Beschriftung am Rand (z. B. „Kat.-Nr. 1188“) kann angeschnitten sein; Schnitt/Ansicht-Ausmass nicht beschnitten (Gelände); Eingabeplan-Klasse 24 s. o.; Stossfugen-Muster (Läuferverband) in der Ansicht nicht eigens geprüft. · S
|
||||
- ◐ **[268]** Review der Änderungen vom 15./16.11. auf echte Fehler vor der Beta (16.11.; [256] [260] [261] [262] [263] [264] [265] [266] [267] [170] [30]). **Behoben 16.11.:** (1) **Datenverlust nach Sprachwechsel** ([264] `LanguageRoot` baut die App neu auf): zuletzt gespeicherter Stand, Pfad, Lock und Autosave-Stand lagen in `useRef` von `useProjectFileActions` und wurden zurückgesetzt — danach galten ungespeicherte Änderungen als gespeichert, Neu/Öffnen/Fenster schliessen verwarfen sie ohne Rückfrage, Cmd+S fragte neu nach dem Pfad, der Lock der offenen Datei blieb liegen; zudem erschien die Autosave-Kopie der laufenden Sitzung als „Ungesicherte Arbeit gefunden“. Jetzt Sitzungszustand ausserhalb von React (`FileSession`), Suche nach Kopien einmal je Seitenladen; e2e `languageSwitch268.spec.ts` (vorher rot, beide Fälle). (2) **Release-Skript** (`scripts/release-gitea.mjs`): jeder Fehler beim Lesen von `versions.json` (Netz, 5xx, Proxy) galt als „leer“ — `--publish` überschrieb den Versionsverlauf mit nur der neuen Version; ein nicht lesbares `SHA256SUMS.txt` der anderen Plattform fiel stillschweigend aus den Prüfsummen. Jetzt nur 404 = leer, sonst Abbruch (`fetchExisting`, `parseSums` in `release-gitea-lib.cjs`, Test `releaseGitea.test.ts`). **Offen (Verdacht ohne Nachweis, Befund · Ort · Szenario · Grösse):** ~~a.~~ **Behoben 16.11. (Electron-Links):** `setWindowOpenHandler` (nie ein Kindfenster; https/mailto → `shell.openExternal`, sonst verwerfen), `will-navigate`/`will-redirect` nur im App-Ursprung (`dossier://app`, Dev-Server `localhost:5187`; fremdes https → System-Browser), CSP in `onHeadersReceived` nur für den App-Ursprung; Entscheide als reine Funktionen in `scripts/electron-links.cjs` (im Paket, `electron-builder.yml`), Test `src/native/electronLinks.test.ts` und e2e `linuxApp170.spec.ts` („Externe Links“: `window.open`/Navigation erzeugen kein Fenster, `shell.openExternal` im Hauptprozess abgefangen; mit gebautem AppImage grün). `openExternalUrl` (Fehler melden, Blender laden) nutzt unter Electron `window.open` und landet damit im System-Browser, keine App-Änderung nötig. Offen: Tauri/Mac unberührt (dort `plugin-shell`), echter Browser-Start nicht geprüft (nur Hook). b. Sprachwechsel setzt weiteren UI-Zustand zurück: Fang-Einstellungen (`useDrawingToolState`, `DEFAULT_SNAP`), aktives Werkzeug, laufender Befehl, Element-Zwischenablage (`useSelectionState`), offene Dialoge ausser Einstellungen · kein Datenverlust, aber z. B. ausgeschalteter Ortho-Fang ist danach wieder an · S. ~~c.~~ **Behoben 16.11.:** `uploadAsset` lädt beim Ersetzen erst unter `<name>.upload-<ms>` hoch, löscht dann den alten Anhang und benennt per PATCH um (`latest.json` fehlt nie; Rest `.upload-…` bei Abbruch in Gitea löschen; gegen echte Gitea-API nicht geprüft, nur `--dry-run`). ~~d.~~ **Behoben 16.11.:** ohne `--publish` auf ein veröffentlichtes Release Abbruch, bewusst mit `--replace-published` (`preflight` in `release-gitea-lib.cjs`, läuft vor dem Anlegen des Entwurfs). ~~e.~~ **Behoben 16.11.:** `--publish` ohne Mac-Pakete (weder im Ordner noch am Release) bricht ab, bewusst nur Linux mit `--linux-only`; Tests `releaseGitea.test.ts`, README „Release auf Gitea“ nachgeführt. **Geprüft ohne Befund:** `elevation_set.rs` (Faltung, Namen, vorhandene Seiten), `kernel2d/src/rooms.rs` (Offset je Kante, NaN), `standards_names.rs`/Standards-Abgleich (kein Duplikat, „Aktualisieren“ hält englische Namen), `stamp_place.rs` `cut_out` (NaN ohne Panic), [262] Offline-Pfade und Host-/CSP-Listen (Overpass, http-Fähigkeit Gitea), [261] `build-number.cjs`, Kurzanleitung (`miniMarkdown` ohne HTML), Dock-Einklappen (`reconcileLayout`), Electron-Argumentdatei (`take-open-file` einmalig). Nicht geprüft: Mac/Tauri, Electron-Paket, GPU-Renderer über mehrere Sprachwechsel (Speicher), [216] Erker und [208] DXF-MTEXT im Detail.
|
||||
- ◐ **[263]** Visuelle und UX-Prüfung des Referenz-Ablaufs (15.11., Wunsch Maintainer „prüfe auch visuell und UX“): Chromium/Linux, Screenshots 1280×800 (de hell, de dunkel, en hell, 1440×900 und 1920×1080 stichprobenweise) von Start, Neues Projekt, allen Dock-Reitern, Menüs, Einstellungen/Über/Kürzel/Ressourcen/Verlauf/BCF/3D-Bild/Rendering/DXF-/IFC-Export/Standort-Import, Musterhaus, Musterhaus komplex, Wettbewerb (Plan, Objekt-Info, Taste T, Mappe, Plakat-Blatt, Publikationssatz). Automatisch geprüft: Symbolknöpfe ohne Tooltip (0 Funde), rohe Übersetzungs-Schlüssel (0), abgeschnittene Texte, Esc/Enter an Dialogen (alle modalen Dialoge schliessen mit Esc). **Behoben 15.11.:** (1) unbekannter Befehl in der Befehlszeile tat nichts, jetzt Meldung „Unbekannter Befehl …“ (`engine.ts`, `cmd.unknown`); (2) Layout-Werkzeugleiste: Tabellen-Auswahl auf den Pfeil geschrumpft und „Einpassen“ ausserhalb, jetzt Umbruch; (3) Attribute-Panel: Quellen-Auswahl neben der Strichstärke zeigte „e ▾“ (Label-Spalte höchstens 42 %); (4) Standort-Import: Platzhalter der Bezugspunkt-Felder abgeschnitten; (5) Ansichtsleiste: Ausblendung am rechten Rand, wenn dort noch Bedienelemente liegen; (6) Schreibweise: de „Schließen/Maßstab/Außen“ gemischt mit „Schliessen/Massstab/Aussen“ → überall Schweizer „ss“ (Test `src/i18n/spelling.test.ts`), „Snap-/Endpunkt-Farbe“ → „Fang-“, en „room program“/„colour“ → „room programme“/„color“. e2e: `e2e/uxReview263.spec.ts`. **Nachtrag 17.11. (Statusleiste, in GitHub Actions rot):** Der Wertcluster schnitt bei breiteren System-Schriften (ubuntu-latest) Felder ab. Jetzt kürzt sich die Leiste nach Priorität (`StatusBar.tsx`, gemessen per `scrollWidth`/ResizeObserver, kein Abschneiden mehr): 1 Beschriftungen weg (Tooltip bleibt, X/Y und LV95 behalten sie) · 2 Einheit und Build weg · 3 Linien-Darstellung, 4 Pausfolie, 5 Fang und Referenzlinien in ein Überlauf-Menü „⋯“ (Popover nach oben, Esc schliesst); Geschoss und Ebene bleiben immer. Der Cluster-Rand ist nicht mehr `overflow: hidden` (Popover wurden sonst beschnitten). e2e simuliert die CI-Schrift (DejaVu Sans + Zeichenabstand) bei 1280, 1440 und 1024 px (vorher rot). Nicht auf dem Mac geprüft. **Offen (nach Wichtigkeit, Grösse):**
|
||||
|
||||
@@ -350,6 +350,13 @@ Für Umbauten trägt jedes Bauteil (Wand, Öffnung, Decke, Dach, Treppe, Stütze
|
||||
„Bestand“, „Abbruch“ oder „Neu“. Zum Ausprobieren: *Datei → Neu aus Vorlage: Beispiel Umbau* (Zwischenwand abgebrochen,
|
||||
Fenster zugemauert, neues Fenster in der Westwand, Anbau in der zweiten Etappe).
|
||||
|
||||
- **Panel Umbau:** Der Reiter **Umbau** (rechts oben neben Objekt-Info und Flächenbilanz, einklappbar wie die anderen Panels)
|
||||
bündelt alles an einem Ort: oben „Neue Bauteile zeichnen als“ (Bestand, Abbruch, Neu mit Farbmuster, dazu die Etappe), darunter
|
||||
„Umbaufilter dieser Ansicht“ als Liste mit Vorschau der drei Status (wie gezeichnet, ausgeblendet oder in Umbau-Farbe), dann
|
||||
„Auswahl“: zeigt den Status der gewählten Bauteile („gemischt“, wenn sie verschieden sind), setzt sie auf Bestand, Abbruch
|
||||
oder Neu und weist die Etappe zu (je Aktion ein Undo-Schritt). „Nach Status wählen“ wählt alle Bauteile des Geschosses mit
|
||||
einem Status, z. B. alles, was abgebrochen wird. Unten stehen die Etappen (anlegen, umbenennen, Reihenfolge, löschen mit
|
||||
Rückfrage). Die Statusleiste bleibt als Kurzzugriff auf dieselben Einstellungen.
|
||||
- **Status setzen:** Bauteile wählen, in der **Objekt-Info** (auch Objekteinstellungen, Taste T) das Feld „Umbau“ und die
|
||||
„Etappe“ wählen; bei Mehrfachauswahl ändern sich alle in einem Schritt. Oder den Befehl `umbau` tippen und B, A oder N.
|
||||
- **Neue Bauteile:** Vorgabe ist „Bestand“. Rechts in der Statusleiste zeigt der Knopf Umbau den Zeichen-Status; ein Klick
|
||||
@@ -360,7 +367,7 @@ Fenster zugemauert, neues Fenster in der Westwand, Anbau in der zweiten Etappe).
|
||||
Stand einer Etappe. Der Filter gehört zur Ebene wie die Modelldarstellung; Ausschnitte und Ansichtsvorlagen merken ihn.
|
||||
- **Öffnungen in Bestandswänden:** eine neue Öffnung bricht Mauerwerk ab (im Umbauplan ein gelbes Stück, im Bestand ist die
|
||||
Wand zu), eine Öffnung „Abbruch“ wird zugemauert (rote Ausfachung, im Neubau und Endzustand ist die Wand zu).
|
||||
- **Etappen und Farben:** *Fenster → Ressourcen*, Reiter „Umbau“: „Etappe hinzufügen“, umbenennen, Reihenfolge; die
|
||||
- **Etappen und Farben:** die Etappen im Panel Umbau (oder *Fenster → Ressourcen*, Reiter „Umbau“); dort auch die
|
||||
„Umbau-Farben“ je Status (Füllung, Linie, gestrichelt).
|
||||
- **Flächen:** Panel Flächenbilanz, „Zustand“ Bestand oder Endzustand.
|
||||
- **Exporte:** DXF legt Abbruch und Neu auf eigene Layer (z. B. 20_Wände_Abbruch), IFC schreibt den Status als `Status` im
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 143 KiB |
@@ -0,0 +1,73 @@
|
||||
// [271] Dock-Panel „Umbau“: Zeichen-Status Neu → neue Wand ist rot, Filter umschalten, Auswahl auf Abbruch setzen + Undo,
|
||||
// Auswahl nach Status, Etappe anlegen/löschen (Rückfrage über Overlay-Dialog). Port: E2E_PORT=5193.
|
||||
import { blurFocus, commandInput, expect, finishCommand, openTab, test, typeCommand } from "./app";
|
||||
|
||||
test.use({ viewport: { width: 1280, height: 800 } });
|
||||
|
||||
const RED = "#e3001b";
|
||||
const YELLOW = "#ffd800";
|
||||
|
||||
test("Umbau-Panel: Zeichen-Status, Filter, Auswahl, Etappen ([271])", async ({ page }) => {
|
||||
await page.goto("/?dossierTest");
|
||||
await page.getByRole("button", { name: /Neues Projekt/ }).first().click();
|
||||
await expect(page.getByRole("group", { name: "Befehlszeile" })).toBeVisible();
|
||||
const ren = () => page.evaluate(() => window.__dossierTest!.renovation());
|
||||
const fills = () => page.evaluate(() => window.__dossierTest!.planFillColors());
|
||||
|
||||
await openTab(page, "Umbau");
|
||||
const panel = page.getByTestId("renovation-dock");
|
||||
await expect(panel).toBeVisible();
|
||||
await page.screenshot({ path: "test-results/renovation271-panel-leer.png" });
|
||||
|
||||
// Zeichen-Status Neu, dann eine Wand über die Befehlszeile.
|
||||
await panel.getByTestId("reno-draw-new").click();
|
||||
await expect.poll(async () => (await ren()).draw).toBe("new");
|
||||
await page.getByRole("button", { name: "Wand", exact: true }).click();
|
||||
await commandInput(page).focus();
|
||||
await typeCommand(page, "0,0");
|
||||
await typeCommand(page, "5,0");
|
||||
await finishCommand(page);
|
||||
await expect.poll(async () => Object.values((await ren()).walls)).toEqual(["new"]);
|
||||
|
||||
// Filter Umbauplan: die neue Wand ist rot; Bestand-Filter blendet sie aus.
|
||||
await blurFocus(page);
|
||||
await panel.getByTestId("reno-filter-umbauplan").click();
|
||||
await expect.poll(async () => (await ren()).filter).toBe("umbauplan");
|
||||
await expect.poll(async () => Object.keys(await fills())).toContain(RED);
|
||||
await expect(panel.getByTestId("reno-chip-new")).toHaveAttribute("data-show", "override");
|
||||
await panel.getByTestId("reno-filter-bestand").click();
|
||||
await expect.poll(async () => Object.keys(await fills())).not.toContain(RED);
|
||||
await panel.getByTestId("reno-filter-umbauplan").click();
|
||||
|
||||
// Auswahl: Wand wählen, auf Abbruch setzen (ein Undo-Schritt), Undo.
|
||||
const wallId = Object.keys((await ren()).walls)[0];
|
||||
await page.evaluate((id) => window.__dossierTest!.select({ walls: [id] }), wallId);
|
||||
await expect(panel.getByTestId("reno-sel-state")).toHaveAttribute("data-status", "new");
|
||||
await panel.getByTestId("reno-set-demolish").click();
|
||||
await expect.poll(async () => (await ren()).walls[wallId]).toBe("demolish");
|
||||
await expect(panel.getByTestId("reno-sel-state")).toHaveAttribute("data-status", "demolish");
|
||||
await expect.poll(async () => Object.keys(await fills())).toContain(YELLOW);
|
||||
await blurFocus(page);
|
||||
await page.keyboard.press("ControlOrMeta+z");
|
||||
await expect.poll(async () => (await ren()).walls[wallId]).toBe("new");
|
||||
|
||||
// Nach Status wählen: Abbruch gibt es nicht (Knopf aus), Neu wählt die Wand.
|
||||
await page.evaluate(() => window.__dossierTest!.select({}));
|
||||
await expect(panel.getByTestId("reno-select-demolish")).toBeDisabled();
|
||||
await panel.getByTestId("reno-select-new").click();
|
||||
await expect(panel.getByTestId("reno-sel-state")).toHaveAttribute("data-status", "new");
|
||||
|
||||
// Etappe anlegen, umbenennen; löschen mit Rückfrage (Abbrechen lässt sie stehen).
|
||||
await panel.getByTestId("reno-phase-add").click();
|
||||
await expect(panel.getByTestId("reno-phase-row")).toHaveCount(1);
|
||||
await panel.getByTestId("reno-phase-name").fill("Rohbau");
|
||||
await expect(panel.getByTestId("reno-phase-name")).toHaveValue("Rohbau");
|
||||
await panel.getByTestId("reno-phase-remove").click();
|
||||
const dialog = page.getByTestId("confirm-dialog");
|
||||
await expect(dialog).toBeVisible();
|
||||
await dialog.getByRole("button", { name: "Abbrechen" }).click();
|
||||
await expect(panel.getByTestId("reno-phase-row")).toHaveCount(1);
|
||||
await panel.getByTestId("reno-phase-remove").click();
|
||||
await page.getByTestId("confirm-dialog-ok").click();
|
||||
await expect(panel.getByTestId("reno-phase-row")).toHaveCount(0);
|
||||
});
|
||||
@@ -124,6 +124,7 @@ export { buildCostReport, costGroupLabel, costUnitLabel } from "../export/costRe
|
||||
export {
|
||||
BUILTIN_RENOVATION_FILTERS, RENOVATION_STATUSES, RENOVATION_COLLECTIONS, DEFAULT_RENOVATION_STYLES, renovationFilterList, renovationStatus, renovationPhases,
|
||||
renovationForNew, setRenovationOps, renovatableIds, commonRenovation, setPhasesOps, newPhaseId,
|
||||
renovationFilterShows, renovationStyleOf, idsByRenovationStatus, renovationCounts, phaseUsage,
|
||||
} from "../model/renovation";
|
||||
export type { RenovationFilterEntry, RenovationCollection } from "../model/renovation";
|
||||
export { buildUmbauSampleProject } from "../model/sampleProjectUmbau";
|
||||
@@ -4717,6 +4717,29 @@ export const de = {
|
||||
"renovation.styles.line": "Linie",
|
||||
"renovation.styles.dashed": "gestrichelt",
|
||||
"renovation.styles.reset": "Vorgabe",
|
||||
"renovation.panel.tab": "Umbau",
|
||||
"renovation.panel.draw.hint": "Gilt für alles, was jetzt neu gezeichnet wird.",
|
||||
"renovation.panel.draw.status": "Status neuer Bauteile",
|
||||
"renovation.panel.filter.title": "Umbaufilter dieser Ansicht",
|
||||
"renovation.panel.filter.locked": "Diese Ansicht hat keinen eigenen Umbaufilter.",
|
||||
"renovation.panel.filter.preview": "Darstellung im Filter",
|
||||
"renovation.show.show": "wie gezeichnet",
|
||||
"renovation.show.hide": "ausgeblendet",
|
||||
"renovation.show.override": "Umbau-Farbe",
|
||||
"renovation.panel.selection.title": "Auswahl",
|
||||
"renovation.panel.selection.none": "Keine Bauteile mit Umbau-Status gewählt.",
|
||||
"renovation.panel.selection.count": "{n} Bauteile gewählt",
|
||||
"renovation.panel.set": "Auf {status} setzen",
|
||||
"renovation.panel.selectAll": "Alle {status} wählen ({n})",
|
||||
"renovation.panel.selectBy": "Nach Status wählen",
|
||||
"renovation.panel.selectionPhase": "Etappe der Auswahl",
|
||||
"renovation.panel.phases.name": "Name der Etappe",
|
||||
"renovation.panel.phases.used": "{n} Bauteile",
|
||||
"renovation.panel.phases.deleteTitle": "Etappe löschen",
|
||||
"renovation.panel.phases.deleteMessage": "Etappe „{name}“ löschen? {n} Bauteile verlieren ihre Etappe, ihr Status bleibt.",
|
||||
"renovation.panel.phases.deleteMessageUnused": "Etappe „{name}“ löschen?",
|
||||
"renovation.panel.phases.delete": "Löschen",
|
||||
"renovation.panel.colors": "Umbau-Farben in den Ressourcen …",
|
||||
"resources.tab.renovation": "Umbau",
|
||||
"file.newFromUmbauSample": "Neu aus Vorlage: Beispiel Umbau",
|
||||
"menu.native.newFromUmbauSample": "Beispiel Umbau",
|
||||
|
||||
@@ -4703,6 +4703,29 @@ export const en: Record<TranslationKey, string> = {
|
||||
"renovation.styles.line": "Line",
|
||||
"renovation.styles.dashed": "dashed",
|
||||
"renovation.styles.reset": "Default",
|
||||
"renovation.panel.tab": "Renovation",
|
||||
"renovation.panel.draw.hint": "Applies to everything drawn from now on.",
|
||||
"renovation.panel.draw.status": "Status of new elements",
|
||||
"renovation.panel.filter.title": "Renovation filter of this view",
|
||||
"renovation.panel.filter.locked": "This view has no renovation filter of its own.",
|
||||
"renovation.panel.filter.preview": "Display in the filter",
|
||||
"renovation.show.show": "as drawn",
|
||||
"renovation.show.hide": "hidden",
|
||||
"renovation.show.override": "renovation color",
|
||||
"renovation.panel.selection.title": "Selection",
|
||||
"renovation.panel.selection.none": "No elements with a renovation status selected.",
|
||||
"renovation.panel.selection.count": "{n} elements selected",
|
||||
"renovation.panel.set": "Set to {status}",
|
||||
"renovation.panel.selectAll": "Select all {status} ({n})",
|
||||
"renovation.panel.selectBy": "Select by status",
|
||||
"renovation.panel.selectionPhase": "Phase of the selection",
|
||||
"renovation.panel.phases.name": "Phase name",
|
||||
"renovation.panel.phases.used": "{n} elements",
|
||||
"renovation.panel.phases.deleteTitle": "Delete phase",
|
||||
"renovation.panel.phases.deleteMessage": "Delete phase “{name}”? {n} elements lose their phase; their status stays.",
|
||||
"renovation.panel.phases.deleteMessageUnused": "Delete phase “{name}”?",
|
||||
"renovation.panel.phases.delete": "Delete",
|
||||
"renovation.panel.colors": "Renovation colors in the resources …",
|
||||
"resources.tab.renovation": "Renovation",
|
||||
"file.newFromUmbauSample": "New From Template: Renovation Example",
|
||||
"menu.native.newFromUmbauSample": "Renovation Example",
|
||||
|
||||
@@ -4,7 +4,10 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { applyOps } from "../core/ops";
|
||||
import { documentFor } from "../core/document";
|
||||
import { commonRenovation, renovationFilterList, renovationForNew, setPhasesOps, setRenovationOps } from "./renovation";
|
||||
import {
|
||||
commonRenovation, idsByRenovationStatus, phaseUsage, renovationCounts, renovationFilterList, renovationFilterShows, renovationForNew, renovationStyleOf, RENOVATION_STATUSES,
|
||||
setPhasesOps, setRenovationOps,
|
||||
} from "./renovation";
|
||||
import { buildUmbauSampleProject } from "./sampleProjectUmbau";
|
||||
import { sampleProject } from "./sampleProject";
|
||||
import { generatePlan } from "../plan/generatePlan";
|
||||
@@ -74,4 +77,47 @@ describe("[271] Umbau", () => {
|
||||
// Vorgabe Bestand: ohne Feld.
|
||||
expect(added(req)[0]).not.toHaveProperty("renovation");
|
||||
});
|
||||
|
||||
// ── Panel „Umbau“ ──
|
||||
it("Panel: Vorschau je Filter stimmt mit dem Grundriss des Kerns überein (Override = Farbe da, Hide/Show = keine)", () => {
|
||||
const p = buildUmbauSampleProject();
|
||||
const colour = { existing: "#a6a6a6", demolish: "#ffd800", new: "#e3001b" } as const;
|
||||
for (const f of renovationFilterList(p)) {
|
||||
const shows = renovationFilterShows(p, f.id)!;
|
||||
const got = fills(p, f.id);
|
||||
for (const st of RENOVATION_STATUSES) {
|
||||
expect(renovationStyleOf(p, st).fill).toBe(colour[st]);
|
||||
expect(got.includes(colour[st]), `${f.id}/${st}`).toBe(shows[st] === "override");
|
||||
}
|
||||
}
|
||||
expect(renovationFilterShows(p, "gibtsnicht")).toBeNull();
|
||||
const own = { ...p, renovation: { ...p.renovation, filters: [{ id: "x", name: "X", existing: "hide" as const, demolish: "show" as const, new: "override" as const }], styles: { new: { fill: "#00ff00" } } } };
|
||||
expect(renovationFilterShows(own, "x")).toEqual({ existing: "hide", demolish: "show", new: "override" });
|
||||
expect(renovationStyleOf(own, "new").fill).toBe("#00ff00");
|
||||
expect(renovationStyleOf(own, "new").dashed).toBe(false);
|
||||
});
|
||||
|
||||
it("Panel: Auswahl nach Status (Öffnung folgt der Wand), Geschoss- und Etappenfilter, Zählung", () => {
|
||||
const p = buildUmbauSampleProject();
|
||||
const dem = idsByRenovationStatus(p, "demolish");
|
||||
expect(dem.walls).toContain("W9");
|
||||
expect(dem.openings).toContain("O2");
|
||||
// Öffnung ohne eigenen Status: der Status ihrer Wand.
|
||||
const o = p.openings!.find((x) => !x.renovation)!;
|
||||
const host = p.walls.find((w) => w.id === o.hostWallId)!;
|
||||
expect(idsByRenovationStatus(p, host.renovation?.status ?? "existing").openings).toContain(o.id);
|
||||
expect(idsByRenovationStatus(p, "demolish", { floorId: "og-gibts-nicht" })).toEqual({});
|
||||
expect(idsByRenovationStatus(p, "demolish", { phase: "etappe-1" }).walls).toContain("W9");
|
||||
expect(idsByRenovationStatus(p, "demolish", { phase: "etappe-2" }).walls ?? []).not.toContain("W9");
|
||||
const n = renovationCounts(p);
|
||||
expect(n.demolish).toBeGreaterThan(0);
|
||||
expect(n.new).toBeGreaterThan(0);
|
||||
expect(n.existing + n.demolish + n.new).toBe(Object.values(idsByRenovationStatus(p, "existing")).flat().length + n.demolish + n.new);
|
||||
});
|
||||
|
||||
it("Panel: Etappen-Nutzung für die Rückfrage beim Löschen", () => {
|
||||
const p = buildUmbauSampleProject();
|
||||
expect(phaseUsage(p, "etappe-1")).toBeGreaterThan(0);
|
||||
expect(phaseUsage(p, "nix")).toBe(0);
|
||||
});
|
||||
});
|
||||
+81
-1
@@ -4,7 +4,7 @@
|
||||
import type { CoreOp } from "../core/ops";
|
||||
import { documentFor } from "../core/document";
|
||||
import { patchItems, setField } from "../core/opsBuild";
|
||||
import type { Project, Renovation, RenovationPhase, RenovationStatus } from "./types";
|
||||
import type { Project, Renovation, RenovationPhase, RenovationShow, RenovationStatus } from "./types";
|
||||
|
||||
/** Eingebaute Umbaufilter (Ids; Namen über `t("renovation.filter.<id>")`). */
|
||||
export const BUILTIN_RENOVATION_FILTERS = ["bestand", "abbruch", "neubau", "umbauplan", "endzustand"] as const;
|
||||
@@ -145,3 +145,83 @@ export function newPhaseId(project: Project): string {
|
||||
while (used.has(`etappe-${i}`)) i++;
|
||||
return `etappe-${i}`;
|
||||
}
|
||||
|
||||
// ── Panel „Umbau“ (Dock): Filter-Vorschau, Auswahl nach Status ─────────────────────────────────────────────
|
||||
|
||||
/** Eingebaute Filter: Darstellung je Status (Spiegel von `renovation::builtin` im Kern; `renovation.test.ts` prüft ihn gegen den Plan). */
|
||||
const BUILTIN_FILTER_SHOWS: Record<string, Record<RenovationStatus, RenovationShow>> = {
|
||||
bestand: { existing: "show", demolish: "show", new: "hide" },
|
||||
abbruch: { existing: "show", demolish: "override", new: "hide" },
|
||||
neubau: { existing: "show", demolish: "hide", new: "override" },
|
||||
umbauplan: { existing: "override", demolish: "override", new: "override" },
|
||||
endzustand: { existing: "show", demolish: "hide", new: "show" },
|
||||
};
|
||||
|
||||
/** Darstellung je Status im Filter `id` (eingebaut oder eigen); `null` bei unbekanntem Filter. */
|
||||
export function renovationFilterShows(project: Project, id: string): Record<RenovationStatus, RenovationShow> | null {
|
||||
const own = project.renovation?.filters?.find((f) => f.id === id);
|
||||
if (own) return { existing: own.existing, demolish: own.demolish, new: own.new };
|
||||
return BUILTIN_FILTER_SHOWS[id] ?? null;
|
||||
}
|
||||
|
||||
/** Umbau-Farbe eines Status (Projekt-Vorgabe über SIA-400-Vorgabe). */
|
||||
export function renovationStyleOf(project: Project, status: RenovationStatus): { fill: string; line?: string; dashed: boolean } {
|
||||
const d = DEFAULT_RENOVATION_STYLES[status];
|
||||
const o = project.renovation?.styles?.[status];
|
||||
return { fill: o?.fill ?? d.fill, line: o?.line ?? d.line, dashed: o?.dashed ?? d.dashed };
|
||||
}
|
||||
|
||||
/** Auswahl-Art je Liste (`extrudedSolids` heissen in der Auswahl `solids`). */
|
||||
const SELECTION_KEY: Record<RenovationCollection, string> = {
|
||||
walls: "walls",
|
||||
openings: "openings",
|
||||
ceilings: "ceilings",
|
||||
roofs: "roofs",
|
||||
stairs: "stairs",
|
||||
columns: "columns",
|
||||
extrudedSolids: "solids",
|
||||
rooms: "rooms",
|
||||
};
|
||||
|
||||
/**
|
||||
* Ids aller Elemente mit Status `status` (Öffnung ohne eigenen Status: der der Wand), je Auswahl-Art.
|
||||
* `floorId`: nur dieses Geschoss (Öffnungen über ihre Wand); `phase`: nur diese Etappe (`""` = ohne Etappe).
|
||||
*/
|
||||
export function idsByRenovationStatus(
|
||||
project: Project,
|
||||
status: RenovationStatus,
|
||||
opts: { floorId?: string | null; phase?: string } = {},
|
||||
): Record<string, string[]> {
|
||||
const out: Record<string, string[]> = {};
|
||||
const wallOf = new Map(project.walls.map((w) => [w.id, w]));
|
||||
for (const c of RENOVATION_COLLECTIONS) {
|
||||
const ids: string[] = [];
|
||||
for (const e of (project[c] ?? []) as { id: string; floorId?: string; hostWallId?: string; renovation?: Renovation }[]) {
|
||||
const wall = c === "openings" && e.hostWallId ? wallOf.get(e.hostWallId) : undefined;
|
||||
const floor = e.floorId ?? wall?.floorId;
|
||||
if (opts.floorId && floor && floor !== opts.floorId) continue;
|
||||
const r = e.renovation ?? wall?.renovation;
|
||||
if (renovationStatus(r) !== status) continue;
|
||||
if (opts.phase !== undefined && (r?.phase ?? "") !== opts.phase) continue;
|
||||
ids.push(e.id);
|
||||
}
|
||||
if (ids.length) out[SELECTION_KEY[c]] = ids;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/** Zahl der Elemente je Status (Öffnungen ohne eigenen Status zählen mit dem der Wand). */
|
||||
export function renovationCounts(project: Project, floorId?: string | null): Record<RenovationStatus, number> {
|
||||
const n: Record<RenovationStatus, number> = { existing: 0, demolish: 0, new: 0 };
|
||||
for (const s of RENOVATION_STATUSES) n[s] = Object.values(idsByRenovationStatus(project, s, { floorId })).reduce((a, v) => a + v.length, 0);
|
||||
return n;
|
||||
}
|
||||
|
||||
/** Zahl der Elemente, die Etappe `phaseId` tragen (für die Rückfrage beim Löschen). */
|
||||
export function phaseUsage(project: Project, phaseId: string): number {
|
||||
let n = 0;
|
||||
for (const c of RENOVATION_COLLECTIONS) {
|
||||
for (const e of (project[c] ?? []) as { renovation?: Renovation }[]) if (e.renovation?.phase === phaseId) n++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
@@ -0,0 +1,308 @@
|
||||
// Dock-Panel „Umbau“ ([271], Wunsch Maintainer 17.11., wie Archicads Palette Umbau): Zeichen-Status neuer Bauteile,
|
||||
// Umbaufilter der aktiven Ansicht (mit Vorschau je Status), Status der Auswahl samt „nach Status wählen“ und die
|
||||
// Etappen. Zustand und Aktionen teilt es mit dem Popover der Statusleiste (`state/renovationHook.ts`); Änderungen
|
||||
// gehen als Ops über `applyChange` (ein Undo-Schritt je Aktion).
|
||||
//
|
||||
// Bezeichner englisch, UI-Text/Kommentare deutsch (CONVENTIONS.md).
|
||||
|
||||
import { useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import type { TranslationKey } from "../i18n";
|
||||
import { useStore } from "../state/appStore";
|
||||
import { renovationFilterLabel, useRenovationControls, useRenovationSelection } from "../state/renovationHook";
|
||||
import {
|
||||
BUILTIN_RENOVATION_FILTERS,
|
||||
newPhaseId,
|
||||
phaseUsage,
|
||||
renovationCounts,
|
||||
renovationFilterShows,
|
||||
renovationStyleOf,
|
||||
RENOVATION_STATUSES,
|
||||
setPhasesOps,
|
||||
} from "../core";
|
||||
import type { Project, RenovationShow, RenovationStatus } from "../model/types";
|
||||
import { ConfirmDialog } from "../ui/ConfirmDialog";
|
||||
import { usePanelHostAction } from "./host";
|
||||
|
||||
const MIXED = "__mixed";
|
||||
|
||||
/** Farbfeld eines Status (SIA-Farbmuster: Füllung, Linie, gestrichelt wie im Plan). */
|
||||
function Swatch({ project, status, show }: { project: Project; status: RenovationStatus; show?: RenovationShow }) {
|
||||
const st = renovationStyleOf(project, status);
|
||||
const hidden = show === "hide";
|
||||
const plain = show === "show";
|
||||
return (
|
||||
<span
|
||||
className={`reno-swatch${hidden ? " is-hidden" : ""}${plain ? " is-plain" : ""}`}
|
||||
style={{
|
||||
background: hidden || plain ? "transparent" : st.fill,
|
||||
borderColor: st.line ?? "rgba(0,0,0,0.45)",
|
||||
borderStyle: st.dashed ? "dashed" : "solid",
|
||||
}}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function ShowChip({ project, status, show }: { project: Project; status: RenovationStatus; show: RenovationShow }) {
|
||||
return (
|
||||
<span className="reno-chip" data-testid={`reno-chip-${status}`} data-show={show}>
|
||||
<Swatch project={project} status={status} show={show} />
|
||||
<span className="reno-chip-text">
|
||||
<span className="reno-chip-status">{t(`renovation.status.${status}` as TranslationKey)}</span>
|
||||
<span className="reno-chip-show">{t(`renovation.show.${show}` as TranslationKey)}</span>
|
||||
</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
export function RenovationPanel() {
|
||||
const project = useStore((s) => s.project);
|
||||
const { levelEditable, draw, setDraw, phases, own, filter, filterPhase, setLevel } = useRenovationControls();
|
||||
const sel = useRenovationSelection();
|
||||
const applyChange = useStore((s) => s.applyChange);
|
||||
const openResources = usePanelHostAction("onOpenResources");
|
||||
const [confirmId, setConfirmId] = useState<string | null>(null);
|
||||
const counts = renovationCounts(project, sel.floorId);
|
||||
const shows = filter ? renovationFilterShows(project, filter) : null;
|
||||
const filterIds = ["", ...BUILTIN_RENOVATION_FILTERS, ...own.map((f) => f.id)];
|
||||
|
||||
const statusValue = sel.common.status === "mixed" || sel.common.status === null ? null : sel.common.status;
|
||||
const phaseValue = sel.common.phase === "mixed" ? MIXED : (sel.common.phase ?? "");
|
||||
|
||||
const setPhases = (next: { id: string; name: string }[], key?: string) => applyChange((p) => setPhasesOps(p, next), key);
|
||||
const move = (i: number, d: number) => {
|
||||
const j = i + d;
|
||||
if (j < 0 || j >= phases.length) return;
|
||||
const next = [...phases];
|
||||
[next[i], next[j]] = [next[j], next[i]];
|
||||
setPhases(next);
|
||||
};
|
||||
const confirmPhase = confirmId ? phases.find((p) => p.id === confirmId) : undefined;
|
||||
const confirmUsage = confirmPhase ? phaseUsage(project, confirmPhase.id) : 0;
|
||||
|
||||
return (
|
||||
<section className="reno-panel" data-testid="renovation-dock">
|
||||
{/* Neue Bauteile zeichnen als */}
|
||||
<div className="reno-block">
|
||||
<div className="reno-head">{t("renovation.drawStatus")}</div>
|
||||
<div className="reno-status-row" role="radiogroup" aria-label={t("renovation.panel.draw.status")}>
|
||||
{RENOVATION_STATUSES.map((s) => (
|
||||
<button
|
||||
key={s}
|
||||
type="button"
|
||||
role="radio"
|
||||
aria-checked={draw.status === s}
|
||||
className={`reno-status-btn${draw.status === s ? " active" : ""}`}
|
||||
data-testid={`reno-draw-${s}`}
|
||||
onClick={() => setDraw(s, draw.phase)}
|
||||
>
|
||||
<Swatch project={project} status={s} />
|
||||
<span>{t(`renovation.status.${s}` as TranslationKey)}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
{phases.length > 0 && (
|
||||
<label className="reno-field">
|
||||
<span>{t("renovation.phase")}</span>
|
||||
<select value={draw.phase ?? ""} data-testid="reno-draw-phase" onChange={(e) => setDraw(draw.status, e.target.value || undefined)}>
|
||||
<option value="">{t("renovation.phase.none")}</option>
|
||||
{phases.map((p) => (
|
||||
<option key={p.id} value={p.id}>
|
||||
{p.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
<div className="reno-hint">{t("renovation.panel.draw.hint")}</div>
|
||||
</div>
|
||||
|
||||
{/* Umbaufilter der aktiven Ansicht */}
|
||||
<div className="reno-block">
|
||||
<div className="reno-head">{t("renovation.panel.filter.title")}</div>
|
||||
{!levelEditable && <div className="reno-hint">{t("renovation.panel.filter.locked")}</div>}
|
||||
<ul className="reno-filters" role="radiogroup" aria-label={t("renovation.filter")}>
|
||||
{filterIds.map((id) => {
|
||||
const fs = id ? renovationFilterShows(project, id) : null;
|
||||
return (
|
||||
<li key={id || "none"}>
|
||||
<button
|
||||
type="button"
|
||||
role="radio"
|
||||
aria-checked={filter === id}
|
||||
disabled={!levelEditable}
|
||||
className={`reno-filter${filter === id ? " active" : ""}`}
|
||||
data-testid={`reno-filter-${id || "none"}`}
|
||||
onClick={() => setLevel({ renovationFilter: id || undefined, renovationPhase: filterPhase || undefined })}
|
||||
>
|
||||
<span className="reno-filter-name">{id ? renovationFilterLabel(id, own) : t("renovation.filter.none")}</span>
|
||||
<span className="reno-filter-sw">
|
||||
{fs && RENOVATION_STATUSES.map((s) => <Swatch key={s} project={project} status={s} show={fs[s]} />)}
|
||||
</span>
|
||||
</button>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
{phases.length > 0 && filter && (
|
||||
<label className="reno-field">
|
||||
<span>{t("renovation.filterPhase")}</span>
|
||||
<select
|
||||
value={filterPhase}
|
||||
disabled={!levelEditable}
|
||||
data-testid="reno-filter-phase"
|
||||
onChange={(e) => setLevel({ renovationFilter: filter, renovationPhase: e.target.value || undefined })}
|
||||
>
|
||||
<option value="">{t("renovation.phase.all")}</option>
|
||||
{phases.map((p) => (
|
||||
<option key={p.id} value={p.id}>
|
||||
{p.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
{shows && (
|
||||
<div className="reno-preview" aria-label={t("renovation.panel.filter.preview")} data-testid="reno-preview">
|
||||
{RENOVATION_STATUSES.map((s) => (
|
||||
<ShowChip key={s} project={project} status={s} show={shows[s]} />
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Auswahl */}
|
||||
<div className="reno-block">
|
||||
<div className="reno-head">{t("renovation.panel.selection.title")}</div>
|
||||
{sel.ids.length === 0 ? (
|
||||
<div className="reno-hint" data-testid="reno-sel-none">
|
||||
{t("renovation.panel.selection.none")}
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<div className="reno-sel-state" data-testid="reno-sel-state" data-status={statusValue ?? "mixed"}>
|
||||
{statusValue ? <Swatch project={project} status={statusValue} /> : <span className="reno-swatch is-mixed" aria-hidden="true" />}
|
||||
<span>{statusValue ? t(`renovation.status.${statusValue}` as TranslationKey) : t("renovation.mixed")}</span>
|
||||
<span className="reno-sel-count">{t("renovation.panel.selection.count", { n: String(sel.ids.length) })}</span>
|
||||
</div>
|
||||
<div className="reno-status-row">
|
||||
{RENOVATION_STATUSES.map((s) => (
|
||||
<button
|
||||
key={s}
|
||||
type="button"
|
||||
className={`reno-status-btn small${statusValue === s ? " active" : ""}`}
|
||||
data-testid={`reno-set-${s}`}
|
||||
onClick={() => sel.setStatus(s)}
|
||||
>
|
||||
<Swatch project={project} status={s} />
|
||||
<span>{t("renovation.panel.set", { status: t(`renovation.status.${s}` as TranslationKey) })}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
{phases.length > 0 && (
|
||||
<label className="reno-field">
|
||||
<span>{t("renovation.panel.selectionPhase")}</span>
|
||||
<select
|
||||
value={phaseValue}
|
||||
data-testid="reno-sel-phase"
|
||||
onChange={(e) => e.target.value !== MIXED && sel.setPhase(e.target.value || null)}
|
||||
>
|
||||
{phaseValue === MIXED && <option value={MIXED}>{t("renovation.mixed")}</option>}
|
||||
<option value="">{t("renovation.phase.none")}</option>
|
||||
{phases.map((p) => (
|
||||
<option key={p.id} value={p.id}>
|
||||
{p.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
<div className="reno-head sub">{t("renovation.panel.selectBy")}</div>
|
||||
<div className="reno-select-by">
|
||||
{RENOVATION_STATUSES.map((s) => (
|
||||
<button
|
||||
key={s}
|
||||
type="button"
|
||||
className="reno-link-btn"
|
||||
disabled={counts[s] === 0}
|
||||
data-testid={`reno-select-${s}`}
|
||||
onClick={() => sel.selectByStatus(s)}
|
||||
>
|
||||
<Swatch project={project} status={s} />
|
||||
{t("renovation.panel.selectAll", { status: t(`renovation.status.${s}` as TranslationKey), n: String(counts[s]) })}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Etappen */}
|
||||
<div className="reno-block">
|
||||
<div className="reno-head">{t("renovation.phases.title")}</div>
|
||||
{phases.length === 0 && <div className="reno-hint">{t("renovation.phases.empty")}</div>}
|
||||
{phases.map((ph, i) => (
|
||||
<div className="reno-phase-row" key={ph.id} data-testid="reno-phase-row">
|
||||
<input
|
||||
type="text"
|
||||
value={ph.name}
|
||||
aria-label={t("renovation.panel.phases.name")}
|
||||
data-testid="reno-phase-name"
|
||||
onChange={(e) => setPhases(phases.map((x) => (x.id === ph.id ? { ...x, name: e.target.value } : x)), `reno-phase-${ph.id}`)}
|
||||
/>
|
||||
<button type="button" className="reno-icon-btn" disabled={i === 0} title={t("renovation.phases.up")} aria-label={t("renovation.phases.up")} onClick={() => move(i, -1)}>
|
||||
▲
|
||||
</button>
|
||||
<button type="button" className="reno-icon-btn" disabled={i === phases.length - 1} title={t("renovation.phases.down")} aria-label={t("renovation.phases.down")} onClick={() => move(i, 1)}>
|
||||
▼
|
||||
</button>
|
||||
<button type="button" className="reno-icon-btn" title={t("renovation.phases.remove")} aria-label={t("renovation.phases.remove")} data-testid="reno-phase-remove" onClick={() => setConfirmId(ph.id)}>
|
||||
✕
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
<button
|
||||
type="button"
|
||||
className="reno-add-btn"
|
||||
data-testid="reno-phase-add"
|
||||
onClick={() => setPhases([...phases, { id: newPhaseId(project), name: t("renovation.phases.defaultName", { n: String(phases.length + 1) }) }])}
|
||||
>
|
||||
{t("renovation.phases.add")}
|
||||
</button>
|
||||
<button type="button" className="reno-link-btn" data-testid="reno-open-colors" onClick={() => openResources("renovation")}>
|
||||
{t("renovation.panel.colors")}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{confirmPhase && (
|
||||
<ConfirmDialog
|
||||
title={t("renovation.panel.phases.deleteTitle")}
|
||||
message={
|
||||
confirmUsage > 0
|
||||
? t("renovation.panel.phases.deleteMessage", { name: confirmPhase.name, n: String(confirmUsage) })
|
||||
: t("renovation.panel.phases.deleteMessageUnused", { name: confirmPhase.name })
|
||||
}
|
||||
confirmLabel={t("renovation.panel.phases.delete")}
|
||||
danger
|
||||
onClose={() => setConfirmId(null)}
|
||||
onConfirm={() => {
|
||||
setPhases(phases.filter((x) => x.id !== confirmPhase.id));
|
||||
setConfirmId(null);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
/** Reiter-Symbol: Wand in drei Status (voll, gestrichelt, Umriss) — Bestand, Abbruch, Neu. */
|
||||
export function RenovationTabIcon() {
|
||||
return (
|
||||
<svg width={16} height={16} viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth={1.4} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" focusable="false">
|
||||
<rect x="2" y="2.5" width="12" height="3" fill="currentColor" fillOpacity="0.45" />
|
||||
<rect x="2" y="6.5" width="12" height="3" strokeDasharray="2 1.6" />
|
||||
<rect x="2" y="10.5" width="12" height="3" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import { LayoutsPanel, LayoutsTabIcon } from "./LayoutsPanel";
|
||||
import { BcfPanel } from "./BcfPanel";
|
||||
import { ClashPanel } from "./ClashPanel";
|
||||
import { HistoryPanel } from "./HistoryPanel";
|
||||
import { RenovationPanel, RenovationTabIcon } from "./RenovationPanel";
|
||||
import { ObjectSettingsPanel } from "./objectSettings/ObjectSettingsPanel";
|
||||
import {
|
||||
ToolsTabIcon,
|
||||
@@ -59,6 +60,7 @@ export const BUILTIN_PANEL_IDS = {
|
||||
history: "history",
|
||||
objectSettings: "object-settings",
|
||||
objectLibrary: "object-library",
|
||||
renovation: "renovation",
|
||||
} as const;
|
||||
|
||||
// Werkzeug-Palette (Symbol + Name je Werkzeug, ArchiCAD/Vectorworks-Stil).
|
||||
@@ -209,3 +211,13 @@ registerPanel({
|
||||
hasDisplayMode: false,
|
||||
render: () => <ObjectSettingsPanel />,
|
||||
});
|
||||
|
||||
// Umbau ([271], Wunsch Maintainer 17.11.): Zeichen-Status, Umbaufilter der Ansicht, Status der Auswahl, Etappen.
|
||||
// Im Standard-Layout rechts oben neben Objekt-Info und Flächenbilanz.
|
||||
registerPanel({
|
||||
id: BUILTIN_PANEL_IDS.renovation,
|
||||
title: "renovation.panel.tab",
|
||||
icon: <RenovationTabIcon />,
|
||||
hasDisplayMode: false,
|
||||
render: () => <RenovationPanel />,
|
||||
});
|
||||
@@ -45,6 +45,7 @@ import type { TerrainOptions } from "../model/terrain";
|
||||
import type { TextStylePreset } from "../text/richText";
|
||||
import type { ScheduleKind } from "../export/exportSchedule";
|
||||
import type { DetailLevel } from "../model/viewTypes";
|
||||
import type { TabId as ResourceTabId } from "../ui/ResourceManager";
|
||||
|
||||
// ── Darstellungsmodus-Steuerung je Dock-Inhalt ────────────────────────────
|
||||
|
||||
@@ -140,6 +141,8 @@ export interface PanelHostValue {
|
||||
* unter Tauri als natives Fenster, sonst als In-App-Dialog (App.openSettings).
|
||||
* Erreichbar über „Fenster"-Menü (AppMenuBar/native Menüleiste). */
|
||||
onOpenSettings: () => void;
|
||||
/** Öffnet die Ressourcen (unter Tauri das Nebenfenster), optional auf einem Tab, z. B. `"renovation"` ([271]). */
|
||||
onOpenResources: (tab?: ResourceTabId) => void;
|
||||
|
||||
// Ressourcen-Handler (Bauteile / Schraffuren / Linienstile). Spiegelt
|
||||
// ResourceManagerHandlers, hier flach getippt, damit dieses Modul nicht von
|
||||
|
||||
@@ -47,7 +47,8 @@ import type {
|
||||
// Flächenbilanz mit Raumprogramm war nur ~300 px hoch). Die Höhe merkt sich der Gruppen-Splitter (`resizeGroups`).
|
||||
// v14 ([253]): Objekt-Bibliothek ("object-library") als Tab neben den Werkzeugen links oben.
|
||||
// v15 ([253]): links oben (Werkzeuge/Objekte) bekommt mehr Höhe: Gewichte 1,6 : 1 (die Objekt-Palette war im 900-px-Fenster nur ~270 px hoch).
|
||||
export const LAYOUT_VERSION = 15;
|
||||
// v16 ([271]): Umbau-Panel ("renovation") als Tab rechts oben neben Objekt-Info und Flächenbilanz.
|
||||
export const LAYOUT_VERSION = 16;
|
||||
|
||||
/** localStorage-Schlüssel des zuletzt benutzten Layouts. */
|
||||
const CURRENT_KEY = "cad.layout";
|
||||
@@ -79,7 +80,7 @@ const DEFAULT_LEFT_GROUPS: DockGroup[] = [
|
||||
{ tabs: ["attributes"], activeTab: "attributes", weight: 1 },
|
||||
];
|
||||
const DEFAULT_RIGHT_GROUPS: DockGroup[] = [
|
||||
{ tabs: ["object-info", "room-balance"], activeTab: "object-info", weight: 1.6 },
|
||||
{ tabs: ["object-info", "room-balance", "renovation"], activeTab: "object-info", weight: 1.6 },
|
||||
{
|
||||
tabs: ["drawing-levels", "layers", "site", "elements", "view-snapshots", "layouts"],
|
||||
activeTab: "drawing-levels",
|
||||
|
||||
@@ -1,30 +1,23 @@
|
||||
// [271] Objekt-Info und Objekteinstellungen: „Umbau“ — Status (Bestand, Abbruch, Neu) und Etappe der Auswahl.
|
||||
// Mehrfachauswahl: alle gewählten Bauteile in einem Undo-Schritt; verschiedene Werte zeigen „gemischt“.
|
||||
|
||||
import { useMemo } from "react";
|
||||
import { memo } from "react";
|
||||
import { t } from "../../i18n";
|
||||
import type { RenovationStatus } from "../../model/types";
|
||||
import { commonRenovation, renovatableIds, renovationPhases, RENOVATION_STATUSES, setRenovationOps } from "../../core";
|
||||
import { RENOVATION_STATUSES } from "../../core";
|
||||
import { useStore } from "../../state/appStore";
|
||||
import type { Selection } from "../../state/selection";
|
||||
import { useRenovationSelection } from "../../state/renovationHook";
|
||||
import { Dropdown } from "../../ui/Dropdown";
|
||||
|
||||
const NO_PHASES: readonly { id: string; name: string }[] = [];
|
||||
const MIXED = "__mixed";
|
||||
const NO_PHASE = "";
|
||||
|
||||
/** Ids der Auswahl, die einen Umbau-Status tragen (Wände, Öffnungen, Decken, Dächer, Treppen, Stützen, Körper, Räume). */
|
||||
export function selectionRenovationIds(sel: Selection): string[] {
|
||||
return [...sel.walls, ...sel.openings, ...sel.ceilings, ...sel.roofs, ...sel.stairs, ...sel.columns, ...sel.solids, ...sel.rooms];
|
||||
}
|
||||
|
||||
export function RenovationField() {
|
||||
const project = useStore((s) => s.project);
|
||||
const selection = useStore((s) => s.selection);
|
||||
const applyChange = useStore((s) => s.applyChange);
|
||||
const ids = useMemo(() => renovatableIds(project, selectionRenovationIds(selection)), [project, selection]);
|
||||
const common = useMemo(() => commonRenovation(project, ids), [project, ids]);
|
||||
/** `memo`: ohne Props rendert das Feld nur bei geänderter Auswahl/Status neu, nicht bei jeder Op des Eltern-Panels ([121]). */
|
||||
export const RenovationField = memo(function RenovationField() {
|
||||
const phases = useStore((s) => s.project.renovation?.phases) ?? NO_PHASES;
|
||||
const { ids, common, setStatus, setPhase } = useRenovationSelection();
|
||||
if (ids.length === 0) return null;
|
||||
const phases = renovationPhases(project);
|
||||
const statusValue = common.status === "mixed" || common.status === null ? MIXED : common.status;
|
||||
const phaseValue = common.phase === "mixed" ? MIXED : (common.phase ?? NO_PHASE);
|
||||
const statusOptions = [
|
||||
@@ -44,7 +37,7 @@ export function RenovationField() {
|
||||
value={statusValue}
|
||||
onChange={(v) => {
|
||||
if (v === MIXED) return;
|
||||
applyChange((p) => setRenovationOps(p, ids, v as RenovationStatus));
|
||||
setStatus(v as RenovationStatus);
|
||||
}}
|
||||
options={statusOptions}
|
||||
title={t("renovation.label")}
|
||||
@@ -58,7 +51,7 @@ export function RenovationField() {
|
||||
value={phaseValue}
|
||||
onChange={(v) => {
|
||||
if (v === MIXED) return;
|
||||
applyChange((p) => setRenovationOps(p, ids, undefined, v === NO_PHASE ? null : v));
|
||||
setPhase(v === NO_PHASE ? null : v);
|
||||
}}
|
||||
options={phaseOptions}
|
||||
title={t("renovation.phase")}
|
||||
@@ -68,4 +61,4 @@ export function RenovationField() {
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -9,7 +9,7 @@ import { openLevel } from "../tabNavigation";
|
||||
import type { FlatHostOpts, HostPart } from "./types";
|
||||
|
||||
export function buildToolsHost(c: FlatHostOpts) {
|
||||
const { activeCategoryCode, activeLevel, activeLevelId, activeTool, activeWallTypeId, addCategory, addCeiling, addCeilingType, addComponent, addDrawing, addElevation, addFloor, addHatch, addLineStyle, addRoofType, addSection, addTextStyle, addWallType, deleteCeilingType, deleteComponent, deleteHatch, deleteLineStyle, deleteRoofType, deleteTextStyle, deleteWallType, engineView, importHatches, importLineStyles, onRunCommand, onSelectTool, openLayerSettings, openSettings, patchCeilingType, patchComponent, patchHatch, patchLineStyle, patchRoofType, patchTextStyle, patchWallType, setActiveCategoryCode, setActiveWallTypeId, setMenu, setSnap, snap, toggleCategoryVisible, toggleLevelVisible } = c;
|
||||
const { activeCategoryCode, activeLevel, activeLevelId, activeTool, activeWallTypeId, addCategory, addCeiling, addCeilingType, addComponent, addDrawing, addElevation, addFloor, addHatch, addLineStyle, addRoofType, addSection, addTextStyle, addWallType, deleteCeilingType, deleteComponent, deleteHatch, deleteLineStyle, deleteRoofType, deleteTextStyle, deleteWallType, engineView, importHatches, importLineStyles, onRunCommand, onSelectTool, openLayerSettings, openResources, openSettings, patchCeilingType, patchComponent, patchHatch, patchLineStyle, patchRoofType, patchTextStyle, patchWallType, setActiveCategoryCode, setActiveWallTypeId, setMenu, setSnap, snap, toggleCategoryVisible, toggleLevelVisible } = c;
|
||||
return {
|
||||
activeLevelId,
|
||||
activeTool,
|
||||
@@ -44,6 +44,7 @@ export function buildToolsHost(c: FlatHostOpts) {
|
||||
if (isTauriRuntime()) void openDrawingLevelsWindowNative();
|
||||
},
|
||||
onOpenSettings: () => openSettings(),
|
||||
onOpenResources: (tab) => openResources(tab),
|
||||
onPatchComponent: patchComponent,
|
||||
onAddComponent: addComponent,
|
||||
onDeleteComponent: deleteComponent,
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
// [271] Umbau: gemeinsamer Zustand und gemeinsame Aktionen für das Dock-Panel „Umbau“ und das Statusleisten-Popover
|
||||
// (ein Ort, keine Doppelspur): Zeichen-Status neuer Bauteile, Umbaufilter und Etappe der aktiven Ansicht (Felder der
|
||||
// Zeichnungsebene wie die Modelldarstellung [173], darum je Reiter eigen und mit Undo), Status der Auswahl.
|
||||
|
||||
import { useCallback, useMemo } from "react";
|
||||
import { t } from "../i18n";
|
||||
import type { TranslationKey } from "../i18n";
|
||||
import { getState, useStore } from "./appStore";
|
||||
import { EMPTY_SELECTION } from "./selection";
|
||||
import type { Selection } from "./selection";
|
||||
import {
|
||||
BUILTIN_RENOVATION_FILTERS,
|
||||
commonRenovation,
|
||||
idsByRenovationStatus,
|
||||
patchItem,
|
||||
setRenovationOps,
|
||||
} from "../core";
|
||||
import type { RenovationStatus } from "../model/types";
|
||||
|
||||
/** Anzeigename eines Filters (eingebaut übersetzt, eigene mit ihrem Namen). */
|
||||
export function renovationFilterLabel(id: string, own: readonly { id: string; name: string }[]): string {
|
||||
if ((BUILTIN_RENOVATION_FILTERS as readonly string[]).includes(id)) return t(`renovation.filter.${id}` as TranslationKey);
|
||||
return own.find((f) => f.id === id)?.name ?? id;
|
||||
}
|
||||
|
||||
/** Ids der Auswahl, die einen Umbau-Status tragen (Wände, Öffnungen, Decken, Dächer, Treppen, Stützen, Körper, Räume). */
|
||||
export function selectionRenovationIds(sel: Selection): string[] {
|
||||
return [...sel.walls, ...sel.openings, ...sel.ceilings, ...sel.roofs, ...sel.stairs, ...sel.columns, ...sel.solids, ...sel.rooms];
|
||||
}
|
||||
|
||||
const NO_PHASES: readonly { id: string; name: string }[] = [];
|
||||
const NO_FILTERS: readonly { id: string; name: string }[] = [];
|
||||
|
||||
/**
|
||||
* Zeichen-Status, Filter/Etappe der aktiven Ansicht und deren Setzer. Liest bewusst nur schmale Teile des Projekts
|
||||
* (Ebene, Etappen, eigene Filter), damit Statusleiste und Panel nicht bei jeder Op neu rendern ([121]).
|
||||
*/
|
||||
export function useRenovationControls() {
|
||||
const level = useStore((s) => s.project.drawingLevels.find((l) => l.id === s.activeLevelId));
|
||||
const rPhases = useStore((s) => s.project.renovation?.phases);
|
||||
const rFilters = useStore((s) => s.project.renovation?.filters);
|
||||
const draw = useStore((s) => s.drawRenovation);
|
||||
const setDraw = useStore((s) => s.setDrawRenovation);
|
||||
const applyChange = useStore((s) => s.applyChange);
|
||||
const phases = rPhases ?? NO_PHASES;
|
||||
const own = rFilters ?? NO_FILTERS;
|
||||
const filter = level?.renovationFilter ?? "";
|
||||
const levelEditable = !!level && (level.kind === "floor" || level.kind === "section" || level.kind === "elevation" || level.kind === "ceiling");
|
||||
const setLevel = useCallback(
|
||||
(patch: { renovationFilter?: string; renovationPhase?: string }) => {
|
||||
if (!level) return;
|
||||
applyChange((p) =>
|
||||
patchItem(p, "drawingLevels", level.id, (l) => {
|
||||
const next = { ...l, ...patch };
|
||||
if (!next.renovationFilter) delete next.renovationFilter;
|
||||
if (!next.renovationPhase || !next.renovationFilter) delete next.renovationPhase;
|
||||
return next;
|
||||
}),
|
||||
);
|
||||
},
|
||||
[level, applyChange],
|
||||
);
|
||||
return { level, levelEditable, draw, setDraw, phases, own, filter, filterPhase: level?.renovationPhase ?? "", setLevel };
|
||||
}
|
||||
|
||||
/** Status der Auswahl und Aktionen darauf (setzen: ein Undo-Schritt; nach Status wählen). Ohne Projekt-Abonnement. */
|
||||
export function useRenovationSelection() {
|
||||
const selection = useStore((s) => s.selection);
|
||||
const applyChange = useStore((s) => s.applyChange);
|
||||
const setSelection = useStore((s) => s.setSelection);
|
||||
const ids = useMemo(() => selectionRenovationIds(selection), [selection]);
|
||||
// Gemeinsamer Status/Etappe als Text: rendert nur bei echter Änderung neu, nicht bei jeder Op.
|
||||
const key = useStore((s) => JSON.stringify(commonRenovation(s.project, selectionRenovationIds(s.selection))));
|
||||
const common = useMemo(() => JSON.parse(key) as ReturnType<typeof commonRenovation>, [key]);
|
||||
const floorId = useStore((s) => (s.project.drawingLevels.find((l) => l.id === s.activeLevelId)?.kind === "floor" ? s.activeLevelId : null));
|
||||
const setStatus = (status: RenovationStatus) => applyChange((p) => setRenovationOps(p, ids, status));
|
||||
const setPhase = (phase: string | null) => applyChange((p) => setRenovationOps(p, ids, undefined, phase));
|
||||
/** Alle Bauteile des Geschosses mit Status `status` wählen; liefert die Zahl. */
|
||||
const selectByStatus = (status: RenovationStatus) => {
|
||||
const found = idsByRenovationStatus(getState().project, status, { floorId });
|
||||
setSelection({ ...EMPTY_SELECTION, ...found });
|
||||
return Object.values(found).reduce((a, v) => a + v.length, 0);
|
||||
};
|
||||
return { ids, common, floorId, setStatus, setPhase, selectByStatus };
|
||||
}
|
||||
+242
@@ -9656,3 +9656,245 @@ body {
|
||||
}
|
||||
.quick-guide-body hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
|
||||
.quick-guide-body img { display: block; max-width: 100%; height: auto; margin: 6px 0 12px; background: #fff; border: 1px solid var(--line); }
|
||||
|
||||
/* ── [271] Dock-Panel „Umbau“ ─────────────────────────────────────────────────────────────────────── */
|
||||
.reno-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
padding: 4px 8px 10px;
|
||||
font-size: 12px;
|
||||
color: var(--ink);
|
||||
}
|
||||
.reno-block {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 5px;
|
||||
padding: 6px 0;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.reno-block:last-of-type {
|
||||
border-bottom: 0;
|
||||
}
|
||||
.reno-head {
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
color: var(--muted);
|
||||
}
|
||||
.reno-head.sub {
|
||||
margin-top: 4px;
|
||||
}
|
||||
.reno-hint {
|
||||
color: var(--ink-2);
|
||||
font-size: 11px;
|
||||
}
|
||||
.reno-swatch {
|
||||
display: inline-block;
|
||||
flex: 0 0 auto;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
box-sizing: border-box;
|
||||
border: 1.5px solid rgba(0, 0, 0, 0.45);
|
||||
border-radius: 3px;
|
||||
}
|
||||
.reno-swatch.is-plain {
|
||||
border-color: var(--ink-2) !important;
|
||||
border-style: solid !important;
|
||||
}
|
||||
.reno-swatch.is-hidden {
|
||||
border-style: dotted !important;
|
||||
border-color: var(--muted) !important;
|
||||
opacity: 0.6;
|
||||
}
|
||||
.reno-swatch.is-mixed {
|
||||
background: repeating-linear-gradient(45deg, #a6a6a6 0 3px, #ffd800 3px 6px, #e3001b 6px 9px);
|
||||
}
|
||||
.reno-status-row {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.reno-status-btn {
|
||||
flex: 1 1 70px;
|
||||
min-height: 30px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
padding: 3px 8px;
|
||||
font: inherit;
|
||||
font-weight: 600;
|
||||
color: var(--ink);
|
||||
background: var(--input);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.reno-status-btn.small {
|
||||
min-height: 28px;
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.reno-status-btn:hover {
|
||||
border-color: var(--accent-border);
|
||||
}
|
||||
.reno-status-btn.active {
|
||||
background: var(--active-dim);
|
||||
border-color: var(--active);
|
||||
box-shadow: inset 0 0 0 1px var(--active);
|
||||
}
|
||||
.reno-field {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
.reno-field select,
|
||||
.reno-phase-row input {
|
||||
min-width: 0;
|
||||
flex: 1 1 auto;
|
||||
max-width: 160px;
|
||||
font: inherit;
|
||||
color: var(--ink);
|
||||
background: var(--input);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
padding: 3px 6px;
|
||||
}
|
||||
.reno-filters {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
.reno-filter {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
padding: 2px 8px;
|
||||
font: inherit;
|
||||
color: var(--ink);
|
||||
background: transparent;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
}
|
||||
.reno-filter:hover:not(:disabled) {
|
||||
background: var(--accent-dim);
|
||||
}
|
||||
.reno-filter.active {
|
||||
background: var(--active-dim);
|
||||
border-color: var(--active);
|
||||
font-weight: 600;
|
||||
}
|
||||
.reno-filter:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: default;
|
||||
}
|
||||
.reno-filter-sw {
|
||||
display: inline-flex;
|
||||
gap: 3px;
|
||||
}
|
||||
.reno-preview {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
padding: 4px 8px;
|
||||
background: var(--accent-dim);
|
||||
border-radius: 8px;
|
||||
}
|
||||
.reno-chip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 11px;
|
||||
}
|
||||
.reno-chip-text {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex: 1 1 auto;
|
||||
gap: 8px;
|
||||
}
|
||||
.reno-chip-show {
|
||||
color: var(--ink-2);
|
||||
}
|
||||
.reno-sel-state {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.reno-sel-count {
|
||||
margin-left: auto;
|
||||
font-weight: 400;
|
||||
color: var(--ink-2);
|
||||
}
|
||||
.reno-select-by {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
.reno-link-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 3px 6px;
|
||||
font: inherit;
|
||||
color: var(--ink);
|
||||
background: transparent;
|
||||
border: 0;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
}
|
||||
.reno-link-btn:hover:not(:disabled) {
|
||||
background: var(--accent-dim);
|
||||
}
|
||||
.reno-link-btn:disabled {
|
||||
opacity: 0.45;
|
||||
cursor: default;
|
||||
}
|
||||
.reno-phase-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
.reno-phase-row input {
|
||||
max-width: none;
|
||||
}
|
||||
.reno-icon-btn {
|
||||
flex: 0 0 auto;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
font-size: 10px;
|
||||
color: var(--ink-2);
|
||||
background: transparent;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.reno-icon-btn:hover:not(:disabled) {
|
||||
border-color: var(--accent-border);
|
||||
color: var(--ink);
|
||||
}
|
||||
.reno-icon-btn:disabled {
|
||||
opacity: 0.35;
|
||||
cursor: default;
|
||||
}
|
||||
.reno-add-btn {
|
||||
align-self: flex-start;
|
||||
padding: 4px 10px;
|
||||
font: inherit;
|
||||
color: var(--ink);
|
||||
background: var(--input);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 999px;
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// Allgemeine Rückfrage als Overlay-Dialog (Ersatz für `window.confirm`, im Tauri-WKWebView stumm). Muster wie
|
||||
// `PromptDialog`: abgedunkeltes Overlay, Klick daneben und Esc schliessen. Gerendert im Body-Portal, damit Panels mit
|
||||
// eigener Überlagerung ihn nicht beschneiden.
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { t } from "../i18n";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
|
||||
export interface ConfirmDialogProps {
|
||||
title: string;
|
||||
message: string;
|
||||
/** Beschriftung des bestätigenden Knopfs (z. B. „Löschen“). */
|
||||
confirmLabel: string;
|
||||
/** Riskante Aktion: bestätigender Knopf mit roter Kontur. */
|
||||
danger?: boolean;
|
||||
onConfirm: () => void;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
export function ConfirmDialog({ title, message, confirmLabel, danger, onConfirm, onClose }: ConfirmDialogProps) {
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onClose();
|
||||
};
|
||||
window.addEventListener("keydown", onKey);
|
||||
return () => window.removeEventListener("keydown", onKey);
|
||||
}, [onClose]);
|
||||
return createPortal(
|
||||
<div className="imp-overlay" onClick={onClose}>
|
||||
<div className="imp-dialog" ref={dialogRef} role="alertdialog" aria-modal="true" aria-label={title} data-testid="confirm-dialog" onClick={(e) => e.stopPropagation()}>
|
||||
<header className="imp-head">
|
||||
<span className="imp-head-title">{title}</span>
|
||||
<button className="imp-close" onClick={onClose} aria-label={t("export.close")}>
|
||||
×
|
||||
</button>
|
||||
</header>
|
||||
<div className="imp-body">
|
||||
<section className="imp-section">{message}</section>
|
||||
</div>
|
||||
<footer className="imp-foot">
|
||||
<button className="imp-btn" onClick={onClose}>
|
||||
{t("export.cancel")}
|
||||
</button>
|
||||
<button className={`imp-btn ${danger ? "danger" : "primary"}`} data-autofocus data-testid="confirm-dialog-ok" onClick={onConfirm}>
|
||||
{confirmLabel}
|
||||
</button>
|
||||
</footer>
|
||||
</div>
|
||||
</div>,
|
||||
document.body,
|
||||
);
|
||||
}
|
||||
@@ -3,25 +3,17 @@
|
||||
// Modelldarstellung ein Feld der Ebene, darum je Reiter/Ausschnitt eigen und mit Undo). Bei wenig Platz wandert es
|
||||
// mit der Pausfolie in „⋯“ ([263]).
|
||||
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import type { TranslationKey } from "../i18n";
|
||||
import { useStore } from "../state/appStore";
|
||||
import { BUILTIN_RENOVATION_FILTERS, patchItem, renovationPhases, RENOVATION_STATUSES } from "../core";
|
||||
import { renovationFilterLabel, useRenovationControls } from "../state/renovationHook";
|
||||
import { BUILTIN_RENOVATION_FILTERS, RENOVATION_STATUSES } from "../core";
|
||||
import type { RenovationStatus } from "../model/types";
|
||||
|
||||
/** Anzeigename eines Filters (eingebaut übersetzt, eigene mit ihrem Namen). */
|
||||
export function renovationFilterLabel(id: string, own: readonly { id: string; name: string }[]): string {
|
||||
if ((BUILTIN_RENOVATION_FILTERS as readonly string[]).includes(id)) return t(`renovation.filter.${id}` as TranslationKey);
|
||||
return own.find((f) => f.id === id)?.name ?? id;
|
||||
}
|
||||
export { renovationFilterLabel };
|
||||
|
||||
export function RenovationControl() {
|
||||
const project = useStore((s) => s.project);
|
||||
const activeLevelId = useStore((s) => s.activeLevelId);
|
||||
const draw = useStore((s) => s.drawRenovation);
|
||||
const setDraw = useStore((s) => s.setDrawRenovation);
|
||||
const applyChange = useStore((s) => s.applyChange);
|
||||
const { draw, setDraw, phases, own, filter, filterPhase, levelEditable, setLevel } = useRenovationControls();
|
||||
const [open, setOpen] = useState(false);
|
||||
const wrapRef = useRef<HTMLSpanElement | null>(null);
|
||||
useEffect(() => {
|
||||
@@ -37,22 +29,6 @@ export function RenovationControl() {
|
||||
document.removeEventListener("keydown", onKey);
|
||||
};
|
||||
}, [open]);
|
||||
const level = project.drawingLevels.find((l) => l.id === activeLevelId);
|
||||
const phases = renovationPhases(project);
|
||||
const own = useMemo(() => project.renovation?.filters ?? [], [project.renovation?.filters]);
|
||||
const filter = level?.renovationFilter ?? "";
|
||||
const levelEditable = !!level && (level.kind === "floor" || level.kind === "section" || level.kind === "elevation" || level.kind === "ceiling");
|
||||
const setLevel = (patch: { renovationFilter?: string; renovationPhase?: string }) => {
|
||||
if (!level) return;
|
||||
applyChange((p) =>
|
||||
patchItem(p, "drawingLevels", level.id, (l) => {
|
||||
const next = { ...l, ...patch };
|
||||
if (!next.renovationFilter) delete next.renovationFilter;
|
||||
if (!next.renovationPhase || !next.renovationFilter) delete next.renovationPhase;
|
||||
return next;
|
||||
}),
|
||||
);
|
||||
};
|
||||
const statusLabel = t(`renovation.status.${draw.status}` as TranslationKey);
|
||||
const filterLabel = filter ? renovationFilterLabel(filter, own) : t("renovation.filter.none");
|
||||
return (
|
||||
@@ -108,7 +84,7 @@ export function RenovationControl() {
|
||||
disabled={!levelEditable}
|
||||
aria-label={t("renovation.filter")}
|
||||
data-testid="renovation-filter"
|
||||
onChange={(e) => setLevel({ renovationFilter: e.target.value || undefined, renovationPhase: level?.renovationPhase })}
|
||||
onChange={(e) => setLevel({ renovationFilter: e.target.value || undefined, renovationPhase: filterPhase || undefined })}
|
||||
>
|
||||
<option value="">{t("renovation.filter.none")}</option>
|
||||
{BUILTIN_RENOVATION_FILTERS.map((id) => (
|
||||
@@ -127,7 +103,7 @@ export function RenovationControl() {
|
||||
<label className="sb-snap-row sb-snap-row-num">
|
||||
<span>{t("renovation.filterPhase")}</span>
|
||||
<select
|
||||
value={level?.renovationPhase ?? ""}
|
||||
value={filterPhase}
|
||||
aria-label={t("renovation.filterPhase")}
|
||||
onChange={(e) => setLevel({ renovationFilter: filter, renovationPhase: e.target.value || undefined })}
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user