Werkzeuge: Kreis-Toolbar verdrahtet (circleCommand gekoppelt, Icon, i18n)
This commit is contained in:
@@ -212,6 +212,7 @@ const TOOL_COMMAND: Partial<Record<ToolId, string>> = {
|
||||
line: "line",
|
||||
polyline: "polyline",
|
||||
rect: "rect",
|
||||
circle: "circle",
|
||||
};
|
||||
/** Befehlsname für ein gekoppeltes Werkzeug (oder null, wenn keiner). */
|
||||
function coupledCommandFor(id: ToolId): string | null {
|
||||
|
||||
@@ -116,6 +116,8 @@ export const de = {
|
||||
"tool.line": "Linie",
|
||||
"tool.polyline": "Polylinie",
|
||||
"tool.rect": "Rechteck",
|
||||
"tool.circle": "Kreis",
|
||||
"tool.circle.hint": "Kreis: Mittelpunkt setzen, dann Radius",
|
||||
"tool.select.hint": "Auswahl — Elemente klicken/aufziehen",
|
||||
"tool.window.hint": "Fenster: Wand wählen, dann Position setzen",
|
||||
"tool.door.hint": "Tür: Wand wählen, dann Position setzen",
|
||||
|
||||
@@ -115,6 +115,8 @@ export const en: Record<TranslationKey, string> = {
|
||||
"tool.line": "Line",
|
||||
"tool.polyline": "Polyline",
|
||||
"tool.rect": "Rectangle",
|
||||
"tool.circle": "Circle",
|
||||
"tool.circle.hint": "Circle: set center, then radius",
|
||||
"tool.select.hint": "Select — click/drag elements",
|
||||
"tool.window.hint": "Window: pick a wall, then set the position",
|
||||
"tool.door.hint": "Door: pick a wall, then set the position",
|
||||
|
||||
@@ -111,6 +111,13 @@ function ToolIcon({ id }: { id: ToolId }) {
|
||||
<rect x="2.5" y="3.5" width="11" height="9" />
|
||||
</svg>
|
||||
);
|
||||
case "circle":
|
||||
// Kreis-Umriss.
|
||||
return (
|
||||
<svg {...common}>
|
||||
<circle cx="8" cy="8" r="5.5" />
|
||||
</svg>
|
||||
);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -526,6 +526,21 @@ const rectTool: Tool = {
|
||||
onCancel: () => [{ phase: "idle" }, { draft: null, done: true }],
|
||||
};
|
||||
|
||||
// Kreis: Platzhalter-Werkzeug (analog window/door), gekoppelt an den
|
||||
// `circle`-Befehl (TOOL_COMMAND in App.tsx). Der eigentliche Ablauf
|
||||
// (Mittelpunkt → Radius) läuft über die Command-Engine — EIN Pfad für
|
||||
// Toolbar-Klick und getipptes „circle". Nicht floorOnly (freie 2D-Zeichnung).
|
||||
const circleTool: Tool = {
|
||||
id: "circle",
|
||||
labelKey: "tool.circle",
|
||||
hintKey: () => "tool.circle.hint",
|
||||
init: () => ({ phase: "idle" }),
|
||||
onClick: (s) => [s, { draft: null }],
|
||||
onMove: (s) => [s, { draft: null }],
|
||||
onCommitGesture: (s) => [s, { draft: null, done: true }],
|
||||
onCancel: (s) => [s, { draft: null, done: true }],
|
||||
};
|
||||
|
||||
// ── Registry ─────────────────────────────────────────────────────────────────
|
||||
|
||||
const TOOLS: Record<ToolId, Tool> = {
|
||||
@@ -539,6 +554,7 @@ const TOOLS: Record<ToolId, Tool> = {
|
||||
line: lineTool,
|
||||
polyline: polylineTool,
|
||||
rect: rectTool,
|
||||
circle: circleTool,
|
||||
};
|
||||
|
||||
/** Liefert das Werkzeug zur ID. */
|
||||
@@ -558,4 +574,5 @@ export const TOOL_ORDER: ToolId[] = [
|
||||
"line",
|
||||
"polyline",
|
||||
"rect",
|
||||
"circle",
|
||||
];
|
||||
|
||||
+2
-1
@@ -18,7 +18,8 @@ export type ToolId =
|
||||
| "room"
|
||||
| "line"
|
||||
| "polyline"
|
||||
| "rect";
|
||||
| "rect"
|
||||
| "circle";
|
||||
|
||||
// ── Snapping ───────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
Reference in New Issue
Block a user