Support committing transformations for multiple path points
This commit is contained in:
@@ -3,6 +3,7 @@ import { createApplyBatchSelectionTransformCommand } from "./apply-batch-selecti
|
|||||||
import { createResizeBoxBrushCommand } from "./resize-box-brush-command";
|
import { createResizeBoxBrushCommand } from "./resize-box-brush-command";
|
||||||
import { createRotateBoxBrushCommand } from "./rotate-box-brush-command";
|
import { createRotateBoxBrushCommand } from "./rotate-box-brush-command";
|
||||||
import { createSetPathPointPositionCommand } from "./set-path-point-position-command";
|
import { createSetPathPointPositionCommand } from "./set-path-point-position-command";
|
||||||
|
import { createSetPathPointPositionsCommand } from "./set-path-point-positions-command";
|
||||||
import { createSetBoxBrushTransformCommand } from "./set-box-brush-transform-command";
|
import { createSetBoxBrushTransformCommand } from "./set-box-brush-transform-command";
|
||||||
import { createUpsertEntityCommand } from "./upsert-entity-command";
|
import { createUpsertEntityCommand } from "./upsert-entity-command";
|
||||||
import { createUpsertModelInstanceCommand } from "./upsert-model-instance-command";
|
import { createUpsertModelInstanceCommand } from "./upsert-model-instance-command";
|
||||||
@@ -52,6 +53,12 @@ function createTransformCommandLabel(session: ActiveTransformSession): string {
|
|||||||
case "pathPoint":
|
case "pathPoint":
|
||||||
targetLabel = "path point";
|
targetLabel = "path point";
|
||||||
break;
|
break;
|
||||||
|
case "pathPoints":
|
||||||
|
targetLabel =
|
||||||
|
session.target.items.length === 1
|
||||||
|
? "path point"
|
||||||
|
: `${session.target.items.length} path points`;
|
||||||
|
break;
|
||||||
case "entity":
|
case "entity":
|
||||||
targetLabel =
|
targetLabel =
|
||||||
session.target.entityKind === "cameraRig"
|
session.target.entityKind === "cameraRig"
|
||||||
@@ -330,6 +337,19 @@ export function createCommitTransformSessionCommand(
|
|||||||
position: session.preview.position,
|
position: session.preview.position,
|
||||||
label: createTransformCommandLabel(session)
|
label: createTransformCommandLabel(session)
|
||||||
});
|
});
|
||||||
|
case "pathPoints":
|
||||||
|
if (session.preview.kind !== "pathPoints") {
|
||||||
|
throw new Error("Path point multi-transform preview is invalid.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return createSetPathPointPositionsCommand({
|
||||||
|
pathId: session.target.pathId,
|
||||||
|
updates: session.preview.items.map((item) => ({
|
||||||
|
pointId: item.pointId,
|
||||||
|
position: item.position
|
||||||
|
})),
|
||||||
|
label: createTransformCommandLabel(session)
|
||||||
|
});
|
||||||
case "modelInstance": {
|
case "modelInstance": {
|
||||||
if (session.preview.kind !== "modelInstance") {
|
if (session.preview.kind !== "modelInstance") {
|
||||||
throw new Error("Model instance transform preview is invalid.");
|
throw new Error("Model instance transform preview is invalid.");
|
||||||
|
|||||||
Reference in New Issue
Block a user