fix: show empty timeline lanes when no video is loaded
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -83,7 +83,8 @@
|
||||
clipStore.selectedClipId,
|
||||
clipStore.pendingInPoint,
|
||||
waveformData,
|
||||
session.thumbnailSpritesheets
|
||||
session.thumbnailSpritesheets,
|
||||
session.status === 'ready'
|
||||
);
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
@@ -37,7 +37,8 @@ export function drawTimeline(
|
||||
selectedClipId: string | null = null,
|
||||
pendingInPoint: number | null = null,
|
||||
waveform: WaveformData = { tiers: null },
|
||||
thumbnailSpritesheets: ThumbnailSpritesheet[] = []
|
||||
thumbnailSpritesheets: ThumbnailSpritesheet[] = [],
|
||||
hasVideo: boolean = false
|
||||
): void {
|
||||
const { width, height } = state;
|
||||
ctx.clearRect(0, 0, width, height);
|
||||
@@ -50,13 +51,13 @@ export function drawTimeline(
|
||||
if (thumbnailSpritesheets.length > 0) {
|
||||
drawThumbnails(ctx, state, thumbnailSpritesheets, duration, 0, THUMB_LANE_HEIGHT);
|
||||
} else {
|
||||
drawPlaceholderLane(ctx, state, 0, THUMB_LANE_HEIGHT, 'Thumbnails');
|
||||
drawPlaceholderLane(ctx, state, 0, THUMB_LANE_HEIGHT, 'Thumbnails', hasVideo);
|
||||
}
|
||||
|
||||
if (waveform.tiers) {
|
||||
drawWaveform(ctx, state, waveform, duration, THUMB_LANE_HEIGHT, WAVEFORM_LANE_HEIGHT);
|
||||
} else {
|
||||
drawPlaceholderLane(ctx, state, THUMB_LANE_HEIGHT, WAVEFORM_LANE_HEIGHT, 'Waveform');
|
||||
drawPlaceholderLane(ctx, state, THUMB_LANE_HEIGHT, WAVEFORM_LANE_HEIGHT, 'Waveform', hasVideo);
|
||||
}
|
||||
|
||||
drawClips(ctx, state, clips, selectedClipId, pendingInPoint);
|
||||
@@ -114,17 +115,20 @@ function drawPlaceholderLane(
|
||||
state: TimelineState,
|
||||
y: number,
|
||||
height: number,
|
||||
label: string
|
||||
label: string,
|
||||
showLabel: boolean
|
||||
): void {
|
||||
ctx.fillStyle = '#2a2a3e';
|
||||
ctx.fillRect(0, y, state.width, height);
|
||||
ctx.strokeStyle = '#353550';
|
||||
ctx.strokeRect(0, y, state.width, height);
|
||||
if (showLabel) {
|
||||
ctx.fillStyle = '#6c7086';
|
||||
ctx.font = '11px -apple-system, sans-serif';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.fillText(`Generating ${label}…`, state.width / 2, y + height / 2 + 4);
|
||||
}
|
||||
}
|
||||
|
||||
export function drawPlayhead(
|
||||
ctx: CanvasRenderingContext2D,
|
||||
|
||||
Reference in New Issue
Block a user