0.10.1: audio clip push-cascade + track-swap ghost, Media drawer rename

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
thandClaude Opus 4.7 committed 2026-04-22 12:52:47 +02:00
1 parent 04f867547d
commit c5b1dd566a
8 files changed
+538 -43

No files matched your search

+44
View File
@@ -1666,6 +1666,50 @@ export const useSceneStore = defineStore('scene', {
}
},
/** Move a clip to `(startTime, audioTrackId)` on the active page and
* cascade-push any existing clips on the target track out of the way
* (forward in time) so no overlap survives. Clips that end BEFORE
* the moved clip's new startTime are left alone. Returns `false`
* when the clip or target track is unknown. */
setAudioClipPosition(id: string, startTime: number, audioTrackId?: string): boolean {
const page = this.activeScene
const clip = page.audioClips.find((c) => c.id === id)
if (!clip) return false
const targetTrackId = audioTrackId ?? clip.audioTrackId
const targetTrack = page.audioTracks.find((t) => t.id === targetTrackId)
if (!targetTrack) return false
const lenOf = (c: AudioClip): number => {
const a = this.project.assets.find((x) => x.id === c.audioAssetId)
if (!a || a.kind !== 'audio') return 0
return Math.max(0, a.duration - (c.trimStart ?? 0) - (c.trimEnd ?? 0))
}
const newStart = Math.max(0, startTime)
const clipLen = lenOf(clip)
// Anything already on the target track, minus the one we're moving.
const others = page.audioClips
.filter((c) => c.audioTrackId === targetTrackId && c.id !== id)
.slice()
.sort((a, b) => a.startTime - b.startTime)
let floor = newStart + clipLen
for (const other of others) {
const len = lenOf(other)
// Clip entirely before the moved block — no cascade needed.
if (other.startTime + len <= newStart) continue
// Overlapping or sitting past the moved block but below the
// rolling floor → push it forward to the floor.
if (other.startTime < floor) other.startTime = floor
floor = other.startTime + len
}
clip.audioTrackId = targetTrackId
clip.startTime = newStart
return true
},
/** Trim from the head and/or tail of an audio clip. Keeps the audible
* block at least `MIN_VISIBLE` (0.05s) long — mirrors trimClipInstance. */
trimAudioClip(