[193] Gelände & Co.: Höhen-Befehle im Kern, Maus-Ziehen für Kontext-Elemente, Höhenlinien-Punkte als Griffe, Entf auf Ansichts-Schlagschatten
This commit is contained in:
24 files changed
+530
-71
No files matched your search
@@ -0,0 +1,23 @@
|
||||
// [193] Maus-Ziehen von Gelände-/Umgebungs-Elementen im Plan: Bezugspunkt für den Fang.
|
||||
// Das Verschieben selbst (Ops) und die Vorschau stammen aus dem Kern (`cmd_transform.rs`).
|
||||
|
||||
import type { Project, Vec2 } from "../model/types";
|
||||
|
||||
/** Ein Punkt des Elements (erste Ecke / erster Punkt / Rahmen-Ecke), der beim Ziehen am Fang teilnimmt. */
|
||||
export function contextAnchor(project: Project, id: string): Vec2 | null {
|
||||
const o = (project.context ?? []).find((c) => c.id === id);
|
||||
if (!o) return null;
|
||||
switch (o.type) {
|
||||
case "excavation":
|
||||
return o.outline[0] ?? null;
|
||||
case "contourSet":
|
||||
return o.contours.find((c) => c.pts.length > 0)?.pts[0] ?? null;
|
||||
case "terrainMesh":
|
||||
case "importedMesh":
|
||||
return o.positions.length >= 2 ? { x: o.positions[0], y: o.positions[1] } : null;
|
||||
case "image":
|
||||
return o.min;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user