[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
@@ -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 })),
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user