summaryrefslogtreecommitdiff
path: root/apps/web/src/timeline
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2026-04-26 03:06:13 +0200
committerMaze Winther <mazewinther@gmail.com>2026-04-26 03:06:13 +0200
commite6c6193638e4247ff1e6f2df40de2a057112c773 (patch)
treea467607adc00bb7eaa70c890a445712221fd1e58 /apps/web/src/timeline
parent685d9027409e7f19ee2dbd5fd91a0837c00eb60b (diff)
downloadopencut-e6c6193638e4247ff1e6f2df40de2a057112c773.tar.gz
fix: linter
Diffstat (limited to 'apps/web/src/timeline')
-rw-r--r--apps/web/src/timeline/components/timeline-element.tsx33
-rw-r--r--apps/web/src/timeline/hooks/use-timeline-playhead.ts6
2 files changed, 23 insertions, 16 deletions
diff --git a/apps/web/src/timeline/components/timeline-element.tsx b/apps/web/src/timeline/components/timeline-element.tsx
index e0eeb378..d85288b1 100644
--- a/apps/web/src/timeline/components/timeline-element.tsx
+++ b/apps/web/src/timeline/components/timeline-element.tsx
@@ -49,7 +49,12 @@ import {
import { buildWaveformGainSamples } from "@/timeline/audio-state";
import { getTimelinePixelsPerSecond } from "@/timeline";
import { buildWaveformSourceKey } from "@/media/waveform-summary";
-import { addMediaTime, TICKS_PER_SECOND, ZERO_MEDIA_TIME } from "@/wasm";
+import {
+ addMediaTime,
+ type MediaTime,
+ TICKS_PER_SECOND,
+ ZERO_MEDIA_TIME,
+} from "@/wasm";
import {
getActionDefinition,
type TAction,
@@ -96,7 +101,7 @@ const PixelsPerSecondContext = createContext<number | null>(null);
const THUMBNAIL_ASPECT_RATIO = 16 / 9;
interface KeyframeIndicator {
- time: number;
+ time: MediaTime;
offsetPx: number;
keyframes: SelectedKeyframeRef[];
}
@@ -112,11 +117,11 @@ export function buildKeyframeIndicator({
keyframe: ElementKeyframe;
trackId: string;
elementId: string;
- displayedStartTime: number;
+ displayedStartTime: MediaTime;
zoomLevel: number;
elementLeft: number;
}): {
- time: number;
+ time: MediaTime;
offsetPx: number;
keyframeRef: SelectedKeyframeRef;
} {
@@ -149,7 +154,7 @@ export function getKeyframeIndicators({
keyframes: ElementKeyframe[];
trackId: string;
elementId: string;
- displayedStartTime: number;
+ displayedStartTime: MediaTime;
zoomLevel: number;
elementLeft: number;
elementWidth: number;
@@ -158,7 +163,7 @@ export function getKeyframeIndicators({
return [];
}
- const keyframesByTime = new Map<number, KeyframeIndicator>();
+ const keyframesByTime = new Map<MediaTime, KeyframeIndicator>();
for (const keyframe of keyframes) {
const indicator = buildKeyframeIndicator({
keyframe,
@@ -662,7 +667,7 @@ function KeyframeIndicators({
}: {
indicators: KeyframeIndicator[];
dragState: KeyframeDragState;
- displayedStartTime: number;
+ displayedStartTime: MediaTime;
elementLeft: number;
onKeyframeMouseDown: (params: {
event: React.MouseEvent;
@@ -672,13 +677,13 @@ function KeyframeIndicators({
event: React.MouseEvent;
keyframes: SelectedKeyframeRef[];
orderedKeyframes: SelectedKeyframeRef[];
- indicatorTime: number;
+ indicatorTime: MediaTime;
}) => void;
getVisualOffsetPx: (params: {
- indicatorTime: number;
+ indicatorTime: MediaTime;
indicatorOffsetPx: number;
isBeingDragged: boolean;
- displayedStartTime: number;
+ displayedStartTime: MediaTime;
elementLeft: number;
}) => number;
}) {
@@ -756,7 +761,7 @@ function ExpandedKeyframeLanes({
keyframes: ElementKeyframe[];
trackId: string;
elementId: string;
- displayedStartTime: number;
+ displayedStartTime: MediaTime;
zoomLevel: number;
elementLeft: number;
keyframeDragState: KeyframeDragState;
@@ -777,13 +782,13 @@ function ExpandedKeyframeLanes({
event: React.MouseEvent;
keyframes: SelectedKeyframeRef[];
orderedKeyframes: SelectedKeyframeRef[];
- indicatorTime: number;
+ indicatorTime: MediaTime;
}) => void;
getVisualOffsetPx: (params: {
- indicatorTime: number;
+ indicatorTime: MediaTime;
indicatorOffsetPx: number;
isBeingDragged: boolean;
- displayedStartTime: number;
+ displayedStartTime: MediaTime;
elementLeft: number;
}) => number;
}) {
diff --git a/apps/web/src/timeline/hooks/use-timeline-playhead.ts b/apps/web/src/timeline/hooks/use-timeline-playhead.ts
index 6fbf2147..0ec39f69 100644
--- a/apps/web/src/timeline/hooks/use-timeline-playhead.ts
+++ b/apps/web/src/timeline/hooks/use-timeline-playhead.ts
@@ -102,7 +102,7 @@ export function useTimelinePlayhead({
) as MediaTime;
const shouldSnap = snappingEnabled && !isShiftHeldRef.current;
- const time = (() => {
+ const time: MediaTime = (() => {
if (!shouldSnap) return frameTime;
const tracks = editor.scenes.getActiveScene().tracks;
const bookmarks = editor.scenes.getActiveScene()?.bookmarks ?? [];
@@ -118,7 +118,9 @@ export function useTimelinePlayhead({
snapPoints,
maxSnapDistance: getTimelineSnapThresholdInTicks({ zoomLevel }),
});
- return snapResult.snapPoint ? snapResult.snappedTime : frameTime;
+ return snapResult.snapPoint
+ ? (snapResult.snappedTime as MediaTime)
+ : frameTime;
})();
scrubTimeRef.current = time;