Polylinie: Punkttypen Eckpunkt/Bogenpunkt/Splinepunkt (Kontextmenue), keine Bogen-Griffe mehr an geraden Segmenten
This commit is contained in:
1 parent
dc6ab429f2
commit
94d5d0bc0a
8 files changed
+293
-2
No files matched your search
@@ -8,6 +8,7 @@
|
||||
// laufen. Die Slice tippt daher nur ihre eigenen Felder; `get()` liefert
|
||||
// RootState (siehe appStore.ts), wir greifen punktuell auf View-Felder zu.
|
||||
|
||||
import { withVertexType, type PolylineVertexType } from "../geometry/polylineVertexType";
|
||||
import { sampleProject } from "../model/sampleProject";
|
||||
import {
|
||||
flattenCategories,
|
||||
@@ -182,6 +183,12 @@ export interface ProjectSlice {
|
||||
* Polylinie braucht ≥2, geschlossene ≥3.
|
||||
*/
|
||||
deleteDrawingPoint: (drawingId: string, index: number) => void;
|
||||
/**
|
||||
* Punkttyp eines Polylinien-Stützpunkts setzen (Eckpunkt/Bogenpunkt/Splinepunkt),
|
||||
* s. `geometry/polylineVertexType.ts` — rechnet nur die Bulges der beiden
|
||||
* anliegenden Segmente um.
|
||||
*/
|
||||
setPolylineVertexType: (drawingId: string, index: number, type: PolylineVertexType) => void;
|
||||
|
||||
// ── Editier-Griffe + Body-Move des selektierten Elements ──────────────────
|
||||
moveGripOf: (
|
||||
@@ -1126,6 +1133,18 @@ export function createProjectSlice(
|
||||
}),
|
||||
})),
|
||||
|
||||
setPolylineVertexType: (drawingId, index, type) =>
|
||||
setProject((p) => ({
|
||||
...p,
|
||||
drawings2d: p.drawings2d.map((d) => {
|
||||
if (d.id !== drawingId || d.geom.shape !== "polyline" || d.locked) return d;
|
||||
const g = d.geom;
|
||||
const bulge = withVertexType(g, index, type);
|
||||
const { bulge: _old, ...rest } = g;
|
||||
return { ...d, geom: bulge.some((b) => b !== 0) ? { ...rest, bulge } : rest };
|
||||
}),
|
||||
})),
|
||||
|
||||
deleteDrawingPoint: (drawingId, index) =>
|
||||
setProject((p) => {
|
||||
const d = p.drawings2d.find((x) => x.id === drawingId);
|
||||
|
||||
@@ -120,6 +120,7 @@ export function useProjectActions(
|
||||
const setBuiltinPaletteVisible = useStore((s) => s.setBuiltinPaletteVisible);
|
||||
const insertDrawingPoint = useStore((s) => s.insertDrawingPoint);
|
||||
const deleteDrawingPoint = useStore((s) => s.deleteDrawingPoint);
|
||||
const setPolylineVertexType = useStore((s) => s.setPolylineVertexType);
|
||||
// Wandstile: immutable Patch eines Wandtyps (z. B. Schichtfugen-Stile). Kein
|
||||
// eigener Store-Slice nötig — läuft direkt über setProject wie die übrigen
|
||||
// Ressourcen-Mutationen.
|
||||
@@ -468,6 +469,7 @@ export function useProjectActions(
|
||||
setBuiltinPaletteVisible,
|
||||
insertDrawingPoint,
|
||||
deleteDrawingPoint,
|
||||
setPolylineVertexType,
|
||||
patchWallType,
|
||||
setOverrideRules,
|
||||
patchCeilingType,
|
||||
|
||||
Reference in new issue
Block a user