Nordstern-3D: Klick-Auswahl von Bauteilen (Raycast)

Links-Klick auf eine Wand/Decke im 3D-Viewport selektiert das Bauteil
(TS-Raycast gegen OBB der Wände + extrudierte Deckenprismen), setzt die
Store-Selektion (setSelectedWallIds/setSelectedCeilingIds, Shift/Ctrl =
additiv) → Attribute- und Objekt-Info-Panel zeigen das Bauteil. Erster
Schritt zur 3D-Editierbarkeit.

- raycast3d.ts: reine Kamera-Strahl-/Schnitt-Mathematik (10 Unit-Tests).
- toWalls3d.ts: wallId/ceilingId in die 3D-Records + pickGeometry();
  Serde-Pfad unberührt (keine deny_unknown_fields, Extrafelder werden
  Rust-seitig ignoriert).
- Klick-vs-Drag-Schwelle (4px) trennt Auswahl von Orbit; Leertreffer
  leert die Auswahl.
This commit is contained in:
2026-07-04 06:17:45 +02:00
parent 6ef57b6b6b
commit ac0d9efc84
6 changed files with 547 additions and 15 deletions
+6 -1
View File
@@ -45,6 +45,7 @@ import {
} from "../model/wall";
import { MaterialRuntime } from "../materials/runtime";
import { Wasm3DViewport } from "./Wasm3DViewport";
import type { Pick3dHit } from "./Wasm3DViewport";
import type { RenderMode, View3d } from "../ui/TopBar";
import type { ToolDraft } from "../tools/types";
import { applyAngleConstraint } from "../tools/snapping";
@@ -124,9 +125,12 @@ export function Viewport3D(
/** Klick auf den Grid-Umschalter-Button im WASM-Viewport — Single Source
* of Truth bleibt der Aufrufer (App/viewSlice `grid3dVisible`). */
onToggleGrid?: () => void;
/** Links-Klick-Auswahl im WASM-Viewport (TS-Raycast) — wirkt NUR im WASM-Pfad;
* die three.js-Sicht nutzt weiter `onSelectWall`/`onSelectCeiling`. */
onPick3d?: (hit: Pick3dHit, additive: boolean) => void;
},
) {
const { gridVisible, onToggleGrid, ...threeProps } = props;
const { gridVisible, onToggleGrid, onPick3d, ...threeProps } = props;
if (WASM_ENGINE_ACTIVE) {
return (
<Wasm3DViewport
@@ -136,6 +140,7 @@ export function Viewport3D(
gridVisible={gridVisible}
groundElevation={props.gridElevation}
onToggleGrid={onToggleGrid}
onPick3d={onPick3d}
/>
);
}