[256] Klassen-Füllung im Ebenen-Editor bearbeitbar (Farbwähler + keine, auch im macOS-Ebenenfenster)
This commit is contained in:
9 files changed
+87
-4
No files matched your search
@@ -309,8 +309,9 @@ Kennwort, anonym) als PDF; Austausch mit Fachplanern über DXF/IFC.
|
||||
liegen ebenfalls über 1.0 m): nicht zu bemassen hätte auch diese Bad-Fenster aus den EG/OG-Ketten genommen — Entscheid nötig (hell auf
|
||||
schwarz zeichnen oder Schnitthöhe/Bemassung); Wettbewerb: Geschosse ohne Vorlage, Schatten kommt vom eingeschalteten Sonnenstand
|
||||
(`sunStudy.show`), unverändert; Wettbewerb-Schnitt ohne Gelände: Nachbar bleibt (hellgrau) weit neben dem Haus; `levelMarkers.ts`-Doppelspur
|
||||
(braucht eine Kern-Abfrage mit Plan-Puffer als Eingabe); Stempel „Schlafen" DG 80 %; Klassen-Füllung im Klassen-Dialog noch nicht
|
||||
editierbar. · M
|
||||
(braucht eine Kern-Abfrage mit Plan-Puffer als Eingabe); Stempel „Schlafen" DG 80 %. **14.11. (spät):** Klassen-Füllung im Klassen-Dialog
|
||||
editierbar (Farbwähler + „keine", Inline-Editor und macOS-Ebenenfenster; Ziehen = ein Undo-Schritt; Test `categoryFill.test.ts`); nur vitest/tsc,
|
||||
nicht in der Tauri-App angesehen. · M
|
||||
- Fachplaner-Austausch: DXF/DWG je Geschoss/Schnitt/Ansicht ([200]), IFC mit Räumen/Psets ([201]); Rundreise in Archicad/Revit einmal
|
||||
real prüfen ([C9]).
|
||||
- ◐ **[255]** Baurecht-Nachweis: Ausnützung gegen Modell als Tabelle (14.11.). Kern `site_proof.rs` (Abfrage `siteProof`) stellt die Vorgaben
|
||||
|
||||
@@ -1174,6 +1174,8 @@ export const de = {
|
||||
"editor.color": "Farbe",
|
||||
"editor.pen": "Stift",
|
||||
"editor.lineWeight": "Linienstärke",
|
||||
"editor.fill": "Füllung",
|
||||
"editor.fillNone": "keine",
|
||||
"editor.hatch": "Schraffur",
|
||||
"editor.floorHeight": "Geschosshöhe",
|
||||
"editor.cutHeight": "Schnitthöhe",
|
||||
|
||||
@@ -1168,6 +1168,8 @@ export const en: Record<TranslationKey, string> = {
|
||||
"editor.color": "Color",
|
||||
"editor.pen": "Pen",
|
||||
"editor.lineWeight": "Line weight",
|
||||
"editor.fill": "Fill",
|
||||
"editor.fillNone": "none",
|
||||
"editor.hatch": "Hatch",
|
||||
"editor.floorHeight": "Floor height",
|
||||
"editor.cutHeight": "Cut height",
|
||||
|
||||
@@ -12,6 +12,7 @@ import type { DrawingLevel, LayerCategory } from "../model/types";
|
||||
import { getState, useStore } from "../state/appStore";
|
||||
import { EditorField } from "../ui/EditorField";
|
||||
import { HatchSwatch } from "../ui/hatchPreview";
|
||||
import { OptionalColorField } from "../ui/OptionalColorField";
|
||||
import { PenColorField } from "../ui/PenColorField";
|
||||
import { InlineEditor } from "../views/InlineEditor";
|
||||
|
||||
@@ -82,6 +83,9 @@ export function LayerInlineEditor({
|
||||
<span className="editor-unit">{t("editor.unit.mm")}</span>
|
||||
</span>
|
||||
</EditorField>
|
||||
<EditorField label={t("editor.fill")}>
|
||||
<OptionalColorField value={cat.fill} onChange={(fill) => patchCategory(cat.code, { fill })} />
|
||||
</EditorField>
|
||||
<EditorField label={t("editor.hatch")}>
|
||||
<span className="editor-hatch">
|
||||
<select
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { EditorField } from "../ui/EditorField";
|
||||
import { OptionalColorField } from "../ui/OptionalColorField";
|
||||
import type { LayerSettingsCommandHandlers, LayerSettingsSyncState } from "./layerSettingsWindow";
|
||||
import { t } from "../i18n";
|
||||
import { listenBridgeState } from "./windowBridge";
|
||||
@@ -42,7 +43,7 @@ export function LayerSettingsWindowApp() {
|
||||
};
|
||||
}, []);
|
||||
|
||||
const patch = (p: Partial<{ name: string; color: string; lw: number; hatch: string | undefined }>) => {
|
||||
const patch = (p: Partial<{ name: string; color: string; lw: number; fill: string | undefined; hatch: string | undefined }>) => {
|
||||
if (!state) return;
|
||||
void import("@tauri-apps/api/event").then(({ emitTo }) =>
|
||||
emitTo("main", "layer-settings-command", {
|
||||
@@ -111,6 +112,9 @@ export function LayerSettingsWindowApp() {
|
||||
<span className="editor-unit">{t("editor.unit.mm")}</span>
|
||||
</span>
|
||||
</EditorField>
|
||||
<EditorField label={t("editor.fill")}>
|
||||
<OptionalColorField value={state.fill} onChange={(fill) => patch({ fill })} />
|
||||
</EditorField>
|
||||
<EditorField label={t("editor.hatch")}>
|
||||
<span className="editor-hatch">
|
||||
<select
|
||||
|
||||
@@ -33,6 +33,7 @@ export interface LayerSettingsSyncState {
|
||||
name: string;
|
||||
color: string;
|
||||
lw: number;
|
||||
fill: string | undefined;
|
||||
hatchId: string | undefined;
|
||||
hatches: { id: string; name: string }[];
|
||||
}
|
||||
@@ -71,6 +72,7 @@ function stateFor(project: Pick<Project, "layers" | "hatches">, code: string): L
|
||||
name: cat.name,
|
||||
color: cat.color,
|
||||
lw: cat.lw,
|
||||
fill: cat.fill,
|
||||
hatchId: cat.hatch,
|
||||
hatches: project.hatches.map((h: HatchStyle) => ({ id: h.id, name: h.name })),
|
||||
};
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
// [256] Klassen-Füllung (`LayerCategory.fill`) über den Store setzen, entfernen, zurücknehmen; Ziehen im Farbwähler = ein Undo-Schritt.
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import { getState } from "./appStore";
|
||||
import { findCategory } from "../model/layers";
|
||||
import { sampleProject } from "../model/sampleProject";
|
||||
|
||||
const st = () => getState();
|
||||
const code = () => st().project.layers[0].code;
|
||||
const fill = () => findCategory(st().project.layers, code())?.fill;
|
||||
|
||||
beforeEach(() => {
|
||||
st().loadProject(structuredClone(sampleProject));
|
||||
st().clearHistory();
|
||||
});
|
||||
|
||||
describe("Klassen-Füllung bearbeiten ([256])", () => {
|
||||
it("setzt, entfernt und nimmt zurück", () => {
|
||||
st().patchCategory(code(), { fill: "#d9d9d9" });
|
||||
expect(fill()).toBe("#d9d9d9");
|
||||
st().patchCategory(code(), { name: "X" }); // beendet die Zusammenfassung
|
||||
st().patchCategory(code(), { fill: undefined });
|
||||
expect(fill()).toBeUndefined();
|
||||
expect(findCategory(st().project.layers, code())).not.toHaveProperty("fill", null);
|
||||
st().undo();
|
||||
st().undo();
|
||||
expect(fill()).toBe("#d9d9d9");
|
||||
st().undo();
|
||||
expect(fill()).toBeUndefined();
|
||||
});
|
||||
|
||||
it("Ziehen im Farbwähler ist ein Undo-Schritt", () => {
|
||||
for (const c of ["#111111", "#222222", "#333333"]) st().patchCategory(code(), { fill: c });
|
||||
expect(fill()).toBe("#333333");
|
||||
st().undo();
|
||||
expect(fill()).toBeUndefined();
|
||||
});
|
||||
});
|
||||
@@ -863,7 +863,11 @@ export function createProjectSlice(
|
||||
}),
|
||||
|
||||
patchCategory: (code, patch) =>
|
||||
applyChange((p) => fieldOps(p, "layers", patchCategoryByCode(p.layers, code, patch))),
|
||||
applyChange(
|
||||
(p) => fieldOps(p, "layers", patchCategoryByCode(p.layers, code, patch)),
|
||||
// [256] Ziehen im Farbwähler der Klassen-Füllung = ein Undo-Schritt.
|
||||
Object.keys(patch).length === 1 && "fill" in patch ? `layer-fill:${code}` : undefined,
|
||||
),
|
||||
|
||||
addSubCategory: (parentCode) =>
|
||||
applyChange((p) => {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// Farbfeld mit „keine“ ([256], Klassen-Füllung): leerer Wert = nicht gesetzt (bisheriges Verhalten).
|
||||
// Der Farbwähler ist das native `<input type="color">`; „keine“ setzt den Wert zurück.
|
||||
|
||||
import { t } from "../i18n";
|
||||
|
||||
export function OptionalColorField({
|
||||
value,
|
||||
onChange,
|
||||
}: {
|
||||
value: string | undefined;
|
||||
onChange: (hex: string | undefined) => void;
|
||||
}) {
|
||||
return (
|
||||
<span className="attr-color" style={{ display: "inline-flex", alignItems: "center", gap: 8 }}>
|
||||
<label className="attr-color-swatch-wrap" title={t("attr.pickColor")}>
|
||||
<span
|
||||
className="attr-color-swatch"
|
||||
style={value ? { background: value } : { background: "transparent", outline: "1px dashed var(--muted)" }}
|
||||
/>
|
||||
<input type="color" value={value ?? "#d9d9d9"} onChange={(e) => onChange(e.target.value)} />
|
||||
</label>
|
||||
<button type="button" disabled={!value} onClick={() => onChange(undefined)}>
|
||||
{t("editor.fillNone")}
|
||||
</button>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user