Merge branch 'worktree-agent-a82d9c3da809d3419' into claude/practical-noether-1hb2s1
This commit is contained in:
14 files changed
+339
-27
No files matched your search
+9
-1
@@ -2324,7 +2324,15 @@ export const de = {
|
||||
// Alt+Klick). Labels für Befehlsleiste/Menüs.
|
||||
"edit.split.label": "Teilen",
|
||||
"edit.join.label": "Verbinden",
|
||||
"cmd.join.nothing": "Nichts zu verbinden: Wände treffen sich bereits oder liegen zu weit auseinander.",
|
||||
"cmd.join.few": "Zum Verbinden mindestens zwei Elemente wählen.",
|
||||
"cmd.join.nothing": "Nichts zu verbinden.",
|
||||
"cmd.join.far": "Nichts zu verbinden: Abstand zu gross ({d} m, höchstens {max} m).",
|
||||
"cmd.join.met": "Nichts zu verbinden: die Wände treffen sich bereits.",
|
||||
"cmd.join.cross": "Nichts zu verbinden: die Wände kreuzen sich.",
|
||||
"cmd.join.parallel": "Nichts zu verbinden: die Wände sind parallel.",
|
||||
"cmd.join.arc": "Nichts zu verbinden: Bogenwände werden nicht an Ecken verbunden.",
|
||||
"cmd.join.locked": "Nichts zu verbinden: die Wände sind gesperrt.",
|
||||
"cmd.join.floors": "Nichts zu verbinden: die Wände liegen auf verschiedenen Geschossen.",
|
||||
"edit.cutSegment.label": "Segment löschen",
|
||||
// Tab-Feld-Zyklus (Präzisionseingabe): geordnete Zahlenfelder je Schritt.
|
||||
"cmd.field.length": "Länge",
|
||||
|
||||
+9
-1
@@ -2312,7 +2312,15 @@ export const en: Record<TranslationKey, string> = {
|
||||
// Alt+Click). Labels for the command line / menus.
|
||||
"edit.split.label": "Split",
|
||||
"edit.join.label": "Join",
|
||||
"cmd.join.nothing": "Nothing to join: walls already meet or are too far apart.",
|
||||
"cmd.join.few": "Select at least two elements to join.",
|
||||
"cmd.join.nothing": "Nothing to join.",
|
||||
"cmd.join.far": "Nothing to join: distance too large ({d} m, at most {max} m).",
|
||||
"cmd.join.met": "Nothing to join: the walls already meet.",
|
||||
"cmd.join.cross": "Nothing to join: the walls cross each other.",
|
||||
"cmd.join.parallel": "Nothing to join: the walls are parallel.",
|
||||
"cmd.join.arc": "Nothing to join: curved walls are not joined at corners.",
|
||||
"cmd.join.locked": "Nothing to join: the walls are locked.",
|
||||
"cmd.join.floors": "Nothing to join: the walls are on different floors.",
|
||||
"edit.cutSegment.label": "Delete segment",
|
||||
// Tab field cycle (precision input): ordered numeric fields per step.
|
||||
"cmd.field.length": "Length",
|
||||
|
||||
@@ -596,7 +596,10 @@ export function createProjectSlice(
|
||||
const now = Date.now();
|
||||
if (notice === lastNotice.key && now - lastNotice.at < 2000) return;
|
||||
lastNotice = { key: notice, at: now };
|
||||
get().notify(t(notice as Parameters<typeof t>[0]), "warning");
|
||||
// `Schlüssel|arg|arg` ([190]): Zahlen aus dem Kern, im Text als {d}, {max}.
|
||||
const [key, ...args] = notice.split("|");
|
||||
const params = args.length ? { d: args[0], max: args[1] ?? "" } : undefined;
|
||||
get().notify(t(key as Parameters<typeof t>[0], params), "warning");
|
||||
};
|
||||
|
||||
// Griff-Änderung ([K4] S3): der Kern rechnet sie auf dem Dokument und wendet sie im selben Aufruf an
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// [190] Verbinden der aktuellen Auswahl (Wände: Ecken/T-Stösse/kollinear; 2D-Elemente: Ketten). EIN Pfad für das
|
||||
// Tastenkürzel im Fenster (`useSplitJoinShortcut`) und das native Menü „Bearbeiten > Verbinden" (`selectionActions`).
|
||||
// Unter macOS fängt das Menü Cmd+J ab, das Fenster sieht die Taste dann nie — der Menü-Weg muss alles allein
|
||||
// leisten. Darum liest dieser Pfad die Auswahl IMMER frisch aus dem Store und nicht aus einer Render-Closure.
|
||||
|
||||
import { t } from "../i18n";
|
||||
import { getState } from "./appStore";
|
||||
import type { CommandEngine } from "../commands/engine";
|
||||
|
||||
/** Startet „join" auf der aktuellen Auswahl; false (mit Hinweis), wenn weniger als zwei Elemente gewählt sind. */
|
||||
export function joinCurrentSelection(engine: Pick<CommandEngine, "start">): boolean {
|
||||
const s = getState();
|
||||
const n = s.selection.drawings.length + s.selection.walls.length;
|
||||
if (n < 2) {
|
||||
s.notify(t("cmd.join.few"), "info");
|
||||
return false;
|
||||
}
|
||||
engine.start("join");
|
||||
// Die alte Auswahl zeigt nach dem Verbinden auf ersetzte ids → aufräumen.
|
||||
s.setSelection({ drawings: [], walls: [] });
|
||||
return true;
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
import { core, coreEpoch, coreReady } from "../engine/coreWasm";
|
||||
import { getState } from "./appStore";
|
||||
import { runSelectionAction, type SelectionActionId } from "./selectionActions";
|
||||
import { storeDocument } from "./historySlice";
|
||||
import { ceilingThickness } from "../model/types";
|
||||
import { computeSection, generatePlan, verticalExtents, generateSectionPlan, pickGeometry, projectToModel3d } from "../core";
|
||||
@@ -60,6 +61,10 @@ declare global {
|
||||
layerView: () => { wallId: string; visible: string[]; prims: number; wallPrims: number };
|
||||
/** [195] Strichstärke-Override der Wände (id → mm), nur gesetzte. */
|
||||
wallWeights: () => Record<string, number>;
|
||||
/** [190] Auswahl-Aktion wie das native Menü (Bearbeiten > Verbinden usw.), ohne Tastendruck: `runSelectionAction`. */
|
||||
selectionAction: (id: SelectionActionId) => void;
|
||||
/** [190] Wände (id, Start, Ende) des Projekts. */
|
||||
walls: () => { id: string; start: { x: number; y: number }; end: { x: number; y: number } }[];
|
||||
/** [185] 3D-Element-Filter (Store) und die Wand-ids des 3D-Modells bzw. der Pick-Geometrie mit ihm. */
|
||||
view3d: () => { only: string[] | null; hidden: string[]; walls: string[]; pickWalls: string[]; floors: string[]; pickOpenings: { id: string; host: string }[] };
|
||||
};
|
||||
@@ -98,6 +103,8 @@ export function installTestHooks(): void {
|
||||
};
|
||||
},
|
||||
wallWeights: () => Object.fromEntries(getState().project.walls.flatMap((w) => (w.strokeWeight === undefined ? [] : [[w.id, w.strokeWeight]]))),
|
||||
selectionAction: (id) => runSelectionAction(id),
|
||||
walls: () => getState().project.walls.map((w) => ({ id: w.id, start: { ...w.start }, end: { ...w.end } })),
|
||||
select: (patch) => getState().setSelection(patch),
|
||||
dimPts: (id) => {
|
||||
const g = getState().project.drawings2d.find((d) => d.id === id)?.geom;
|
||||
|
||||
@@ -131,7 +131,8 @@ export function useCommandEngineHost(opts: {
|
||||
// Befehl). Move/Copy/Offset operieren darauf.
|
||||
// Im Schnitt/in der Ansicht nur die 2D-Elemente der Ebene: Bauteile
|
||||
// leben im Grundriss-Raum, ein Schnitt-Delta wäre dort falsch.
|
||||
selection: sheetOnlySelection(c.activeLevel, toCommandSelection(c.selection)),
|
||||
// Auswahl frisch aus dem Store ([190]): das native Menü ruft Befehle ausserhalb von React, die Render-Kopie kann dort veraltet sein.
|
||||
selection: sheetOnlySelection(c.activeLevel, toCommandSelection(getState().selection)),
|
||||
};
|
||||
},
|
||||
snap: (raw, draftPoints, mods) => {
|
||||
|
||||
@@ -34,6 +34,7 @@ import type { ElementClipboard, ElementSelectionIds, PastedIds } from "../editor
|
||||
import { parseClipboardText, serializeClipboardText } from "../editors/elementClipboardSerialize";
|
||||
import { matchesShortcut, type ShortcutId, type ShortcutOverrides } from "./keyboardShortcuts";
|
||||
import { isolateSelectionLayerCodes, showAllLayerCodes } from "./layerIsolate";
|
||||
import { joinCurrentSelection } from "./selectionJoin";
|
||||
import { hideSelectionIn3d, showSelectionIn3d, stepActiveFloor } from "./tabNavigation";
|
||||
|
||||
const isEditableTarget = (e: KeyboardEvent): boolean => {
|
||||
@@ -332,7 +333,7 @@ export function useSplitJoinShortcut(
|
||||
selectedDrawingIds: string[],
|
||||
engine: CommandEngine,
|
||||
runSplit: (ids: string[]) => void,
|
||||
setSelection: (patch: Partial<Selection>) => void,
|
||||
_setSelection: (patch: Partial<Selection>) => void,
|
||||
overrides: ShortcutOverrides,
|
||||
selectedWallIds: string[] = [],
|
||||
): void {
|
||||
@@ -351,10 +352,8 @@ export function useSplitJoinShortcut(
|
||||
runSplit(ids);
|
||||
return;
|
||||
}
|
||||
// Join: exakt derselbe Befehl wie „join" tippen (Sofort-Befehl, autoRun).
|
||||
// Nach dem Verbinden zeigt die alte Auswahl auf ersetzte IDs → aufräumen.
|
||||
engine.start("join");
|
||||
setSelection({ drawings: [], walls: [] });
|
||||
// Join: derselbe Pfad wie das native Menü (Auswahl frisch aus dem Store, Hinweis bei < 2 Elementen).
|
||||
joinCurrentSelection(engine);
|
||||
};
|
||||
window.addEventListener("keydown", onKey);
|
||||
return () => window.removeEventListener("keydown", onKey);
|
||||
|
||||
@@ -20,6 +20,7 @@ import type { BooleanResult } from "../editors/booleanOps";
|
||||
import type { EngineView } from "../commands/engine";
|
||||
import { clearKinds, fromIdLists, hasTransformable, isEmpty, toMembership, toTransformSelection } from "./selection";
|
||||
import { registerSelectionActions } from "./selectionActions";
|
||||
import { joinCurrentSelection } from "./selectionJoin";
|
||||
import { transformOps } from "../tools/transform";
|
||||
import { addedIds, type PastedIds } from "../editors/elementClipboard";
|
||||
import { containingGroupId, EMPTY_MEMBERSHIP } from "./groupActions";
|
||||
@@ -327,11 +328,7 @@ export function useSelectionCommands(opts: {
|
||||
// [185] Cmd/Ctrl+3/4/5/6: Auswahl in 3D zeigen/ausblenden, Geschoss tiefer/höher.
|
||||
useViewNavigationShortcuts(shortcutOverrides);
|
||||
// [190] Verbinden (Cmd/Ctrl+J) auch aus dem nativen Menü: dieselbe Aktion wie das Tastenkürzel.
|
||||
const joinSelection = () => {
|
||||
if (selection.drawings.length + selection.walls.length === 0) return;
|
||||
engine.start("join");
|
||||
setSelection({ drawings: [], walls: [] });
|
||||
};
|
||||
const joinSelection = () => void joinCurrentSelection(engine);
|
||||
registerSelectionActions({
|
||||
duplicate: duplicateSelection,
|
||||
toggleLock: toggleSelectionLock,
|
||||
|
||||
Reference in new issue
Block a user