mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-07 18:26:17 +00:00
Extract shared utilities to reduce duplication across timeline components: - PlayheadIndicator: shared playhead rendering (was duplicated in TimelineCanvas and TimelineEditorNotice) - useContextMenuDismiss: outside-click/Escape dismiss pattern (was duplicated in ClipContextMenu and KeyframeDiamondContextMenu) - TimelineCallbacks: shared callback interfaces for drop and edit operations (was duplicated in NLELayout and Timeline props) - useTimelineZoom: consolidated zoom store selectors - timelineElementSplit: shared canSplitElement, buildPatchTarget, and readFileContent utilities - gsapParser.test-helpers: shared test utilities for parser specs
19 lines
765 B
TypeScript
19 lines
765 B
TypeScript
// fallow-ignore-file dead-code
|
|
import { usePlayerStore, type ZoomMode } from "../store/playerStore";
|
|
|
|
export interface TimelineZoomState {
|
|
zoomMode: ZoomMode;
|
|
manualZoomPercent: number;
|
|
setZoomMode: (mode: ZoomMode) => void;
|
|
setManualZoomPercent: (percent: number) => void;
|
|
}
|
|
|
|
/** Shared zoom-related store selectors used by Timeline and TimelineToolbar. */
|
|
export function useTimelineZoom(): TimelineZoomState {
|
|
const zoomMode = usePlayerStore((s) => s.zoomMode);
|
|
const manualZoomPercent = usePlayerStore((s) => s.manualZoomPercent);
|
|
const setZoomMode = usePlayerStore((s) => s.setZoomMode);
|
|
const setManualZoomPercent = usePlayerStore((s) => s.setManualZoomPercent);
|
|
return { zoomMode, manualZoomPercent, setZoomMode, setManualZoomPercent };
|
|
}
|