diff options
| author | Maze <mazewinther@gmail.com> | 2026-04-05 13:15:58 +0200 |
|---|---|---|
| committer | Maze <mazewinther@gmail.com> | 2026-04-05 13:15:58 +0200 |
| commit | 1bd9fac203f09736c1225bbbe19e5d7cc31c0b93 (patch) | |
| tree | d5c65add056209043e627a53e47e6ebbf74e64c6 /apps/web/src/hooks/timeline/element/use-keyframe-drag.ts | |
| parent | 69da5bee0c50f331ec59a510d0cf0d45779bab31 (diff) | |
| download | opencut-1bd9fac203f09736c1225bbbe19e5d7cc31c0b93.tar.gz | |
refactor: rewrite animation system to use bindings and scalar channels
Diffstat (limited to 'apps/web/src/hooks/timeline/element/use-keyframe-drag.ts')
| -rw-r--r-- | apps/web/src/hooks/timeline/element/use-keyframe-drag.ts | 10 |
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, |
