Files
hyperframes/packages/studio/src/hooks/useTimelineAddAtPlayhead.ts
T
Miguel Ángel 2b65b4efce fix(studio): harden composition timeline reliability (#2615)
* fix(studio): preserve composition playback continuity

* feat(studio): drag compositions into the timeline

* fix(studio): collapse expanded composition move aliases

* fix(studio): make timeline cuts atomic

* fix(studio): group inspector gesture history

* test(studio): cover masked text selection

* fix(studio): harden composition timeline reliability

* fix(studio): satisfy CI source gates

* fix(studio): harden composition mutation requests
2026-07-17 14:15:30 -04:00

16 lines
613 B
TypeScript

import { useCallback } from "react";
import { usePlayerStore } from "../player";
type AddAtPlacement = (path: string, placement: { start: number; track: number }) => unknown;
export function useTimelineAddAtPlayhead(addAsset: AddAtPlacement, addComposition: AddAtPlacement) {
const placement = () => ({ start: usePlayerStore.getState().currentTime, track: 0 });
return {
addAssetAtPlayhead: useCallback((path: string) => addAsset(path, placement()), [addAsset]),
addCompositionAtPlayhead: useCallback(
(path: string) => addComposition(path, placement()),
[addComposition],
),
};
}