From 552f19a7f5408dc5c1121b151ee20e6f9b279211 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Tue, 12 May 2026 23:34:58 +0200 Subject: [PATCH] Feat: Add path terrain glue and offset controls --- src/app/App.tsx | 37 +++++++++++++++++++++++ src/document/scene-document-validation.ts | 1 - 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/app/App.tsx b/src/app/App.tsx index 448489c7..29dee952 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -239,6 +239,7 @@ import { getScenePathPointIndex, getScenePaths, normalizeScenePathSampledResolution, + normalizeScenePathTerrainOffset, normalizeScenePathName, type ScenePath, type ScenePathCurveMode, @@ -9605,6 +9606,8 @@ export function App({ loop: selectedPath.loop, curveMode: selectedPath.curveMode, sampledResolution: selectedPath.sampledResolution, + glueToTerrain: selectedPath.glueToTerrain, + terrainOffset: selectedPath.terrainOffset, points: selectedPath.points.map((point, index) => ({ id: point.id, position: readVec3Draft( @@ -9676,6 +9679,40 @@ export function App({ commitPathChange(selectedPath, nextPath, "Updated Path spline resolution."); }; + const handlePathGlueToTerrainChange = (glueToTerrain: boolean) => { + if (selectedPath === null) { + setStatusMessage("Select a path before changing terrain glue."); + return; + } + + const nextPath = createScenePath({ + ...selectedPath, + glueToTerrain + }); + + commitPathChange( + selectedPath, + nextPath, + glueToTerrain + ? "Enabled Path terrain glue." + : "Disabled Path terrain glue." + ); + }; + + const handlePathTerrainOffsetChange = (terrainOffset: number) => { + if (selectedPath === null) { + setStatusMessage("Select a path before changing terrain offset."); + return; + } + + const nextPath = createScenePath({ + ...selectedPath, + terrainOffset: normalizeScenePathTerrainOffset(terrainOffset) + }); + + commitPathChange(selectedPath, nextPath, "Updated Path terrain offset."); + }; + const handlePathPointDraftChange = ( pointIndex: number, axis: keyof Vec3Draft, diff --git a/src/document/scene-document-validation.ts b/src/document/scene-document-validation.ts index cae05a8a..39e0d85a 100644 --- a/src/document/scene-document-validation.ts +++ b/src/document/scene-document-validation.ts @@ -79,7 +79,6 @@ import { MAX_SCENE_PATH_SAMPLED_RESOLUTION, MIN_SCENE_PATH_POINT_COUNT, MIN_SCENE_PATH_SAMPLED_RESOLUTION, - normalizeScenePathTerrainOffset, isScenePathCurveMode, type ScenePath } from "./paths";