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",
|
line: "line",
|
||||||
polyline: "polyline",
|
polyline: "polyline",
|
||||||
rect: "rect",
|
rect: "rect",
|
||||||
|
circle: "circle",
|
||||||
};
|
};
|
||||||
/** Befehlsname für ein gekoppeltes Werkzeug (oder null, wenn keiner). */
|
/** Befehlsname für ein gekoppeltes Werkzeug (oder null, wenn keiner). */
|
||||||
function coupledCommandFor(id: ToolId): string | null {
|
function coupledCommandFor(id: ToolId): string | null {
|
||||||
|
|||||||
@@ -116,6 +116,8 @@ export const de = {
|
|||||||
"tool.line": "Linie",
|
"tool.line": "Linie",
|
||||||
"tool.polyline": "Polylinie",
|
"tool.polyline": "Polylinie",
|
||||||
"tool.rect": "Rechteck",
|
"tool.rect": "Rechteck",
|
||||||
|
"tool.circle": "Kreis",
|
||||||
|
"tool.circle.hint": "Kreis: Mittelpunkt setzen, dann Radius",
|
||||||
"tool.select.hint": "Auswahl — Elemente klicken/aufziehen",
|
"tool.select.hint": "Auswahl — Elemente klicken/aufziehen",
|
||||||
"tool.window.hint": "Fenster: Wand wählen, dann Position setzen",
|
"tool.window.hint": "Fenster: Wand wählen, dann Position setzen",
|
||||||
"tool.door.hint": "Tür: 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.line": "Line",
|
||||||
"tool.polyline": "Polyline",
|
"tool.polyline": "Polyline",
|
||||||
"tool.rect": "Rectangle",
|
"tool.rect": "Rectangle",
|
||||||
|
"tool.circle": "Circle",
|
||||||
|
"tool.circle.hint": "Circle: set center, then radius",
|
||||||
"tool.select.hint": "Select — click/drag elements",
|
"tool.select.hint": "Select — click/drag elements",
|
||||||
"tool.window.hint": "Window: pick a wall, then set the position",
|
"tool.window.hint": "Window: pick a wall, then set the position",
|
||||||
"tool.door.hint": "Door: 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" />
|
<rect x="2.5" y="3.5" width="11" height="9" />
|
||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
|
case "circle":
|
||||||
|
// Kreis-Umriss.
|
||||||
|
return (
|
||||||
|
<svg {...common}>
|
||||||
|
<circle cx="8" cy="8" r="5.5" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -526,6 +526,21 @@ const rectTool: Tool = {
|
|||||||
onCancel: () => [{ phase: "idle" }, { draft: null, done: true }],
|
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 ─────────────────────────────────────────────────────────────────
|
// ── Registry ─────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
const TOOLS: Record<ToolId, Tool> = {
|
const TOOLS: Record<ToolId, Tool> = {
|
||||||
@@ -539,6 +554,7 @@ const TOOLS: Record<ToolId, Tool> = {
|
|||||||
line: lineTool,
|
line: lineTool,
|
||||||
polyline: polylineTool,
|
polyline: polylineTool,
|
||||||
rect: rectTool,
|
rect: rectTool,
|
||||||
|
circle: circleTool,
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Liefert das Werkzeug zur ID. */
|
/** Liefert das Werkzeug zur ID. */
|
||||||
@@ -558,4 +574,5 @@ export const TOOL_ORDER: ToolId[] = [
|
|||||||
"line",
|
"line",
|
||||||
"polyline",
|
"polyline",
|
||||||
"rect",
|
"rect",
|
||||||
|
"circle",
|
||||||
];
|
];
|
||||||
|
|||||||
+2
-1
@@ -18,7 +18,8 @@ export type ToolId =
|
|||||||
| "room"
|
| "room"
|
||||||
| "line"
|
| "line"
|
||||||
| "polyline"
|
| "polyline"
|
||||||
| "rect";
|
| "rect"
|
||||||
|
| "circle";
|
||||||
|
|
||||||
// ── Snapping ───────────────────────────────────────────────────────────────
|
// ── Snapping ───────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user