[109] [101] Schraffuren: Generator als eigenes Crate (hatchgen), render3d-Live-Schnitt/Druck-SVG/SVG-PlanView zeichnen Schichtmuster mit dem Kern-Generator, Putz/Keramik/Faserzement mit Schraffur (Punktfeld), Standards aktualisieren im Ressourcen-Manager
This commit is contained in:
38 files changed
+1004
-74
No files matched your search
@@ -34,6 +34,7 @@ import { EyeIcon } from "./EyeIcon";
|
||||
import { t } from "../i18n";
|
||||
import { ComponentsTab } from "./resourceManager/ComponentsTab";
|
||||
import { HatchesTab } from "./resourceManager/HatchesTab";
|
||||
import { StandardsUpdateDialog } from "./resourceManager/StandardsUpdateDialog";
|
||||
import { LinesTab } from "./resourceManager/LinesTab";
|
||||
import { CeilingStylesTab, RoofStylesTab, WallStylesTab } from "./resourceManager/LayeredStylesTab";
|
||||
import { DoorStylesTab } from "./resourceManager/DoorStylesTab";
|
||||
@@ -153,6 +154,8 @@ export interface ResourceManagerHandlers {
|
||||
onSeedStandardPenSet?: () => void;
|
||||
/** Ergänzt die fehlenden SIA-400-Standards ([100]–[102], „Standards laden"). */
|
||||
onLoadStandards?: () => void;
|
||||
/** „Standards aktualisieren" ([109]): bringt die gewählten Standard-Einträge (`"<Liste>:<id>"`) auf den heutigen Stand. */
|
||||
onUpdateStandards?: (selected: string[]) => void;
|
||||
/**
|
||||
* Farbpaletten (Tab „Paletten"): eigene Paletten verwalten + Sichtbarkeit
|
||||
* der Bänke im Farbwahl-Popover. Optional wie die Stift-Handler.
|
||||
@@ -234,6 +237,7 @@ export function ResourceManager({
|
||||
if (initialTab) setTab(initialTab);
|
||||
}, [initialTab]);
|
||||
const [rect, setRect] = useState<WindowRect>(initialRect);
|
||||
const [updateStandardsOpen, setUpdateStandardsOpen] = useState(false);
|
||||
|
||||
// Verschieben über die Kopfzeile: Cursor − linke/obere Kante festhalten und die
|
||||
// Kante der Cursorbewegung folgen lassen (Pointer-Capture hält die Geste).
|
||||
@@ -330,6 +334,16 @@ export function ResourceManager({
|
||||
{t("resources.loadStandards")}
|
||||
</button>
|
||||
)}
|
||||
{handlers.onUpdateStandards && (
|
||||
<button
|
||||
className="res-add res-update-standards"
|
||||
title={t("resources.updateStandards.hint")}
|
||||
onPointerDown={(e) => e.stopPropagation()}
|
||||
onClick={() => setUpdateStandardsOpen(true)}
|
||||
>
|
||||
{t("resources.updateStandards")}
|
||||
</button>
|
||||
)}
|
||||
{!windowed && (
|
||||
<button
|
||||
className="res-close"
|
||||
@@ -475,6 +489,14 @@ export function ResourceManager({
|
||||
)}
|
||||
</div>
|
||||
|
||||
{updateStandardsOpen && handlers.onUpdateStandards && (
|
||||
<StandardsUpdateDialog
|
||||
project={project}
|
||||
onApply={(sel) => handlers.onUpdateStandards?.(sel)}
|
||||
onClose={() => setUpdateStandardsOpen(false)}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Greifer unten rechts (Größe ändern) — im eigenen OS-Fenster übernimmt
|
||||
das Betriebssystem das Grössenändern, daher windowed ohne Greifer. */}
|
||||
{!windowed && (
|
||||
|
||||
@@ -32,6 +32,7 @@ const PATTERN_OPTIONS: { value: HatchPattern; labelKey: string }[] = [
|
||||
{ value: "stone", labelKey: "pattern.stone" },
|
||||
{ value: "earth", labelKey: "pattern.earth" },
|
||||
{ value: "gravel", labelKey: "pattern.gravel" },
|
||||
{ value: "dots", labelKey: "pattern.dots" },
|
||||
{ value: "custom", labelKey: "pattern.custom" },
|
||||
];
|
||||
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
// „Standards aktualisieren" ([109]): Bestätigungs-Overlay (kein window.confirm — im Tauri-WKWebView stumm).
|
||||
// Listet die Standard-Einträge des Projekts, die von der heutigen Bibliothek abweichen, mit den betroffenen
|
||||
// Feldern. Ob ein Eintrag selbst angepasst wurde, lässt sich nicht erkennen: umbenannte Einträge sind
|
||||
// abgewählt, alle anderen vorgewählt; „Alle überschreiben" wählt alles. Regel: `core/src/standards.rs`.
|
||||
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import type { Project } from "../../model/types";
|
||||
import { standardsChangeKey, standardsUpdatePlan } from "../../model/standards";
|
||||
import { t } from "../../i18n";
|
||||
|
||||
const COLLECTION_ORDER = ["components", "hatches", "lineStyles", "wallTypes", "ceilingTypes", "roofTypes"];
|
||||
|
||||
export function StandardsUpdateDialog({
|
||||
project,
|
||||
onApply,
|
||||
onClose,
|
||||
}: {
|
||||
project: Project;
|
||||
onApply: (selected: string[]) => void;
|
||||
onClose: () => void;
|
||||
}) {
|
||||
const plan = useMemo(() => standardsUpdatePlan(project), [project]);
|
||||
const [selected, setSelected] = useState<Set<string>>(
|
||||
() => new Set(plan.changes.filter((c) => !c.renamed).map(standardsChangeKey)),
|
||||
);
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onClose();
|
||||
};
|
||||
window.addEventListener("keydown", onKey);
|
||||
return () => window.removeEventListener("keydown", onKey);
|
||||
}, [onClose]);
|
||||
|
||||
const toggle = (key: string) =>
|
||||
setSelected((s) => {
|
||||
const n = new Set(s);
|
||||
if (n.has(key)) n.delete(key);
|
||||
else n.add(key);
|
||||
return n;
|
||||
});
|
||||
const groups = COLLECTION_ORDER.map((col) => ({ col, items: plan.changes.filter((c) => c.collection === col) })).filter((g) => g.items.length > 0);
|
||||
const nothing = plan.changes.length === 0 && plan.added === 0;
|
||||
const canApply = selected.size > 0 || plan.added > 0;
|
||||
|
||||
return createPortal(
|
||||
<div className="imp-overlay" onClick={onClose}>
|
||||
<div className="imp-dialog" role="dialog" aria-modal="true" aria-label={t("resources.updateStandards")} style={{ maxWidth: 560 }} onClick={(e) => e.stopPropagation()}>
|
||||
<header className="imp-head">
|
||||
<span className="imp-head-title">{t("resources.updateStandards")}</span>
|
||||
<button className="imp-close" onClick={onClose} aria-label={t("export.close")}>
|
||||
×
|
||||
</button>
|
||||
</header>
|
||||
<div className="imp-body" style={{ maxHeight: "60vh", overflow: "auto" }}>
|
||||
{nothing ? (
|
||||
<section className="imp-section">
|
||||
<div className="imp-section-title">{t("resources.updateStandards.none")}</div>
|
||||
</section>
|
||||
) : (
|
||||
<>
|
||||
<section className="imp-section">
|
||||
<div className="imp-section-title" style={{ fontWeight: 400 }}>
|
||||
{t("resources.updateStandards.intro")}
|
||||
</div>
|
||||
{plan.added > 0 && (
|
||||
<div className="imp-section-title" style={{ fontWeight: 400, opacity: 0.8 }}>
|
||||
{t("resources.updateStandards.added", { n: plan.added })}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
{groups.map((g) => (
|
||||
<section className="imp-section" key={g.col}>
|
||||
<div className="imp-section-title">{t(`resources.updateStandards.col.${g.col}`)}</div>
|
||||
{g.items.map((c) => {
|
||||
const key = standardsChangeKey(c);
|
||||
return (
|
||||
<label key={key} style={{ display: "flex", gap: 8, alignItems: "baseline", padding: "2px 0", cursor: "pointer" }}>
|
||||
<input type="checkbox" checked={selected.has(key)} onChange={() => toggle(key)} />
|
||||
<span>
|
||||
{c.name}
|
||||
{c.renamed && <em style={{ opacity: 0.7 }}> ({t("resources.updateStandards.renamed")})</em>}
|
||||
<span style={{ opacity: 0.6, fontSize: 11 }}> — {c.fields.map((f) => t(`resources.updateStandards.field.${f}`)).join(", ")}</span>
|
||||
</span>
|
||||
</label>
|
||||
);
|
||||
})}
|
||||
</section>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<footer className="imp-foot">
|
||||
{!nothing && plan.changes.length > 0 && (
|
||||
<>
|
||||
<button className="imp-btn" onClick={() => setSelected(new Set(plan.changes.map(standardsChangeKey)))}>
|
||||
{t("resources.updateStandards.all")}
|
||||
</button>
|
||||
<button className="imp-btn" onClick={() => setSelected(new Set())}>
|
||||
{t("resources.updateStandards.noneSelected")}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
<button className="imp-btn" onClick={onClose}>
|
||||
{t("export.cancel")}
|
||||
</button>
|
||||
{!nothing && (
|
||||
<button
|
||||
className="imp-btn primary"
|
||||
disabled={!canApply}
|
||||
onClick={() => {
|
||||
onApply([...selected]);
|
||||
onClose();
|
||||
}}
|
||||
>
|
||||
{t("resources.updateStandards.apply", { n: selected.size })}
|
||||
</button>
|
||||
)}
|
||||
</footer>
|
||||
</div>
|
||||
</div>,
|
||||
document.body,
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user