diff options
Diffstat (limited to 'src/client/views/nodes/CollectionFreeFormDocumentView.tsx')
-rw-r--r-- | src/client/views/nodes/CollectionFreeFormDocumentView.tsx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx index 57f484214..a4120f958 100644 --- a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx +++ b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx @@ -100,13 +100,14 @@ export class CollectionFreeFormDocumentView extends DocComponent<CollectionFreeF } public static setupKeyframes(docs: Doc[], timecode: number, collection: Doc) { - docs.forEach(doc => { - doc["x-indexed"] = new List<number>(numberRange(timecode).map(i => undefined) as any as number[]); - doc["y-indexed"] = new List<number>(numberRange(timecode).map(i => undefined) as any as number[]); - doc["opacity-indexed"] = new List<number>(numberRange(timecode).map(i => 0)); - (doc["x-indexed"] as any).push(NumCast(doc.x)); - (doc["y-indexed"] as any).push(NumCast(doc.y)); - (doc["opacity-indexed"] as any).push(NumCast(doc.opacity, 1)); + docs.forEach((doc, i) => { + const xlist = new List<number>(numberRange(timecode + 1).map(i => undefined) as any as number[]); + const ylist = new List<number>(numberRange(timecode + 1).map(i => undefined) as any as number[]); + xlist[Math.max(i - 1)] = xlist[timecode + 1] = NumCast(doc.x); + ylist[Math.max(i - 1)] = ylist[timecode + 1] = NumCast(doc.y); + doc["x-indexed"] = xlist; + doc["y-indexed"] = ylist; + doc["opacity-indexed"] = new List<number>(numberRange(timecode).map(i => 1)); doc.displayTimecode = ComputedField.MakeFunction("collection ? collection.currentTimecode : 0", {}, { collection }); doc.x = ComputedField.MakeInterpolated("x", "displayTimecode"); doc.y = ComputedField.MakeInterpolated("y", "displayTimecode"); |