diff --git a/src/commands/delete-path-command.ts b/src/commands/delete-path-command.ts index cf08a01b..b6451737 100644 --- a/src/commands/delete-path-command.ts +++ b/src/commands/delete-path-command.ts @@ -6,7 +6,10 @@ import { cloneScenePath, type ScenePath } from "../document/paths"; import type { EditorCommand } from "./command"; function selectionIncludesPath(selection: EditorSelection, pathId: string): boolean { - return selection.kind === "paths" && selection.ids.includes(pathId); + return ( + (selection.kind === "paths" && selection.ids.includes(pathId)) || + (selection.kind === "pathPoint" && selection.pathId === pathId) + ); } export function createDeletePathCommand(pathId: string): EditorCommand { diff --git a/src/core/transform-session.ts b/src/core/transform-session.ts index 2ca20832..41afaa92 100644 --- a/src/core/transform-session.ts +++ b/src/core/transform-session.ts @@ -1067,7 +1067,7 @@ export function resolveTransformTarget( return { target: null, message: - "Select a single brush, entity, or model instance before transforming it." + "Select a single brush, path point, entity, or model instance before transforming it." }; case "brushFace": if (whiteboxSelectionMode !== "face") { @@ -1138,7 +1138,7 @@ export function resolveTransformTarget( return { target: null, message: - "Path transforms are not available in this slice. Edit path points in the Inspector." + "Select a path point before transforming a path." }; case "pathPoint": return createPathPointTransformTarget( diff --git a/src/viewport-three/viewport-focus.ts b/src/viewport-three/viewport-focus.ts index 22da1f5b..ac3db939 100644 --- a/src/viewport-three/viewport-focus.ts +++ b/src/viewport-three/viewport-focus.ts @@ -2,7 +2,8 @@ import { getSingleSelectedBrushId, getSingleSelectedEntityId, getSingleSelectedModelInstanceId, - getSingleSelectedPathId, + getSingleSelectedPathOwnerId, + getSingleSelectedPathPoint, type EditorSelection } from "../core/selection"; import type { Vec3 } from "../core/vector"; @@ -246,6 +247,22 @@ function createPathFocusTarget(path: ScenePath): ViewportFocusTarget | null { return finishBounds(bounds); } +function createPathPointFocusTarget(position: Vec3): ViewportFocusTarget { + return createBoundsFocusTarget( + { + x: position.x, + y: position.y, + z: position.z + }, + { + x: 0.25, + y: 0.25, + z: 0.25 + }, + 0.5 + ); +} + function includeSphereEntity(bounds: FocusBoundsAccumulator, position: Vec3, radius: number) { includeBounds( bounds, @@ -417,7 +434,20 @@ export function resolveViewportFocusTarget(document: SceneDocument, selection: E } } - const selectedPathId = getSingleSelectedPathId(selection); + const selectedPathPoint = getSingleSelectedPathPoint(selection); + + if (selectedPathPoint !== null) { + const path = document.paths[selectedPathPoint.pathId]; + const point = path?.points.find( + (candidatePoint) => candidatePoint.id === selectedPathPoint.pointId + ); + + if (point !== undefined) { + return createPathPointFocusTarget(point.position); + } + } + + const selectedPathId = getSingleSelectedPathOwnerId(selection); if (selectedPathId !== null) { const path = document.paths[selectedPathId];