Add functions to get scene path point index and details

This commit is contained in:
2026-04-13 22:25:01 +02:00
parent 0ab52afb10
commit 2b34849847

View File

@@ -304,6 +304,21 @@ export function getScenePathLabel(path: ScenePath, index: number): string {
return path.name ?? `Path ${index + 1}`;
}
export function getScenePathPointIndex(
path: Pick<ScenePath, "points">,
pointId: string
): number {
return path.points.findIndex((point) => point.id === pointId);
}
export function getScenePathPoint(
path: Pick<ScenePath, "points">,
pointId: string
): ScenePathPoint | null {
const pointIndex = getScenePathPointIndex(path, pointId);
return pointIndex === -1 ? null : cloneScenePathPoint(path.points[pointIndex]);
}
export function createAppendedScenePathPoint(path: ScenePath): ScenePathPoint {
const lastPoint = path.points.at(-1);
const previousPoint =