summaryrefslogtreecommitdiff
path: root/apps/web/src/hooks/timeline
diff options
context:
space:
mode:
Diffstat (limited to 'apps/web/src/hooks/timeline')
-rw-r--r--apps/web/src/hooks/timeline/element/use-keyframe-drag.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/apps/web/src/hooks/timeline/element/use-keyframe-drag.ts b/apps/web/src/hooks/timeline/element/use-keyframe-drag.ts
index bbe843f2..b66bbea8 100644
--- a/apps/web/src/hooks/timeline/element/use-keyframe-drag.ts
+++ b/apps/web/src/hooks/timeline/element/use-keyframe-drag.ts
@@ -6,6 +6,7 @@ import {
type MouseEvent as ReactMouseEvent,
} from "react";
import { useEditor } from "@/hooks/use-editor";
+import { getKeyframeById } from "@/lib/animation";
import { useKeyframeSelection } from "./use-keyframe-selection";
import { snapTimeToFrame, getSnappedSeekTime } from "opencut-wasm";
import { timelineTimeToSnappedPixels } from "@/lib/timeline";
@@ -84,10 +85,11 @@ export function useKeyframeDrag({
deltaTime: number;
}) => {
const commands: Command[] = keyframeRefs.flatMap((keyframeRef) => {
- const channel = element.animations?.channels[keyframeRef.propertyPath];
- const keyframe = channel?.keyframes.find(
- (keyframe) => keyframe.id === keyframeRef.keyframeId,
- );
+ const keyframe = getKeyframeById({
+ animations: element.animations,
+ propertyPath: keyframeRef.propertyPath,
+ keyframeId: keyframeRef.keyframeId,
+ });
if (!keyframe) return [];
const nextTime = Math.max(
0,