diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-04-15 15:45:50 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-04-15 15:45:50 +0200 |
| commit | c46d28891fee62ca2d3132da876af6411a41d9da (patch) | |
| tree | f856f71d04c69628f26b904088d675dd298a5080 /apps/web/src/lib/timeline | |
| parent | 66e4367bc4727f1d0bcf8f869529c7518812277e (diff) | |
| download | opencut-c46d28891fee62ca2d3132da876af6411a41d9da.tar.gz | |
feat: text / custom masks, fix preview pan, refactor selection
Diffstat (limited to 'apps/web/src/lib/timeline')
| -rw-r--r-- | apps/web/src/lib/timeline/audio-state.ts | 14 | ||||
| -rw-r--r-- | apps/web/src/lib/timeline/element-utils.ts | 8 |
2 files changed, 21 insertions, 1 deletions
diff --git a/apps/web/src/lib/timeline/audio-state.ts b/apps/web/src/lib/timeline/audio-state.ts index 9625c482..165ece94 100644 --- a/apps/web/src/lib/timeline/audio-state.ts +++ b/apps/web/src/lib/timeline/audio-state.ts @@ -57,6 +57,20 @@ export function resolveEffectiveAudioGain({ return dBToLinear(resolvedDb); } +export function buildWaveformGainSamples({ + element, + count, +}: { + element: AudioCapableElement; + count: number; +}): number[] { + const durationSeconds = element.duration / TICKS_PER_SECOND; + return Array.from({ length: count }, (_, i) => { + const localTime = ((i + 0.5) / count) * durationSeconds; + return resolveEffectiveAudioGain({ element, localTime }); + }); +} + export function buildAudioGainAutomation({ element, trackMuted = false, diff --git a/apps/web/src/lib/timeline/element-utils.ts b/apps/web/src/lib/timeline/element-utils.ts index e56acd3c..e7ec4065 100644 --- a/apps/web/src/lib/timeline/element-utils.ts +++ b/apps/web/src/lib/timeline/element-utils.ts @@ -15,7 +15,6 @@ import { type TextElement, type SceneTracks, type TimelineElement, - type TimelineTrack, type AudioElement, type VideoElement, type ImageElement, @@ -414,6 +413,13 @@ export function getElementFontFamilies({ if (element.type === "text" && element.fontFamily) { families.add(element.fontFamily); } + if ("masks" in element) { + for (const mask of element.masks ?? []) { + if (mask.type === "text" && mask.params.fontFamily) { + families.add(mask.params.fontFamily); + } + } + } } } return [...families]; |
