Merge branch 'worktree-agent-a8fc6e473cca76d27' into claude/practical-noether-1hb2s1
# Conflicts: # TODO.md # src/App.tsx # src/state/keyboardShortcuts.ts # src/state/useKeyboardShortcuts.ts
This commit is contained in:
17 files changed
+486
-8
No files matched your search
@@ -64,8 +64,11 @@ import {
|
||||
useActiveToolKeys,
|
||||
useElementClipboardShortcut,
|
||||
useObjectSettingsShortcut,
|
||||
useFitShortcuts,
|
||||
useUndoRedoShortcut,
|
||||
} from "./state/useKeyboardShortcuts";
|
||||
import { registerSelectionActions } from "./state/selectionActions";
|
||||
import { fitView as fitView3d } from "./viewport/cameraBridge";
|
||||
import { useProjectFileActions } from "./state/useProjectFileActions";
|
||||
import { useModelImport } from "./state/useModelImport";
|
||||
import { useTextTarget } from "./state/useTextTarget";
|
||||
@@ -555,6 +558,11 @@ export default function App() {
|
||||
// Zoom-Buttons der Oberleiste an die montierte Plan-Ansicht weiterreichen.
|
||||
const fitPlan = () => planViewRef.current?.fit();
|
||||
const fitSelection = () => planViewRef.current?.fitSelection();
|
||||
// [190] Cmd/Ctrl+0 alles einpassen, Cmd/Ctrl+Shift+F auf Auswahl (ohne Plan-Ansicht: 3D-Kamera).
|
||||
const fitAllKey = () => (planViewRef.current ? planViewRef.current.fit() : fitView3d());
|
||||
const fitSelectionKey = () => (planViewRef.current ? planViewRef.current.fitSelection() : fitView3d());
|
||||
registerSelectionActions({ fitAll: fitAllKey, fitSelection: fitSelectionKey });
|
||||
useFitShortcuts(fitAllKey, fitSelectionKey, shortcutOverrides);
|
||||
// Papier-Massstab anwenden: gewählten Nenner merken UND den Plan-Zoom exakt
|
||||
// auf 1:N setzen (PlanView rechnet die viewBox aus N + Canvas + dpi).
|
||||
const applyScale = (n: number) => {
|
||||
|
||||
@@ -186,6 +186,11 @@ export function pasteElementClipboard(
|
||||
activeLevelId: string,
|
||||
): { ops: CoreOp[]; pastedIds: PastedIds } {
|
||||
const ops = documentFor(project).cmdOps({ cmd: "paste", clip, levelId: activeLevelId, stamp: uniqueStamp() });
|
||||
return { ops, pastedIds: addedIds(ops) };
|
||||
}
|
||||
|
||||
/** Neue ids je Bauteil-Art aus den `add`-Ops (Einfügen, Duplizieren). */
|
||||
export function addedIds(ops: readonly CoreOp[]): PastedIds {
|
||||
const pastedIds: PastedIds = {
|
||||
wallIds: [],
|
||||
drawingIds: [],
|
||||
@@ -202,7 +207,7 @@ export function pasteElementClipboard(
|
||||
const key = op.kind === "add" ? PASTED_KEY[op.collection] : undefined;
|
||||
if (op.kind === "add" && key) for (const e of op.items) pastedIds[key].push((e as { id: string }).id);
|
||||
}
|
||||
return { ops, pastedIds };
|
||||
return pastedIds;
|
||||
}
|
||||
|
||||
export { EMPTY_CLIPBOARD };
|
||||
@@ -121,6 +121,13 @@ export const de = {
|
||||
"menu.view.floorUp": "Geschoss höher",
|
||||
"menu.view.showSelection3d": "Auswahl in 3D zeigen",
|
||||
"menu.view.hideSelection3d": "Auswahl im 3D ausblenden",
|
||||
"menu.view.fitAll": "Alles einpassen",
|
||||
"menu.view.fitSelection": "Auf Auswahl einpassen",
|
||||
"menu.view.hideSelectionLayers": "Ebenen der Auswahl ausblenden",
|
||||
"menu.view.showAllLayers": "Alle Ebenen einblenden",
|
||||
"menu.edit.duplicate": "Duplizieren",
|
||||
"menu.edit.join": "Verbinden",
|
||||
"menu.edit.toggleLock": "Sperren / Entsperren",
|
||||
"menu.window": "Fenster",
|
||||
"menu.window.resources": "Ressourcen",
|
||||
"menu.window.settings": "Einstellungen",
|
||||
@@ -2306,6 +2313,7 @@ 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.",
|
||||
"edit.cutSegment.label": "Segment löschen",
|
||||
// Tab-Feld-Zyklus (Präzisionseingabe): geordnete Zahlenfelder je Schritt.
|
||||
"cmd.field.length": "Länge",
|
||||
@@ -3073,6 +3081,12 @@ export const de = {
|
||||
"shortcut.showSelection3d": "Auswahl in 3D zeigen (ohne Auswahl: alles)",
|
||||
"shortcut.objectSettings": "Einstellungen des gewählten Objekts öffnen (ohne Auswahl: Werkzeug-Voreinstellung)",
|
||||
"shortcut.hideSelection3d": "Auswahl im 3D ausblenden",
|
||||
"shortcut.duplicate": "Duplizieren (Kopie mit Versatz)",
|
||||
"shortcut.toggleLock": "Auswahl sperren / entsperren",
|
||||
"shortcut.hideSelectionLayers": "Ebenen der Auswahl ausblenden",
|
||||
"shortcut.showAllLayers": "Alle Ebenen einblenden",
|
||||
"shortcut.fitAll": "Alles einpassen",
|
||||
"shortcut.fitSelection": "Auf Auswahl einpassen",
|
||||
|
||||
"settings.section.update": "Update",
|
||||
"settings.update.autoCheck": "Automatisch nach Updates suchen",
|
||||
|
||||
@@ -120,6 +120,13 @@ export const en: Record<TranslationKey, string> = {
|
||||
"menu.view.floorUp": "Story up",
|
||||
"menu.view.showSelection3d": "Show selection in 3D",
|
||||
"menu.view.hideSelection3d": "Hide selection in 3D",
|
||||
"menu.view.fitAll": "Fit all",
|
||||
"menu.view.fitSelection": "Fit to selection",
|
||||
"menu.view.hideSelectionLayers": "Hide layers of selection",
|
||||
"menu.view.showAllLayers": "Show all layers",
|
||||
"menu.edit.duplicate": "Duplicate",
|
||||
"menu.edit.join": "Join",
|
||||
"menu.edit.toggleLock": "Lock / unlock",
|
||||
"menu.window": "Window",
|
||||
"menu.window.resources": "Resources",
|
||||
"menu.window.settings": "Settings",
|
||||
@@ -2294,6 +2301,7 @@ 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.",
|
||||
"edit.cutSegment.label": "Delete segment",
|
||||
// Tab field cycle (precision input): ordered numeric fields per step.
|
||||
"cmd.field.length": "Length",
|
||||
@@ -3060,6 +3068,12 @@ export const en: Record<TranslationKey, string> = {
|
||||
"shortcut.showSelection3d": "Show selection in 3D (no selection: everything)",
|
||||
"shortcut.objectSettings": "Open settings of the selected object (no selection: tool defaults)",
|
||||
"shortcut.hideSelection3d": "Hide selection in 3D",
|
||||
"shortcut.duplicate": "Duplicate (offset copy)",
|
||||
"shortcut.toggleLock": "Lock / unlock selection",
|
||||
"shortcut.hideSelectionLayers": "Hide layers of selection",
|
||||
"shortcut.showAllLayers": "Show all layers",
|
||||
"shortcut.fitAll": "Fit all",
|
||||
"shortcut.fitSelection": "Fit to selection",
|
||||
|
||||
"settings.section.update": "Update",
|
||||
"settings.update.autoCheck": "Check for updates automatically",
|
||||
|
||||
@@ -17,6 +17,7 @@ import { isTauriRuntime } from "./projectFile";
|
||||
import { t } from "../i18n";
|
||||
import { APP_VERSION } from "../ui/TopBar";
|
||||
import type { View3d, ViewType } from "../model/viewTypes";
|
||||
import type { SelectionActionId } from "../state/selectionActions";
|
||||
|
||||
/** Alle Aktionen, die die native Menüleiste auslösen kann. */
|
||||
export interface NativeAppMenuHandlers {
|
||||
@@ -63,6 +64,8 @@ export interface NativeAppMenuHandlers {
|
||||
onShowSelection3d?: () => void;
|
||||
/** [185] Auswahl im 3D ausblenden (Cmd+4). */
|
||||
onHideSelection3d?: () => void;
|
||||
/** [190] Auswahl-Aktionen mit Kürzel (Cmd+D/J/L, Cmd+0, Cmd+Shift+F/H/A), s. `state/selectionActions.ts`. */
|
||||
onSelectionAction?: (id: SelectionActionId) => void;
|
||||
|
||||
onToggleResources: () => void;
|
||||
onOpenSettings: () => void;
|
||||
@@ -276,6 +279,22 @@ export function useNativeAppMenu(
|
||||
redoItem,
|
||||
await PredefinedMenuItem.new({ item: "Separator" }),
|
||||
deleteItem,
|
||||
// [190] Archicad-Kürzel (dieselben laufen im Browser über `useSelectionActionShortcuts`).
|
||||
await MenuItem.new({
|
||||
text: t("menu.edit.duplicate"),
|
||||
accelerator: "CmdOrCtrl+D",
|
||||
action: () => handlersRef.current.onSelectionAction?.("duplicate"),
|
||||
}),
|
||||
await MenuItem.new({
|
||||
text: t("menu.edit.join"),
|
||||
accelerator: "CmdOrCtrl+J",
|
||||
action: () => handlersRef.current.onSelectionAction?.("join"),
|
||||
}),
|
||||
await MenuItem.new({
|
||||
text: t("menu.edit.toggleLock"),
|
||||
accelerator: "CmdOrCtrl+L",
|
||||
action: () => handlersRef.current.onSelectionAction?.("toggleLock"),
|
||||
}),
|
||||
await PredefinedMenuItem.new({ item: "Separator" }),
|
||||
await MenuItem.new({
|
||||
text: t("menu.native.move"),
|
||||
@@ -375,6 +394,28 @@ export function useNativeAppMenu(
|
||||
accelerator: "CmdOrCtrl+4",
|
||||
action: () => handlersRef.current.onHideSelection3d?.(),
|
||||
}),
|
||||
// [190] Einpassen und Ebenen ein-/ausblenden.
|
||||
await PredefinedMenuItem.new({ item: "Separator" }),
|
||||
await MenuItem.new({
|
||||
text: t("menu.view.fitAll"),
|
||||
accelerator: "CmdOrCtrl+0",
|
||||
action: () => handlersRef.current.onSelectionAction?.("fitAll"),
|
||||
}),
|
||||
await MenuItem.new({
|
||||
text: t("menu.view.fitSelection"),
|
||||
accelerator: "CmdOrCtrl+Shift+F",
|
||||
action: () => handlersRef.current.onSelectionAction?.("fitSelection"),
|
||||
}),
|
||||
await MenuItem.new({
|
||||
text: t("menu.view.hideSelectionLayers"),
|
||||
accelerator: "CmdOrCtrl+Shift+H",
|
||||
action: () => handlersRef.current.onSelectionAction?.("hideLayers"),
|
||||
}),
|
||||
await MenuItem.new({
|
||||
text: t("menu.view.showAllLayers"),
|
||||
accelerator: "CmdOrCtrl+Shift+A",
|
||||
action: () => handlersRef.current.onSelectionAction?.("showAllLayers"),
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ in `ProjectSync`.
|
||||
| `viewSnapshots.ts`, `viewSnapshotFolders.ts`, `viewTabs.ts` | Ausschnitte, ihre Ordner, Zeichnungs-Reiter (mit dem Projekt als `uiState.viewTabs` gesichert, [136]); Reiter-Arten und Navigations-Regeln ([182]) |
|
||||
| `tabNavigation.ts` | Navigator/Grundriss-/3D-Knöpfe/Layouts wählen den passenden Reiter (`openLevel`, `switchViewType`, `openLayoutTab`, [182]) |
|
||||
| `view3dFilter.ts` | 3D-Element-Filter ([185], rein UI): „Auswahl in 3D zeigen" (Cmd/Ctrl+3) und temporär ausgeblendete Elemente (Cmd/Ctrl+4); Geschoss-Kürzel Cmd/Ctrl+5/6 in `tabNavigation.ts` |
|
||||
| `selectionActions.ts` | Ablage für Aktionen mit mehreren Eingängen ([190]): Duplizieren, Sperren, Verbinden, Ebenen aus-/einblenden, Einpassen — Tastenkürzel und natives Menü rufen dieselben Funktionen (`runSelectionAction`) |
|
||||
| `groupActions.ts` | Gruppen erzeugen, auflösen, betreten |
|
||||
| `exportScope.ts`, `objectLock.ts` | Export „nur Auswahl"; Objekt-Sperre |
|
||||
| `autosave.ts`, `projectStore.ts`, `recentProjects.ts`, `startupGuard.ts` | Autosave und Wiederherstellen, IndexedDB, zuletzt geöffnet, Start-Protokoll |
|
||||
|
||||
@@ -47,6 +47,25 @@ describe("SHORTCUT_DEFS", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("[190] Archicad-Kürzel", () => {
|
||||
const combo = (id: string) => SHORTCUT_DEFS.find((d) => d.id === id)?.defaultCombo;
|
||||
it("belegt die neuen Kürzel ohne Kollision mit Werkzeug-Ziffern und Buchstaben", () => {
|
||||
expect(combo("duplicate")).toBe("mod+d");
|
||||
expect(combo("toggleLock")).toBe("mod+l");
|
||||
expect(combo("fitAll")).toBe("mod+0");
|
||||
expect(combo("fitSelection")).toBe("mod+shift+f");
|
||||
expect(combo("hideSelectionLayers")).toBe("mod+shift+h");
|
||||
expect(combo("showAllLayers")).toBe("mod+shift+a");
|
||||
// Kein Kürzel doppelt (auch nicht gegen m/s/d/q und 1–0).
|
||||
const all = SHORTCUT_DEFS.map((d) => d.defaultCombo);
|
||||
expect(new Set(all).size).toBe(all.length);
|
||||
// Cmd+D (Duplizieren) und d (Drehen) sind verschiedene Kombinationen.
|
||||
expect(matchesShortcut(key("d"), "duplicate", {})).toBe(false);
|
||||
expect(matchesShortcut(key("d", { metaKey: true }), "duplicate", {})).toBe(true);
|
||||
expect(matchesShortcut(key("d", { metaKey: true }), "transformRotate", {})).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("comboMatches", () => {
|
||||
it("erkennt Ctrl/Cmd+Z (mod+z)", () => {
|
||||
expect(comboMatches(key("z", { ctrlKey: true }), "mod+z")).toBe(true);
|
||||
|
||||
@@ -53,7 +53,13 @@ export type ShortcutId =
|
||||
| "floorUp"
|
||||
| "showSelection3d"
|
||||
| "hideSelection3d"
|
||||
| "objectSettings";
|
||||
| "objectSettings"
|
||||
| "duplicate"
|
||||
| "toggleLock"
|
||||
| "hideSelectionLayers"
|
||||
| "showAllLayers"
|
||||
| "fitAll"
|
||||
| "fitSelection";
|
||||
|
||||
export type ShortcutCategory =
|
||||
| "general"
|
||||
@@ -217,6 +223,13 @@ export const SHORTCUT_DEFS: ShortcutDef[] = [
|
||||
{ id: "hideSelection3d", category: "navigation", labelKey: "shortcut.hideSelection3d", defaultCombo: "mod+4" },
|
||||
// [189] Einstellungsdialog des gewählten Objekts (Archicad Cmd+T), hier schlicht „t".
|
||||
{ id: "objectSettings", category: "edit", labelKey: "shortcut.objectSettings", defaultCombo: "t", bareKeyOnly: true },
|
||||
// [190] Weitere Archicad-Kürzel (Esc = Auswahl leeren / Befehl abbrechen ist fest verdrahtet, s. oben).
|
||||
{ id: "duplicate", category: "edit", labelKey: "shortcut.duplicate", defaultCombo: "mod+d" },
|
||||
{ id: "toggleLock", category: "edit", labelKey: "shortcut.toggleLock", defaultCombo: "mod+l" },
|
||||
{ id: "hideSelectionLayers", category: "navigation", labelKey: "shortcut.hideSelectionLayers", defaultCombo: "mod+shift+h" },
|
||||
{ id: "showAllLayers", category: "navigation", labelKey: "shortcut.showAllLayers", defaultCombo: "mod+shift+a" },
|
||||
{ id: "fitAll", category: "navigation", labelKey: "shortcut.fitAll", defaultCombo: "mod+0" },
|
||||
{ id: "fitSelection", category: "navigation", labelKey: "shortcut.fitSelection", defaultCombo: "mod+shift+f" },
|
||||
];
|
||||
|
||||
const DEFS_BY_ID = new Map<ShortcutId, ShortcutDef>(SHORTCUT_DEFS.map((d) => [d.id, d]));
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
// [190] Kleine Ablage für Aktionen, die mehrere Eingänge haben (Tastenkürzel im Fenster, natives Menü):
|
||||
// Duplizieren, Sperren, Verbinden, Ebenen aus-/einblenden, Einpassen. Die Aktionen leben dort, wo ihr Zustand
|
||||
// ist (`useSelectionCommands`, `App`) und tragen sich bei jedem Render ein; das native Menü (`useNativeMenu`)
|
||||
// ruft sie über `runSelectionAction`, ohne dass der Zustand durch die Menü-Verdrahtung gereicht werden muss.
|
||||
|
||||
export type SelectionActionId =
|
||||
| "duplicate"
|
||||
| "toggleLock"
|
||||
| "join"
|
||||
| "hideLayers"
|
||||
| "showAllLayers"
|
||||
| "fitAll"
|
||||
| "fitSelection";
|
||||
|
||||
const actions: Partial<Record<SelectionActionId, () => void>> = {};
|
||||
|
||||
/** Trägt (oder ersetzt) Aktionen ein; spätere Aufrufe gewinnen. */
|
||||
export function registerSelectionActions(a: Partial<Record<SelectionActionId, () => void>>): void {
|
||||
Object.assign(actions, a);
|
||||
}
|
||||
|
||||
/** Führt die Aktion aus, falls eingetragen (sonst nichts). */
|
||||
export function runSelectionAction(id: SelectionActionId): void {
|
||||
actions[id]?.();
|
||||
}
|
||||
@@ -397,6 +397,7 @@ export function useSplitJoinShortcut(
|
||||
runSplit: (ids: string[]) => void,
|
||||
setSelection: (patch: Partial<Selection>) => void,
|
||||
overrides: ShortcutOverrides,
|
||||
selectedWallIds: string[] = [],
|
||||
): void {
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
@@ -405,7 +406,8 @@ export function useSplitJoinShortcut(
|
||||
const isJoin = !isSplit && matchesShortcut(e, "join", overrides);
|
||||
if (!isSplit && !isJoin) return;
|
||||
const ids = selectedDrawingIds;
|
||||
if (ids.length === 0) return; // nur 2D-Auswahl bedient; Wände → no-op
|
||||
// Teilen: nur 2D-Auswahl. Verbinden ([190]): auch gewählte Wände (Ecken/T-Stösse schliessen).
|
||||
if (isSplit ? ids.length === 0 : ids.length + selectedWallIds.length === 0) return;
|
||||
e.preventDefault();
|
||||
|
||||
if (isSplit) {
|
||||
@@ -420,7 +422,7 @@ export function useSplitJoinShortcut(
|
||||
window.addEventListener("keydown", onKey);
|
||||
return () => window.removeEventListener("keydown", onKey);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [selectedDrawingIds, engine, overrides]);
|
||||
}, [selectedDrawingIds, selectedWallIds, engine, overrides]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -699,3 +701,56 @@ export function useObjectSettingsShortcut(
|
||||
return () => window.removeEventListener("keydown", onKey);
|
||||
}, [overrides, engineRef]);
|
||||
}
|
||||
|
||||
/**
|
||||
* [190] Auswahl-Aktionen mit Archicad-Kürzeln: Cmd/Ctrl+D = Duplizieren (Kopie mit Versatz), Cmd/Ctrl+L =
|
||||
* Sperren/Entsperren, Cmd/Ctrl+Shift+H = Ebenen der Auswahl ausblenden, Cmd/Ctrl+Shift+A = alle Ebenen
|
||||
* einblenden. Die Aktionen selbst liegen in `useSelectionCommands` (auch vom Kontextmenü gebraucht).
|
||||
*/
|
||||
export function useSelectionActionShortcuts(
|
||||
actions: { duplicate: () => void; toggleLock: () => void; hideLayers: () => void; showAllLayers: () => void },
|
||||
overrides: ShortcutOverrides,
|
||||
): void {
|
||||
const ref = useRef(actions);
|
||||
ref.current = actions;
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (isEditableTarget(e)) return;
|
||||
const fn = matchesShortcut(e, "duplicate", overrides)
|
||||
? ref.current.duplicate
|
||||
: matchesShortcut(e, "toggleLock", overrides)
|
||||
? ref.current.toggleLock
|
||||
: matchesShortcut(e, "hideSelectionLayers", overrides)
|
||||
? ref.current.hideLayers
|
||||
: matchesShortcut(e, "showAllLayers", overrides)
|
||||
? ref.current.showAllLayers
|
||||
: null;
|
||||
if (!fn) return;
|
||||
e.preventDefault();
|
||||
fn();
|
||||
};
|
||||
window.addEventListener("keydown", onKey);
|
||||
return () => window.removeEventListener("keydown", onKey);
|
||||
}, [overrides]);
|
||||
}
|
||||
|
||||
/** [190] Cmd/Ctrl+0 = alles einpassen, Cmd/Ctrl+Shift+F = auf Auswahl einpassen (Plan; im 3D-Reiter die Kamera). */
|
||||
export function useFitShortcuts(fitAll: () => void, fitSelection: () => void, overrides: ShortcutOverrides): void {
|
||||
const ref = useRef({ fitAll, fitSelection });
|
||||
ref.current = { fitAll, fitSelection };
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (isEditableTarget(e) && !(e.target as HTMLElement).classList.contains("cmdline-input")) return;
|
||||
const fn = matchesShortcut(e, "fitAll", overrides)
|
||||
? ref.current.fitAll
|
||||
: matchesShortcut(e, "fitSelection", overrides)
|
||||
? ref.current.fitSelection
|
||||
: null;
|
||||
if (!fn) return;
|
||||
e.preventDefault();
|
||||
fn();
|
||||
};
|
||||
window.addEventListener("keydown", onKey);
|
||||
return () => window.removeEventListener("keydown", onKey);
|
||||
}, [overrides]);
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import { t } from "../i18n";
|
||||
import { getState, type RootState } from "./appStore";
|
||||
import { openMeshFileDialog } from "./meshImportStore";
|
||||
import { openPointCloudFileDialog } from "./pointCloudStore";
|
||||
import { runSelectionAction } from "./selectionActions";
|
||||
import { hideSelectionIn3d, showSelectionIn3d, stepActiveFloor } from "./tabNavigation";
|
||||
import type { useDialogState } from "./useDialogState";
|
||||
import type { useProjectFileActions } from "./useProjectFileActions";
|
||||
@@ -163,6 +164,7 @@ export function useNativeMenu(opts: {
|
||||
onFloorStep: stepActiveFloor,
|
||||
onShowSelection3d: showSelectionIn3d,
|
||||
onHideSelection3d: hideSelectionIn3d,
|
||||
onSelectionAction: runSelectionAction,
|
||||
onToggleResources: () => toggleResources(),
|
||||
onOpenSettings: () => openSettings(),
|
||||
onOpenPanel: (panelId) => setLayout((l) => revealPanel(l, panelId)),
|
||||
|
||||
@@ -18,7 +18,10 @@ import { applyDrawingStyleOps, readDrawingStyle } from "../editors/matchProps";
|
||||
import { cutSegmentOps, splitOps } from "../editors/splitJoin";
|
||||
import type { BooleanResult } from "../editors/booleanOps";
|
||||
import type { EngineView } from "../commands/engine";
|
||||
import { clearKinds, fromIdLists, hasTransformable, isEmpty, toMembership } from "./selection";
|
||||
import { clearKinds, fromIdLists, hasTransformable, isEmpty, toMembership, toTransformSelection } from "./selection";
|
||||
import { registerSelectionActions } from "./selectionActions";
|
||||
import { transformOps } from "../tools/transform";
|
||||
import { addedIds, type PastedIds } from "../editors/elementClipboard";
|
||||
import { containingGroupId, EMPTY_MEMBERSHIP } from "./groupActions";
|
||||
import type { GroupMembership, MemberKind } from "./groupActions";
|
||||
import { isLocked, lockMembersOps } from "./objectLock";
|
||||
@@ -28,6 +31,7 @@ import {
|
||||
useBooleanOpsShortcut,
|
||||
useGroupShortcut,
|
||||
useSelectAllAndDeleteShortcut,
|
||||
useSelectionActionShortcuts,
|
||||
useSplitJoinShortcut,
|
||||
useTransformShortcuts,
|
||||
useViewNavigationShortcuts,
|
||||
@@ -192,7 +196,7 @@ export function useSelectionCommands(opts: {
|
||||
|
||||
// Ctrl/Cmd+S = Split, Ctrl/Cmd+J = Join der selektierten Drawing2D-Elemente —
|
||||
// siehe state/useKeyboardShortcuts.ts.
|
||||
useSplitJoinShortcut(selection.drawings, engine, runSplit, setSelection, shortcutOverrides);
|
||||
useSplitJoinShortcut(selection.drawings, engine, runSplit, setSelection, shortcutOverrides, selection.walls);
|
||||
|
||||
// Ctrl/Cmd+Shift+U/D/I = Boolean Vereinigung/Subtraktion/Schnitt — siehe
|
||||
// state/useKeyboardShortcuts.ts. (Ctrl/Cmd+C/V-Kopieren/Einfügen folgt weiter
|
||||
@@ -258,6 +262,20 @@ export function useSelectionCommands(opts: {
|
||||
const codes = new Set(selectionLayerCodes);
|
||||
applyChange((p) => fieldOps(p, "layers", setCategoriesVisible(p.layers, codes, false)));
|
||||
};
|
||||
// [190] Alle Ebenen wieder einblenden (Cmd/Ctrl+Shift+A, Gegenstück zu „Ebenen der Auswahl ausblenden").
|
||||
const showAllLayers = () =>
|
||||
applyChange((p) => fieldOps(p, "layers", setCategoriesVisible(p.layers, new Set(p.layers.map((l) => l.code)), true)));
|
||||
// [190] Cmd/Ctrl+D: gewählte Elemente duplizieren — Kopie mit Versatz (0.5 m rechts/unten), die Kopie ist danach gewählt.
|
||||
const duplicateSelection = () => {
|
||||
if (!hasTransformable(selection)) return;
|
||||
const out: { ids?: PastedIds } = {};
|
||||
applyChange((p) => {
|
||||
const ops = transformOps(p, toTransformSelection(selection), "move", [{ x: 0, y: 0 }, { x: 0.5, y: -0.5 }], "copy", 1);
|
||||
out.ids = addedIds(ops);
|
||||
return ops;
|
||||
});
|
||||
if (out.ids) setSelection(fromIdLists(out.ids));
|
||||
};
|
||||
const isolateSelectionLayers = () => {
|
||||
const { selectionLayerCodes } = menuState(true);
|
||||
if (selectionLayerCodes.length === 0) return;
|
||||
@@ -307,6 +325,24 @@ 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: [] });
|
||||
};
|
||||
registerSelectionActions({
|
||||
duplicate: duplicateSelection,
|
||||
toggleLock: toggleSelectionLock,
|
||||
join: joinSelection,
|
||||
hideLayers: hideSelectionLayers,
|
||||
showAllLayers,
|
||||
});
|
||||
// [190] Cmd/Ctrl+D/L, Cmd/Ctrl+Shift+H/A.
|
||||
useSelectionActionShortcuts(
|
||||
{ duplicate: duplicateSelection, toggleLock: toggleSelectionLock, hideLayers: hideSelectionLayers, showAllLayers },
|
||||
shortcutOverrides,
|
||||
);
|
||||
|
||||
// Doppelklick auf ein gruppiertes Element → Gruppe betreten (Isolation):
|
||||
// alles ausserhalb wird gedimmt/gesperrt gerendert (s. viewportContent.tsx/
|
||||
|
||||
Reference in new issue
Block a user