Skip to content

Commit e6c6193

Browse files
committed
fix: linter
1 parent 685d902 commit e6c6193

2 files changed

Lines changed: 23 additions & 16 deletions

File tree

apps/web/src/timeline/components/timeline-element.tsx

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ import {
4949
import { buildWaveformGainSamples } from "@/timeline/audio-state";
5050
import { getTimelinePixelsPerSecond } from "@/timeline";
5151
import { buildWaveformSourceKey } from "@/media/waveform-summary";
52-
import { addMediaTime, TICKS_PER_SECOND, ZERO_MEDIA_TIME } from "@/wasm";
52+
import {
53+
addMediaTime,
54+
type MediaTime,
55+
TICKS_PER_SECOND,
56+
ZERO_MEDIA_TIME,
57+
} from "@/wasm";
5358
import {
5459
getActionDefinition,
5560
type TAction,
@@ -96,7 +101,7 @@ const PixelsPerSecondContext = createContext<number | null>(null);
96101
const THUMBNAIL_ASPECT_RATIO = 16 / 9;
97102

98103
interface KeyframeIndicator {
99-
time: number;
104+
time: MediaTime;
100105
offsetPx: number;
101106
keyframes: SelectedKeyframeRef[];
102107
}
@@ -112,11 +117,11 @@ export function buildKeyframeIndicator({
112117
keyframe: ElementKeyframe;
113118
trackId: string;
114119
elementId: string;
115-
displayedStartTime: number;
120+
displayedStartTime: MediaTime;
116121
zoomLevel: number;
117122
elementLeft: number;
118123
}): {
119-
time: number;
124+
time: MediaTime;
120125
offsetPx: number;
121126
keyframeRef: SelectedKeyframeRef;
122127
} {
@@ -149,7 +154,7 @@ export function getKeyframeIndicators({
149154
keyframes: ElementKeyframe[];
150155
trackId: string;
151156
elementId: string;
152-
displayedStartTime: number;
157+
displayedStartTime: MediaTime;
153158
zoomLevel: number;
154159
elementLeft: number;
155160
elementWidth: number;
@@ -158,7 +163,7 @@ export function getKeyframeIndicators({
158163
return [];
159164
}
160165

161-
const keyframesByTime = new Map<number, KeyframeIndicator>();
166+
const keyframesByTime = new Map<MediaTime, KeyframeIndicator>();
162167
for (const keyframe of keyframes) {
163168
const indicator = buildKeyframeIndicator({
164169
keyframe,
@@ -662,7 +667,7 @@ function KeyframeIndicators({
662667
}: {
663668
indicators: KeyframeIndicator[];
664669
dragState: KeyframeDragState;
665-
displayedStartTime: number;
670+
displayedStartTime: MediaTime;
666671
elementLeft: number;
667672
onKeyframeMouseDown: (params: {
668673
event: React.MouseEvent;
@@ -672,13 +677,13 @@ function KeyframeIndicators({
672677
event: React.MouseEvent;
673678
keyframes: SelectedKeyframeRef[];
674679
orderedKeyframes: SelectedKeyframeRef[];
675-
indicatorTime: number;
680+
indicatorTime: MediaTime;
676681
}) => void;
677682
getVisualOffsetPx: (params: {
678-
indicatorTime: number;
683+
indicatorTime: MediaTime;
679684
indicatorOffsetPx: number;
680685
isBeingDragged: boolean;
681-
displayedStartTime: number;
686+
displayedStartTime: MediaTime;
682687
elementLeft: number;
683688
}) => number;
684689
}) {
@@ -756,7 +761,7 @@ function ExpandedKeyframeLanes({
756761
keyframes: ElementKeyframe[];
757762
trackId: string;
758763
elementId: string;
759-
displayedStartTime: number;
764+
displayedStartTime: MediaTime;
760765
zoomLevel: number;
761766
elementLeft: number;
762767
keyframeDragState: KeyframeDragState;
@@ -777,13 +782,13 @@ function ExpandedKeyframeLanes({
777782
event: React.MouseEvent;
778783
keyframes: SelectedKeyframeRef[];
779784
orderedKeyframes: SelectedKeyframeRef[];
780-
indicatorTime: number;
785+
indicatorTime: MediaTime;
781786
}) => void;
782787
getVisualOffsetPx: (params: {
783-
indicatorTime: number;
788+
indicatorTime: MediaTime;
784789
indicatorOffsetPx: number;
785790
isBeingDragged: boolean;
786-
displayedStartTime: number;
791+
displayedStartTime: MediaTime;
787792
elementLeft: number;
788793
}) => number;
789794
}) {

apps/web/src/timeline/hooks/use-timeline-playhead.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export function useTimelinePlayhead({
102102
) as MediaTime;
103103

104104
const shouldSnap = snappingEnabled && !isShiftHeldRef.current;
105-
const time = (() => {
105+
const time: MediaTime = (() => {
106106
if (!shouldSnap) return frameTime;
107107
const tracks = editor.scenes.getActiveScene().tracks;
108108
const bookmarks = editor.scenes.getActiveScene()?.bookmarks ?? [];
@@ -118,7 +118,9 @@ export function useTimelinePlayhead({
118118
snapPoints,
119119
maxSnapDistance: getTimelineSnapThresholdInTicks({ zoomLevel }),
120120
});
121-
return snapResult.snapPoint ? snapResult.snappedTime : frameTime;
121+
return snapResult.snapPoint
122+
? (snapResult.snappedTime as MediaTime)
123+
: frameTime;
122124
})();
123125

124126
scrubTimeRef.current = time;

0 commit comments

Comments
 (0)