From afa6b2c1d554769d3c863e7592a47cd8838dedad Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Tue, 12 May 2026 22:06:51 +0200 Subject: [PATCH] Implement multi-point transformation target for path points --- src/core/transform-session.ts | 69 +++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/src/core/transform-session.ts b/src/core/transform-session.ts index ae808dcc..783e943b 100644 --- a/src/core/transform-session.ts +++ b/src/core/transform-session.ts @@ -2066,6 +2066,62 @@ function createPathPointTransformTarget( }; } +function createPathPointsTransformTarget( + document: SceneDocument, + pathId: string, + pointIds: string[], + activeSelectionId: string | null +): TransformTargetResolution { + const items: PathPointTransformTarget[] = []; + + if (pointIds.length === 0) { + return { + target: null, + message: "Select at least one path point before transforming it." + }; + } + + for (const pointId of pointIds) { + const itemResolution = createPathPointTransformTarget( + document, + pathId, + pointId + ); + + if ( + itemResolution.target === null || + itemResolution.target.kind !== "pathPoint" + ) { + return itemResolution; + } + + items.push(itemResolution.target); + } + + const activePointId = resolveActiveTransformTargetId( + pointIds, + activeSelectionId + ); + + if (activePointId === null) { + return { + target: null, + message: "Select at least one path point before transforming it." + }; + } + + return { + target: { + kind: "pathPoints", + pathId, + activePointId, + initialPivot: averageVec3(items.map((item) => item.initialPosition)), + items + }, + message: null + }; +} + export function resolveTransformTarget( document: SceneDocument, selection: EditorSelection, @@ -2174,6 +2230,19 @@ export function resolveTransformTarget( selection.pathId, selection.pointId ); + case "pathPoints": + return selection.pointIds.length === 1 + ? createPathPointTransformTarget( + document, + selection.pathId, + selection.pointIds[0]! + ) + : createPathPointsTransformTarget( + document, + selection.pathId, + selection.pointIds, + activeSelectionId + ); case "modelInstances": if (selection.ids.length === 0) { return {